596 "Service Not Found" error against xmlrpc api request


(Sohail Iqbal) #1

Hi All,

Trying to use the infusionsoft API to get contact details, I always get this error in response at least for the last couple of days:

Response Code = 596
Error message: <h1>596 Service Not Found</h1>

The API URL that I have tried as per the documentation is of the format:
https://api.infusionsoft.com/api/xmlrpc/v1?access_token=abc

replacing abc with actual token.

The request payload data format is for “ContactService.load” method.

This request is being made through Google apps script (actually I have accessed many API’s like Contstant Contact, SendGrid etc. via apps script to fetch data).

Can anyone guide me what I am doing wrong missing here…

Best,
Sohail


(John Borelli) #2

If you’re saying that the endpoint that you specified in your post has been functioning to load contacts from up until “…the last couple of days:” I don’t see how that’s possible as the end point you specify is not the api endpoint. The actual api endpoint is:

https://api.infusionsoft.com/crm/xmlrpc/v1

In fact, I don’t think that endpoint is used for anything at all.


(Sohail Iqbal) #3

Thank you @John_Borelli for clariying about the end point.

May be I was confused with the documentation saying: All requests except authentication requests made to the Infusionsoft XML-RPC API will be an HTTP POST to https://api.infusionsoft.com/crm/xmlrpc/v1?access_token=123abc

So, where should the access token and api key be specified while sending POST requests?

a) Token: in the standard header like 'Authorization' Bearer…?
b) I see a field available in the request body for specifying privateKey. The documentation says it is the API key. Place the API key there inside
<value><string>privateKey</string></value> ?

Please bear with my pretty naive queries as it seems I am not that much experienced in accessing API’s despite having done it for at least five different vendor API’s.


(John Borelli) #4

access_token=[your token here] as a URL parameter and then send the remainder request in the body being certain to include the correct content-type header value (eg application/xml)


(Sohail Iqbal) #5

Thanks @John_Borelli,

But that is exactly what I am doing baseURL + ?access_token=MyToken…
sample code:

 //--------------------------------------------------------------------------------------
//INF_TOKEN is the access token created from I/O Docs page.
//payload data format is copied from the documentation for retrieving a contact detail
//inside that data there is a field for 'privateKey' which is replaced with the API Key.

var url = "https://api.infusionsoft.com/api/xmlrpc/v1?access_token=" + INF_TOKEN;

var params = {
"method": "post",
"contentType" : "application/xml",
"payload" : payload,
"muteHttpExceptions": true
};
var resp = UrlFetchApp.fetch(url, params);
//----------------------------------------------------------------------------------

(John Borelli) #6

well, if what you posted here is what you’re trying to use then the url is still wrong.


(Sohail Iqbal) #7

@John_Borelli Would you mind sharing a sample correct url usage for retrieving a contact based on its email address? It would be much appreciated, thanks.

This is my first usage of xml-rpc. Normally, the API’s like Trello, Constant Contact etc. have parameters appended to the url along with key and the header is included in params object with Authorization Bearer = token combination.

method name: ContactService.findByEmail


(John Borelli) #8

Exactly the same url I shared before. Here, I’ll post the one you keep using and the one I posted:

https://api.infusionsoft.com/api/xmlrpc/v1 (you’re using this)
https://api.infusionsoft.com/crm/xmlrpc/v1 (this has to be with crm instead of api)

see the difference now? Next time I would just copy/paste what someone posts as a correction. You can’t correct your own work with your own eyes sometimes.


(Sohail Iqbal) #9

Thanks @John_Borelli !

Yes, my mistake, I overlooked it in your first message.
It proves the point that testing team can find those errors which the developers can’t.

At least, I get rid of the “service not found” issue, though it is now saying “unauthorized”, most probably token expired set or something else…


(John Borelli) #10

Yes, that would be expected with token expired. Just repeat the process to get a new initial token and you should be good.


(Sohail Iqbal) #11

Finally, with the new token generated, it started responding perfectly fine.
Thanks again, @John_Borelli

By the way, I am surprised as to:

  1. Why their I/O Docs page for live testing with API shows the url that I was using earlier (and you corrected me on that).
  2. Why they have two type of keys: one coming from web account; another from developer portal. Is there a proper one-shot way to tell my clients to get a specific key to work with the API.

Best,
Sohail


(John Borelli) #12

So I don’t see any endpoints on the i/o docs page so not sure where you got it from? There aren’t two keys but rather a client id and secret pair (the same as a public and private key I suppose) which allows you to get an auth token. That token allows you to request an access token which is what you would put into the apiKey field.