I am trying to figure out how to get sequence IDs for a specific campaign, using the v1 API. I have the campaign ID. As best I can tell, I need to use the “restfulRequest()” function call in the Infusionsoft library I’m using along with the ‘optional_properties=sequences’ parameter in order to get sequence numbers. This gives me a call that looks like this:
$urlToCall = 'https://api.infusionsoft.com/crm/rest/v1/campaigns/{campaignId}?optional_properties=sequences';
$campaignInfo = $infusionsoft->restfulRequest('get',$urlToCall,[$campaignNumber]);
But when I try to execute this, I get an ‘invalid token’ error. I then tried adding the auth token as a second GET parameter:
$urlToCall = 'https://api.infusionsoft.com/crm/rest/v1/campaigns/{campaignId}?accessToken=' . $accessToken . '&optional_properties=sequences';
and I get the same thing.
If I completely remove the attempt to get optional properties:
$urlToCall = ‘https://api.infusionsoft.com/crm/rest/v1/campaigns/{campaignId}’;
$campaignInfo = $infusionsoft->restfulRequest(‘get’,$urlToCall,[$campaignNumber]);
then I get a “General server error”.
What am I doing wrong?
Before making a request to the REST API, you have to using the OAuth2 or API Key Authentication.
If this is for a single client, the API Key authentication will work.
If you’re developing an application to work with Keap accounts to offer in the marketplace, then you’ll need to work with OAuth.
Hi Marion. Thanks for replying.
I do have a valid authentication token, and it should be incorporated into the $infusionsoft variable referred to in my code. I know it’s valid because I can do other function calls with it, including getting a list of campaigns with this call:
$urlToCall = 'https://api.infusionsoft.com/crm/rest/v1/campaigns';
$campaignInfo = $infusionsoft->restfulRequest('get',$urlToCall);
This works, but trying to do anything with a specific campaign fails. What am I missing?
I just tried it using Postman, and I was able to get back a valid response.
If you’re using a PAT… does that user account have permission to Campaigns?
Re: “does that user account have permission to Campaigns?”
I don’t know. How do I find out?
Log in to Keap, Under the Admin Menu click Users. Clickthe Edit Permissions link next to the user who created the PAT.
Once you’re in the users permissions, click on the Marketing tab, and scroll down to the Automation section and check the permissions there.