Campaign

The campaign record exposes a campaign to REST web services.

This record:

For more information about working with campaigns in the UI, see Campaign Overview.

The REST API Browser includes information about the field names and field types of the campaign record. It also includes the HTTP methods, request parameters, and operations available to this record. For details, see the REST API Browser's campaign reference page.

For information about using the REST API Browser, see The REST API Browser.

Record ID

The record ID for a campaign REST record is campaign.

Prerequisites

You must enable the Marketing Automation feature before you can use this record through REST web services. For more information, see Marketing Automation Overview.

To use all the fields on this record, you must enable the following features: Mail Merge, Promotion Codes, and Subscription Categories.

Additional Details

Consider the following when using the campaign record in REST.

  • The following fields in the Statistics tab are read-only and automatically computed with REST services: totalRevenue, roi, profit, costPerCustomer, convCostPerCustomer, conversions, leadsGenerated, uniqueVisitors.

  • The Cost field is automatically computed based on costs for associated events.

  • The campaignId field is read-only and generated after the record is created.

  • The defaultEvent subrecord is read-only and generated after the record is created.

  • The following supporting record isn't exposed to REST: Channel.

Code Samples

The following samples show common actions for a campaign.

Get Campaign

              GET <domain>/record/v1/campaign/<ID> 

            

Update the Title Field on an Existing Campaign

              PATCH <domain>/record/v1/campaign/127
{
   "title": "New Campaign Title"
} 

            

Add an Unscheduled Email Event to an Existing Campaign

              PATCH <domain>/record/v1/campaign/<ID>
{ "campaignEmail": { "items": [{ "campaignGroup": "<Group ID>", "channel": "<Channel ID>", "cost": 11.0, "datescheduled": "2023-10-30", "timescheduled": "10:20", "description": "From REST", "promoCode": "<Protocode ID>", "status": "<Status ID>", "subscription": "<Subscription ID>", "template": "<Template ID>"
}] }
} 

            

POST Request:

              POST /services/rest/record/v1/campaign HTTP/1.1
Host: 3619616.suitetalk.api.netsuite.com
Content-Type: application/json
Authorization: OAuth realm="3619616",oauth_consumer_key="",oauth_token="",oauth_signature_method="",oauth_timestamp="",oauth_nonce="",oauth_version="1.0",oauth_signature=""
Content-Length: 2684
{
   "audience": { "id": "1" },
     "baseCost": 5.0,
"campaignDirectMail": {
"items": [
{
"campaignGroup": { "id": "237" },
"channel": { "id": "-3" },
"cost": 3.0,
"dateScheduled": "2025-10-13",
"description": "descr",
"promoCode": { "id": "1" },
"status": { "id": "NOTSTART" },
"subscription": { "id": "4" },
"template": { "id": "12" }
}
]
},
"campaignDrip": {
"items": [
{
"channel": { "id": "-7" },
"cost": 1.0,
"description": "Stuff for sale for our staf",
"promoCode": { "id": "3" },
"subscription": { "id": "2" },
"template": { "id": "28"}
}
]
},
"campaignEmail": {
"items": [
{
"campaignGroup": { "id": "234" },
"channel": { "id": "-2" },
"cost": 2.0,
"dateScheduled": "2025-10-13",
"description": "Stuff for sale for our staf",
"promoCode": { "id": "2" },
"status": { "id": "NOTSTART" },
"subscription": { "id": "1" },
"template": { "id": "28" },
"timeScheduled": "04:00"
}
]
},
"campaignEvent": {
"items": [
{
"campaignGroup": { "id": "220" },
"channel": { "id": "-6" },
"cost": 4.0,
"dateScheduled": "2025-10-13",
"description": "descr",
"promoCode": { "id": "2" },
"status": { "id": "NOTSTART" },
"subscription": { "id": "3" }
}
]
},
"category": { "id": "-11" },
"endDate": "2025-08-30",
"expectedRevenue": 1.0,
"family": { "id": "1" },
"isDefaultLeadSource": false,
"isInactive": false,
"item": {
"items": [
{
"id": "67"
}
]
},
"keyword": "campaign",
"message": "Test message",
"offer": { "id": "1" },
"owner": { "id": "-5" },
"promotionCode": { "id": "1" },
"searchEngine": { "id": "2" },
"startDate": "2025-08-01",
"title": "Test title",
"url": "https://myurl.com/coolcampagin",
"vertical": { "id": "1" },
} 

            

Related Topics

General Notices