Hi,
I have been using the XML-RPC API for some time successfully, and now I am trying to add some calls to the REST API. Specifically, I want to use the Delete Contact method.
When I try to call the Delete Contact method, it returns “Developer Inactive”. I am certain that the Access token is valid because I can call XML-RPC api methods using it.
Is there any other reason why I might get “Developer Inactive”?
thanks
The developer token (for REST) and the api key (for XML-RPC) are two different things and cannot be used interchangeably. If you wish to use REST then you will need to authenticate using the OAuth process.
Hi John:
To be clear - I am using OAuth rather than the legacy developer key to authenticate for the XML-RPC API.
And this has been working successfully.
I have since looked at the Mashery article you posted here.
The exact error is {X-Mashery-Error-Code=ERR_403_DEVELOPER_INACTIVE}, which in this article indicates that against a protected endpoint resource, it occurs “When developer is found to be inactive”.
thanks
Conor
Perhaps it’s easiest to just see the code that’s calling for authentication? Posting that might help. Looking closer at the wording, it sounds like it’s more in how it’s getting passed but seeing is easier to figure out.
OK, I’ll share the code I’m using to call the REST API (using RestSharp).
Prior to calling this code, I can call an XML-RPC method using the value of the parameter “accessToken” and it works OK.
public void DeleteContact(string clientId, string clientSecret, string accessToken, int contactId)
{
var apiUrl = new Uri(_webConfig.InfusionSoftAPIBaseUrl);
// expect the configured Base URL to be https://api.infusionsoft.com
var restClient = new RestClient
{
BaseUrl = new Uri(apiUrl, @"/crm/rest/v1"),
Authenticator = new HttpBasicAuthenticator(clientId, clientSecret)
};
var request = new RestRequest(Method.DELETE) { Resource = "contacts/{contactId}" };
request.AddParameter("contactId", contactId, ParameterType.UrlSegment);
request.AddQueryParameter("accessToken", accessToken);
request.AddHeader("content-type", "application/json");
request.AddHeader("Accept", "application/json, */*");
var response = restClient.Execute(request);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new ApplicationException(string.Format(@"Failed to delete Contact {0}", contactId), new Exception(response.Content));
}
}
@Conor_McCarthy thanks for using OAuth with the XML-RPC API!
I agree with your thinking… if it works there, it should work for the REST API, too.
Is it possible your REST implementation has something hardcoded or maybe doesn’t handle refresh the same was as your XML-RPC implementation?
For anyone interested, I resolved this using the following code. Note how the Authorization parameter for the bearer token is created.
My source was this StackOverflow reply.
var restClient = new RestClient
{
BaseUrl = new Uri(apiUrl, @"/crm/rest/v1")
};
var request = new RestRequest(Method.DELETE) { Resource = "contacts/{contactId}" };
request.AddParameter("contactId", contactId, ParameterType.UrlSegment);
request.AddParameter("Authorization", string.Format("Bearer " + accessToken), ParameterType.HttpHeader);
request.AddHeader("content-type", "application/json");
request.AddHeader("Accept", "application/json, */*");
var response = restClient.Execute(request);