Campaign Object
An Account Engagement campaign tracks the first interaction that a person has with your online marketing materials. Associate your assets to an Account Engagement campaign to organize and track your marketing efforts. Learn more about Account Engagement campaigns in Salesforce Help.
Include the authentication header with every request. For information on how to authenticate, see Authentication.
Resource Name | Operations | Description |
---|---|---|
Campaign Create | POST | Create a campaign record. |
Campaign Read | GET | Request information for a single campaign. |
Campaign Query | GET | Request information for the campaigns that match the specified criteria. |
Campaign Update | POST | Update a campaign's information, including campaign fields. |
Note: We recommend using Salesforce Connected Campaigns. When Connected Campaigns is enabled, only Campaign Read and Campaign Query are available.
Create a campaign with the specified fields.
You can use any campaign field as a parameter. For a list of campaign fields, see Campaign.
Create a campaign with the name New Campaign and a cost of 2,000.
Request information for a single campaign.
Replace <ID>
with the Account Engagement ID of the campaign.
Request information for the campaign with ID 12341xxx.
Request information about the campaigns that match the specified criteria. You can specify which campaigns and which fields to request. A maximum of 200 campaigns are returned, unless you specify the output as mobile. If you specify the output as mobile, then all campaigns are returned.
Note: To request information about a specific campaign, use Campaign Read.
Use these parameters to specify which campaigns are returned. Parameters can be used in any combination and in any order unless otherwise specified.
Notes:
- Parameters must be URL-encoded.
- Dates and times must use GNU Date Input Syntax (yyyy-mm-dd:hh:ss
). - For a full listing of campaign fields see Object Field References.
Parameter | Type | Possible Values | Description |
---|---|---|---|
created_after | string | today , yesterday , last_7_days , this_month , last_month ,<custom_time> | Request campaigns created after the specified date and time. Example: To request forms created in 2020, use /api/campaigns/version/3/do/query?created_after=2019-12-31 24:59:59 . |
created_before | string | today , yesterday , last_7_days , this_month , last_month , <custom_time> | Request campaigns created before the specified date and time. Doesn’t include campaigns created at the specified time. <custom_time> Example: to request campaigns created before today (but not created today), use /api/campaign/version/3/do/query?created_before=today . |
id_greater_than | integer | Any positive integer | Request campaigns that have an Account Engagement ID greater than the specified number. |
id_less_than | integer | Any positive integer | Returns campaigns that have an Account Engagement ID less than the specified number. |
name | string | string | Request campaigns with the specified name. |
updated_after | string | today , yesterday , last_7_days , this_month , last_month , <custom_time> | Request campaigns that were last updated after the specified date and time. |
updated_before | string | today , yesterday , last_7_days , this_month , last_month , <custom_time> | Request campaigns that were last updated before the specified date and time. |
Use these parameters to specify which campaign fields are returned, and how the campaigns are sorted.
Parameter | Type | Possible Values | Description |
---|---|---|---|
limit | integer | Any integer from 1 through 200. | The number of campaigns to return. Default value is 200. |
offset | integer | Any positive integer | The number of campaigns to omit from the response (the number to "skip over"). Example: Retrieve a list of campaigns, omitting the 50 most recently updated campaigns. Sort the query by the updated_at field and use offset=50: api/campaign/version/3/do/query?sort_by=updated_at&offset=50 |
sort_by | string | created_at , id , name , updated_at ,cost | The field by which the results are sorted. See Sort Order. |
sort_order | string | ascending, descending | The sort order. The default value depends on which sort_by value you specify. See Sort Order. |
Use sort_by
to specify which field Account Engagement uses to sort the results. Different fields have different default sort orders.
Value | Default Sort Order | Description |
---|---|---|
created_at | descending | Sort the results by the campaigns' created_at timestamps. |
id | ascending | Sort the results by the campaigns' id fields. |
name | ascending | Sort the results by the campaigns' name fields. |
updated_at | descending | Sort the results by the campaigns' updated_at timestamps. |
cost | descending | Sort the results by the campaigns' cost fields. |
Request a list of campaigns, sorted in ascending order by cost.
Update a campaign's information, including campaign fields. Fields that aren’t specified in the request aren’t changed. To clear a field, use a null value.
Returns an updated version of the campaign.
Replace <ID>
with the Account Engagement ID of the campaign.
You can use any campaign field as a parameter. For a list of campaign fields, see Object Field References.
To update a campaign's name to "March Webinar" and reset the cost as blank, use the following POST command:
The XML response for a query request contains information about multiple campaigns. The XML response for a read request contains information about a single campaign.
Tag | Description |
---|---|
<result> | Parent tag. Contains the campaigns that match the parameters specified in your query. |
<total_results> | The number of campaigns selected by the query. Note: The query request returns a maximum of 200 campaigns. If your query matches more than 200 campaigns, you can make several requests to retrieve all matching records. |
<campaign> | The information for a single campaign. For information about campaign fields, see Campaign. |
Tag | Description |
---|---|
<campaign> | The information for a single campaign. For information about campaign fields, see Campaign. |