ActiveCampaign Forum

Get campaign subject in API


#1

I don’t see the subject line of a campaign in the API results (campaigns endpoint). Am I looking in the wrong place? This seems like a blatant oversight.


#2

I think you need to grab the campaign using this:
https://developers.activecampaign.com/v3/reference#list-all-campaigns

Then grab the subject using this:
https://developers.activecampaign.com/reference#retrieve-a-message


#3

Thanks for this help. I guess I’m not clear on the connection between messages and campaigns. When I look at a message response, there doesn’t seem to be any campaign-id. There doesn’t seem to be any list of messages in the response of a campaign.

Given that I know the campaign id, how would I figure out all the messages that are associated?


#4

There might be a better way of doing this but I would suggest that you try these steps.

First, get this working: https://:account.api-us1.com/api/3/campaigns

You’ll need to grab the campaignid to use in this call:
https://:account.api-us1.com/api/3/campaigns/id/links

There, you’ll grab your messageid to use in this call:
https://:account.api-us1.com/api/3/messages/id

Then you can grab the subject in that data.

It might be helpful to output the data that’s returned like so:

echo "The entire result printed out:<br>";
echo "<pre>";
print_r($result);
echo "</pre>";

That should make it easier to see what you’re playing around with at each step of the way.

I hope that helps.


#5

Thanks so much. This does work, and while I think it’s stupid to have make three calls like this for a basic piece of data, I appreciate you helping me through it.

Perhaps to repay the favor, I would recommend the Restlet Client chrome extension – it’s really useful for playing with APIs like this. I use it without an account and it’s been great.