Need some plain simple API examples or assistance please


(Belinda Whitfield) #1

Ok so the api’s to get started in my point of view is lacking.

All I want to do is get a payload of data, which in it self should be easy. I don’t care which api XML-RPC or REST API or I/O.
The main issues is getting the top secret Access Token.
From what I could figure out from the limited explanation and examples.
XML-RPC or REST is more an api for the sdk, so integration with the given programming language would be required: PHP, RUBY etc. (I do not want to code)

All I want to do is make a webservice call and get payload of data.
I tried I/O which seem to be more user friendly.

There are a couple of inputs which one needs to select.
So the “OAuth 2.0 Flow” input has default select.
Then “Client ID”, this one I figure out, but there is no information to assist in guiding a user what this could be.
Then “Client Secret”, this one i have no idea. Is this the api key, is this the passphrase. I registered as develop and got a secret code. Should I use that?

So after I click “Authorize” I need to sign into my account, which I do and then get a error message "Unable to create access token."
That is it, nothing else. No mention that my client secret input might be incorrect or connection failed or anything to give me any indication on what to focus on or do next to resolve the problem.

I was thinking of using the RESP API and make a rest call. So I need to use https://api.infusionsoft.com/token
But I have no idea regrading the schema I should use for the form parameters.
Would this be correct:
{ client_id: CLIENT_ID,
client_secret: NOT_SURE,
code : Would this be the access token?
grant_type: This is default so why do I even have to fill this in?
redirect_uri: There was no redirect_uri, cause i just want to get data payload?
}

Total confused and frustrated at moment. Please assist,


(John Borelli) #2

Have you created the mastery account the get the id/secret values with and have you checked that it is not still “pending”

Also, the redirect uri is necessary to return the auth token (which is what you use to get the access and refresh tokens with)


(Belinda Whitfield) #3

Hi John, thank you for your response.

Yes, I have created a mastery account with secret values and it’s active.

I manage to get the I/O api working via on screen generation of access token and I am using this for figuring out how things work and testing.

So just to be clear, it seems when using the other 2 api options XML and REST, one can only do this programmatically to get access token or refresh access token via php or python or MS.Net or Ruby, correct?

Any idea the average time before access token expires ?


(John Borelli) #4

Hi @Belinda_Whitfield,

The token is good for 24 hours so using the refresh token to get a new set anytime before that would be sufficient. Most developers store these tokens in a database and run a service on a schedule to refresh and update the database consistently.

The api is technically a separate entity from the implementation language. In other words, your request goes from the language to the api in Infusionsoft. The languages themselves are more like “wrappers” or an interface. So when the IO Docs work it should be functional on all implementations (though each has a quirk here or there overall this is accurate). I personally use the PHP and most developers seem to do the same. So it seems that your issue is more process related. Have you looked at the github examples?

Infusionsoft, RealGeeks and NovakSolutions all provide examples/sample code that could be helpful. It sounds like what’s happening thus far is once you authorize an app (by clicking allow) you’re not receiving the authorization token back on your end where the redirect uri is specified. This token is the one that will actually allow you to get your initial access/refresh tokens.