We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

/widget/data/preview

Test or debug a widget object or content configuration.

This API method differs from /public/widget/data in several important respects:

  • It requires authentication (and https).

  • The requests are not logged as impression (and requests to the click URLs are not logged as clicks).

  • It bypasses most caches.

  • It can be used for testing widget objects or content configurations before saving (by providing these objects as arguments).

  • The response may contain additional debug information (that can be useful if you get unexpected results).

Request

The request object does not have any required fields (but either widget, widgetId or size must be specified). It may contain the same fields as any request to /public/widget/data. In addition, you may specify:

Name

Type

Description

widget

Object

The

widget object

you want to test.

content

Object

The

content configuration

you want to test.

contentId

String

The ID of an existing content configuration.

userAgent

String

Device userAgent.

size

Integer

The number of items you want in the response.

debug

Boolean

Whether to include debug info in the response ("false" by default).

diagnostics

Boolean

Whether to include diagnostic info in the response ("false" by default).

useSecureUrls

Boolean

If true, use https for the fields thumbnail and dominantthumbnail (cf. "schemeAdjusted" content settings).

If size is specified, then it is used instead of the size in the widget object. Similarly content (or contentId) overrides any content configuration specified by the widget object.

Response

The response object always contains the same response field as /public/widget/data (items). If debug or diagnostics is true, it will also contain:

Name

Type

Description

debugInfo

Object

A data structure explaining why these particular items were returned.

recsDebugInfo

Object

A data structure with extra debugging information, similar to what gets recorded into "recs" events if debugMode is enabled.

resolvedRequest

Object

A version of the request object with all fields "resolved". For instance if a widgetId is provided, the associated widget and content fields will be populated with the associated configuration. A content configuration will also have its imports included, and its defaults applied.

The debugInfo should be relatively self-explanatory for anyone familiar with content settings objects, but beware that the format of this data structure may change without notice.

If diagnostics is true, response will also contain:

Name

Type

Description

impressionId

String

An API request id to include when reporting problems to support, which will ease debugging.

time

Number

The duration in milliseconds of the request.

Example

$ cx.py /widget/data/preview '{"debug":true, "size": 2, "content": {"siteGroupId": "9222313579846435879", "settings": {"type": "recs", "siteIds": ["9222312395241214880"]}}}'
{
 "items": [
 {
 "click_url": "https://api.cxense.com/public/widget/click/svkYDgL-3BPLj24SQClcGSOMXOzwMdq15U9QovPkbfD2t6zmWk5OqmE3MqrsVQeZp89kDrAJUmR7mr2sNG9HnzyEJwcAWVyElaVdRomxOKdbCS0HIba7BTyVnGqoG0x3DyYfXzKm5AoEVRwIdcmsfaKZqWwHVmKg7HICvmbbtNgKMn8Yt3WcxKuX7HeeSAjnIhtWT65tPfPF1fPjghfJGXjkKa_3cU6DRA47WKEDqEuKwrd5ZDy6W2i-MW71Q7_DnX6hm-0b2OK6RprvrLxiIpWgKPgNZgxW5nBHBCo_KSUPN0cyft2Vb7sLbqO9RDgweXliB0NHDVaEzhPGuTCSP2fC07J5URioSGWMANcQPQIkf_rGLfItEGmQeXwkIscuCdyjELCytpgkRWrHqFy991dVV2eCyeNoWSUWH8kuAjxqhUMj35SnHE--OpZq2PVodG8dMCOKDWXZig0",
 "dominantthumbnail": "https://analytics.cdn.cxense.com/analytics/ImageService/ThumbnailDominant_mGp0qDlpMhLRKXW28sY688eE%29yU%3D",
 "title": "Take 1 minute to learn how to make your online business thrive",
 "description": "http://www.",
 "url": "https://www.cxense.com/about/news/1-minute-online-business-thrive"
 },
 {
 "click_url": "https://api.cxense.com/public/widget/click/8cPMriEYRyjAXmg96glyYtnxlJ7eVk7eAdxV-ji4ZdObZ5_HrqgS-vkgDKWjr-3DHmAwHImJEpAhCDT_xcWVZBnncE_WYGNLFiYBc4TN8VpzdmGJt_4z_9ubMLpp1FiGeyNkpTr798vIK6IHPksF-lFtPWhbhYzQwfupNaH6gXoAjJsGzdoLl6uxB6o5F7l0wT6ZNuxxINBBn1Al6cOdIyW5yNTKkJO_PWzXl492qqlkbC8fkfJLe8rAlEVSNfMSfcqQXVTQ3qWGX_esgaQOW0ZdH_ICWYo8Kj2vq11SzhmsUaY69Gy_AzUGOS_xzZHJXUgDoJTE9oxXoe4KBhtEW0tQ0HRqeE_ZWaJgisIET-hY4NbShxrniayC_zPhl8R0tltydVT3ksEgonHwAKT7kU9m50pVCgbbTuLPNX7Hc5T6Y9RGffh31AvLVA6WwsSxnVpJx3d7Csc0",
 "dominantthumbnail": "https://analytics.cdn.cxense.com/analytics/ImageService/ThumbnailDominant_DaBYJsvFSd9wwFQRdGChEiiA8cw%3D",
 "title": "Financial Calendar",
 "description": "Cxense's financial calendar for the upcoming year shows the publication dates of key reports.",
 "url": "https://www.cxense.com/investor-relations/financial-calendar"
 }
 ],
 "debugInfo": {
 "type": "recs",
 "items": [
 {
 "document": "9222312395241214880:986a74a839693212d12975b6f2c63af3c784fb25",
 "url": "https://www.cxense.com/about/news/1-minute-online-business-thrive",
 "type": "trend",
 "score": 0.7679703
 },
 {
 "document": "9222312395241214880:0da05826cbc549df70c054117460a1122880f1cc",
 "url": "https://www.cxense.com/investor-relations/financial-calendar",
 "type": "backfill",
 "score": "NaN"
 }
 ]
 }
}

Last updated: