Create a campaign

post

/api/rest/2.0/assets/campaign

Creates a campaign that matches the criteria specified by the request body.

Request

Supported Media Types
Body ()
The request body defines the details of the campaign to be created.
Root Schema : Campaign
Type: object
Title: Campaign
Show Source
Nested Schema : elements
Type: array
A list of campaign elements.
Show Source
Nested Schema : fieldValues
Type: array
Array containing type and id values for all of the contactFields associated with a given contact. For campaigns, "fieldValues" include all custom campaign fields (type, id, value).
Show Source
Nested Schema : permissions
Type: array
The permissions for the campaign granted to your current instance. This is a read-only property.
Show Source
Nested Schema : CampaignElement
Type: object
Title: CampaignElement
Show Source
Nested Schema : outputTerminals
Type: array
A list of the campaign element ids within the campaign. This is a read-only property.
Show Source
Nested Schema : permissions
Type: array
The permissions for the campaign element granted to your current instance. This is a read-only property.
Show Source
Nested Schema : Position
Type: object
Title: Position
Show Source
  • The campaign element's type. This is a read-only property.
  • The position of the campaign element on the x axis.
  • The position of the campaign element on the y axis.
Nested Schema : CampaignOutputTerminal
Type: object
Title: CampaignOutputTerminal
Show Source
Nested Schema : permissions
Type: array
The permissions for the campaign output terminal granted to your current instance.
Show Source
Nested Schema : FieldValue
Type: object
Title: FieldValue
Show Source
  • Read Only: true
    The id of the field to be set to the corresponding value.
  • Name of the field value.
  • The asset's type in Eloqua. This is a read-only property.
  • The value to set the corresponding field id to. Date values must be submitted as a unix timestamp.
Back to Top

Response

Supported Media Types

201 Response

Success
Body ()
Root Schema : Campaign
Type: object
Title: Campaign
Show Source
Nested Schema : elements
Type: array
A list of campaign elements.
Show Source
Nested Schema : fieldValues
Type: array
Array containing type and id values for all of the contactFields associated with a given contact. For campaigns, "fieldValues" include all custom campaign fields (type, id, value).
Show Source
Nested Schema : permissions
Type: array
The permissions for the campaign granted to your current instance. This is a read-only property.
Show Source
Nested Schema : CampaignElement
Type: object
Title: CampaignElement
Show Source
Nested Schema : outputTerminals
Type: array
A list of the campaign element ids within the campaign. This is a read-only property.
Show Source
Nested Schema : permissions
Type: array
The permissions for the campaign element granted to your current instance. This is a read-only property.
Show Source
Nested Schema : Position
Type: object
Title: Position
Show Source
  • The campaign element's type. This is a read-only property.
  • The position of the campaign element on the x axis.
  • The position of the campaign element on the y axis.
Nested Schema : CampaignOutputTerminal
Type: object
Title: CampaignOutputTerminal
Show Source
Nested Schema : permissions
Type: array
The permissions for the campaign output terminal granted to your current instance.
Show Source
Nested Schema : FieldValue
Type: object
Title: FieldValue
Show Source
  • Read Only: true
    The id of the field to be set to the corresponding value.
  • Name of the field value.
  • The asset's type in Eloqua. This is a read-only property.
  • The value to set the corresponding field id to. Date values must be submitted as a unix timestamp.

400 Response

Bad request. See Status Codes for information about other possible HTTP status codes.

401 Response

Unauthorized. See Status Codes for information about other possible HTTP status codes.

403 Response

Forbidden. See Status Codes for information about other possible HTTP status codes.

404 Response

The requested resource was not found. See Status Codes for information about other possible HTTP status codes.

500 Response

The service has encountered an error. See Status Codes for information about other possible HTTP status codes.
Back to Top

Examples

The following examples demonstrate how to create a new campaign using an HTTP request and cURL. For more information on requests, see API requests.

HTTP Request Example

Create a new campaign:


POST /api/REST/2.0/assets/campaign
Content-Type: application/json 
			

Request body:


{
  "name": "My New Campaign",
  "budgetedCost": "1000.00"
}
			

Response:


{
  "type": "Campaign",
  "currentStatus": "Draft",
  "id": "49",
  "createdAt": "1468609818",
  "createdBy": "9",
  "depth": "complete",
  "folderId": "1263",
  "name": "My New Campaign",
  "permissions": [
    "Retrieve",
    "SetSecurity",
    "Delete",
    "Update",
    "Activate"
  ],
  "updatedAt": "1468609818",
  "updatedBy": "9",
  "isReadOnly": "false",
  "actualCost": "0",
  "budgetedCost": "1000.00",
  "campaignCategory": "contact",
  "campaignType": "",
  "fieldValues": [
    {
      "type": "FieldValue",
      "id": "5",
      "value": ""
    },
    {
      "type": "FieldValue",
      "id": "6",
      "value": ""
    },
    {
      "type": "FieldValue",
      "id": "7",
      "value": ""
    },
    {
      "type": "FieldValue",
      "id": "8",
      "value": ""
    }
  ],
  "isEmailMarketingCampaign": "false",
  "isIncludedInROI": "false",
  "isMemberAllowedReEntry": "false",
  "isSyncedWithCRM": "false",
  "product": "",
  "region": ""
}
			

cURL Example

Here is the same example in cURL given an instance with the name APITest, username API.User, and POD of 3.


curl --user "APITest\API.User" --header "Content-Type: application/json" --request POST --data '{"name":"My New Campaign","budgetedCost":"1000.00"}' https://secure.p03.eloqua.com/api/rest/2.0/assets/campaign
			

HTTP Request Example

Create a new campaign with a custom end date:


POST /assets/campaign
Content-Type: application/json 
			

Request body:


{
  "name": "Campaign with Custom End Date",
  "startAt": "1518739200",
  "endAt": "1530210149",
  "x_e10_activationEndType": "custom"
}
			

Response:


{
  "type": "Campaign",
  "x_e10_activationEndType": "custom",
  "x_e10_createdAt": "1521218146",
  "x_e10_createdBy": "9",
  "currentStatus": "Draft",
  "id": "108",
  "createdAt": "1521218142",
  "createdBy": "9",
  "depth": "complete",
  "folderId": "1263",
  "name": "Campaign with Custom End Date",
  "permissions": [
    "Retrieve",
    "SetSecurity",
    "Delete",
    "Update",
    "Activate"
  ],
  "updatedAt": "1521218142",
  "updatedBy": "9",
  "isReadOnly": "false",
  "actualCost": "0",
  "budgetedCost": "0",
  "campaignCategory": "contact",
  "campaignType": "",
  "endAt": "1530210149",
  "fieldValues": [],
  "isEmailMarketingCampaign": "false",
  "isIncludedInROI": "false",
  "isMemberAllowedReEntry": "false",
  "isSyncedWithCRM": "false",
  "product": "",
  "region": "",
  "startAt": "1518739200"
}
			

cURL Example

Here is the same example in cURL given an instance with the name APITest, username API.User, and POD of 3.


curl --user "APITest\API.User" --header "Content-Type: application/json" --request POST --data '{"name":"Campaign with Custom End Date","startAt":"1518739200","endAt":"1530210149","x_e10_activationEndType":"custom"}' https://secure.p03.eloqua.com/api/rest/2.0/assets/campaign
			

HTTP Request Example

Create a new simple email campaign:


POST /assets/campaign
Content-Type: application/json 
			

Request body:


{
  "name": "Simple_Email_Campaign",
  "campaignCategory": "emailMarketing",
  "elements": [
    {
      "type": "CampaignSegment",
      "id": "-1",
      "name": "Segment members",
      "segmentId": "88",
      "outputTerminals": [
        {
          "type": "CampaignOutputTerminal",
          "connectedId": "-2",
          "connectedType": "CampaignEmail",
          "terminalType": "out"
        }
      ],
      "isFinished": "false",
      "isRecurring": "false"
    },
    {
      "type": "CampaignEmail",
      "id": "-2",
      "sendTimePeriod": "sendAllEmailAtOnce",
      "emailId": "10",
      "includeListUnsubscribeHeader": "true",
      "isAllowingResend": "false",
      "isAllowingSentToMasterExclude": "false",
      "isAllowingSentToUnsubscribe": "false",
      "stoArbitrationDelay": "1",
      "stoType": "none",
      "position": {
        "x": "393",
        "y": "224"
      }
    }
  ]
}
			

Note:

Your segment id and email id will differ from the ids used in this example request body. Use the Segments and Emails API endpoints to verify the asset ids from your Eloqua instance.

Response:


{
  "type": "Campaign",
  "currentStatus": "Draft",
  "id": "127",
  "createdAt": "1571666618",
  "createdBy": "9",
  "depth": "complete",
  "folderId": "1263",
  "name": "Simple_Email_Campaign",
  "permissions": [
    "Retrieve",
    "SetSecurity",
    "Delete",
    "Update",
    "Activate"
  ],
  "updatedAt": "1571666618",
  "updatedBy": "9",
  "elements": [
    {
      "type": "CampaignSegment",
      "id": "2264",
      "initialId": "-1",
      "name": "Segment members",
      "memberCount": "0",
      "memberErrorCount": "0",
      "outputTerminals": [
        {
          "type": "CampaignOutputTerminal",
          "id": "1847",
          "connectedId": "2265",
          "connectedType": "CampaignEmail",
          "terminalType": "out"
        }
      ],
      "position": {
        "type": "Position",
        "x": "0",
        "y": "0"
      },
      "isFinished": "false",
      "isRecurring": "false",
      "segmentId": "88"
    },
    {
      "type": "CampaignEmail",
      "id": "2265",
      "initialId": "-2",
      "memberCount": "0",
      "memberErrorCount": "0",
      "position": {
        "type": "Position",
        "x": "393",
        "y": "224"
      },
      "sendTimePeriod": "sendAllEmailAtOnce",
      "emailId": "10",
      "includeListUnsubscribeHeader": "true",
      "isAllowingResend": "false",
      "isAllowingSentToMasterExclude": "false",
      "isAllowingSentToUnsubscribe": "false",
      "stoArbitrationDelay": "1",
      "stoType": "none"
    }
  ],
  "isReadOnly": "false",
  "actualCost": "0",
  "budgetedCost": "0",
  "campaignCategory": "emailMarketing",
  "campaignType": "",
  "crmId": "",
  "fieldValues": [
    {
      "type": "FieldValue",
      "id": "9",
      "value": ""
    },
    {
      "type": "FieldValue",
      "id": "10",
      "value": ""
    },
    {
      "type": "FieldValue",
      "id": "11",
      "value": ""
    }
  ],
  "isEmailMarketingCampaign": "true",
  "isIncludedInROI": "false",
  "isMemberAllowedReEntry": "false",
  "isSyncedWithCRM": "false",
  "product": "",
  "region": ""
}
			

cURL Example

Here is the same example in cURL given an instance with the name APITest, username API.User, and POD of 3.


curl --user "APITest\API.User" --header "Content-Type: application/json" --request POST --data '{"name":"Simple_Email_Campaign","campaignCategory":"emailMarketing","elements":[{"type":"CampaignSegment","id":"-1","name":"Segment members","segmentId":"88","outputTerminals":[{"type":"CampaignOutputTerminal","connectedId":"-2","connectedType":"CampaignEmail","terminalType":"out"}],"isFinished":"false","isRecurring":"false"},{"type":"CampaignEmail","id":"-2","sendTimePeriod":"sendAllEmailAtOnce","emailId":"10","includeListUnsubscribeHeader":"true","isAllowingResend":"false","isAllowingSentToMasterExclude":"false","isAllowingSentToUnsubscribe":"false","stoArbitrationDelay":"1","stoType":"none","position":{"x":"393","y":"224"}}]}' https://secure.p03.eloqua.com/api/rest/2.0/assets/campaign
			
Back to Top