The v1/jobs endpoint in the Clarisights API is requires the user to send a POST request with authentication to https://platform.adwyze.com/api/v1/jobs along with associated parameters and operations; and returns the job ID in the following format -
{ "job_id": "ID" } 

Here's a sample v1/jobs request - 

{
   "request_type": "facebook_realtime",
   "request": {
      "metrics": [
         "fb_impressions",
         "fb_spend"
      ],
      "filters": [],
      "level": "campaign",
      "segment": "gender",
      "account_id": 294,
      "start_date": "2018-05-01",
      "end_date": "2018-05-31",
      "page_size": 10,
      "attribution_windows": [
         "7d_view",
         "28d_click"
      ]
   }
}

"request_type"

 This indicates the type of realtime job that is being requested. Currently only "facebook_realtime" is supported. 

"request"

 This contains the actual parameters of the requested job. 

Following are accepted parameters - 

"metrics" - This should contain the list of metrics to query in an array of strings. For example, "metrics": ["fb_spend", "fb_impressions"] . The list of supported metrics can be queried from the v1/realtime_metrics endpoint.

"level" - This should contain the level at which the breakdown segments have been requested. For example, "level": "campaign". The list of supported levels can be queried from the  v1/levels endpoint.

"segment" - This should contain the segment (a.k.a breakdown) that have been requested. For example, "segment": "gender". The list of supported segments or breakdowns can be queried from the v1/segments endpoint.

"filters" - This should contain the criteria to filter the data. Realtime filters can be applied only on dimensions, and multiple filters at once are supported. Multiple filters should be sent as an array, in the following sample format -
{ "dimension": "<dimension_name (operand 1)>", "operator": "<operator to apply>", "value": "<operand2>" }] 

For example,
{"dimension":"account", "operator":"$in", "value":Performance}] 

List of supported operators for dimensions can be found below

"start_date" - This should specify the required starting date of the requested data's date range. For example, "start_date": "2018-05-01".

"end_date" - This should specify the required ending date of the requested data's date range. For example, "end_date": "2018-06-01".

"page_size" - This should specify the maximum number of rows of results to be returned in the response. It should be a whole number. For example, "page_size": 10.

"account_id" - This should specify the chosen account ID to request the data of. Only one account is supported in a single request. Please refer to the v1/accounts endpoint to retrieve the respective IDs. For example, "account_id": 294.

"attribution_windows" - This can specify any additional attribution windows for the data, in addition to the default (default is set in your company-wide preferences). Currently supported windows are - 1d_view , 7d_view , 28d_view , 1d_click , 7d_click , 28d_click. For example, "attribution_windows": [ "1d_view", "7d_click" ].

Once you send the request, the v1/jobs endpoint will respond back with a job ID as explained in the beginning above. In order to view the status of the job and the requested data, send a GET request with authentication to https://platform.adwyze.com/api/v1/jobs/[jobID].

This will return the "status" of the job - working, queued or complete - and the requested data once the status returns 'complete'. If an error occurred while processing the request, the "error" flag will return 'true', else it will return 'false'.

Please note that real-time API jobs are available only for Facebook ad channel data at present.

Did this answer your question?