Preview a Campaign
/rest/api/v1.3/campaigns/{campaignName}/preview
Request
-
campaignName: string
Campaign name for preview
-
listType: string
The type of source list you wish to preview. Possible values are ProofList or ProfileList. Default value is ProofList.
-
previewType: string
This allows you to output only one type of preview. Possible values are html or text. By default, both are output.
-
riid: string
This allows you to preview based on a specific RIID.
Response
- application/json
Default Response
object
previewCampaign-response
-
campaignName(optional):
string
Name of the campaign
-
listName(optional):
string
Data source name used for preview.
-
listType(optional):
string
List type (data source) used for preview. Can be either a Profile List or Proof List.
-
preview(optional):
array preview
-
riid(optional):
string
RIID used for preview.
array
-
Array of:
object preview-response
Title:
preview-response
object
preview-response
-
data(optional):
string
Preview data
-
type(optional):
string
Preview type (text or html)
Examples
Use this interface to preview a campaign sent to a recipient. The endpoint outputs the campaign in HTML and text.
Required request headers:
FIELDS | DESCRIPTION |
---|---|
Authorization | <AUTH_TOKEN> |
Content-Type | application/json |
Sample Request URL:
/rest/api/v1.3/campaigns/Winter_Campaign/preview
Sample Response
{ "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 Request URL:
Preview a campaign using the Proof List as the data source.
/rest/api/v1.3/campaigns/example_campaign/preview?listType=ProofList
Sample Response
{ "campaignName": "example_campaign", "listType": "ProofList", "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 Request URL:
Preview a campaign as HTML.
/rest/api/v1.3/campaigns/example_campaign/preview?previewType=html
Sample Response
{ "campaignName": "example_campaign", "listType": "ProofList", "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" } ] }
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": "[ Example_Campaign ] 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 [ Example_Campaign] ", "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 [ Example_Campaign ] 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 [ Example_Campaign ] does not have any Proof list", "errorDetails": [] }