Preview a campaign

Use this endpoint to preview a campaign. The endpoint outputs the campaign in HTML and text.

Service URL:

rest/api/v1.3/campaigns/{campaignName}/preview

Required Path Parameters:

  • campaignName - Name of the campaign to preview.

Query Parameters:

  • listType: The type of source list you wish to preview. Possible values are ProofList or ProfileList. Default value is ProofList.

  • previewType: This allows you to output only one type of preview. Possible values are HTML and text. By default, both are output.

  • riid: This allows you to preview based on a specific RIID.

Request Method:

GET

Request Header:

Authorization=<AUTH_TOKEN>

Content-Type=application/json

Request Body - Required Properties:

Not applicable

Sample Response Body

{
  "campaignName": "Winter_Campaign",
  "listType": "ProfileList",
  "riid": 126006727,
  "preview": [
    {
      "type": "html",
      "data": "<html><head><title>Test document</title></head><body><p>This is to test. City is $CITY_$, MobileNumber is $MOBILE_NUMBER_$ </p></body></html>\n"
    },
    {
      "type": "text",
      "data": "<HTML><BODY><PRE style=\"white-space:pre-wrap;word-wrap: break-word;\"><html><head><title>Test document</title></head><body>This is to test</br><a href="https://www.oracle.com"><img src="img/example.png"/></a></body></html>\n</PRE></BODY></HTML>"
    }
  ]
}

Sample Responses in case of failure:

Not an email campaign: Requests fail if the campaign specified is not an email campaign. The error resembles:

{
 "type": "",
 "title": "Not a valid campaign",
 "errorCode": "CAMPAIGN_IS_INVALID",
 "detail": This Api is supported only for EMD Campaigns",
 "errorDetails": []
}

Campaign not found: Requests fail if the campaign specified cannot be found. The error resembles:

{
 "type": "",
 "title": "Campaign not found",
 "errorCode": "CAMPAIGN_NOT_FOUND",
 "detail": "detail": "[ R_RichPushCampaign ] Campaign Not Found"
 "errorDetails": []
}

Message content undefined: Requests fail if the message content is undefined. The error resembles:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "Message content not defined",
  "errorDetails": []
} 

List type not valid: Requests fail if the list type is not proofList or profileList. The error resembles:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "List Type can only be ProfileList or ProofList"
  "errorDetails": []
} 

Preview type not valid: Requests fail if the preview type is not html or text. The error resembles:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "Preview Type can only be html or text"
  "errorDetails": []
} 

RIID does not exist: Requests fail if the RIID is not present. The error resembles:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "RIID [ 2935296071 ] not present in selected list for campaign [ campaignpreview_2prooflist] ", 
  "errorDetails": []
} 

No records in list: Requests fail if the lists contain no records. The error resembles:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "Proof List and profile list associated with campaign [ Camp_P ] have no valid records", 
  "errorDetails": []
} 

Campaign does not contain a proof list: Requests fail if the campaign does not have a proof list. The error resembles:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail":"Campaign [ Camp_P ] does not have any Proof list", 
  "errorDetails": []
}