Cronxite
Cronxite

Reputation: 1

Sage One API - authorization

I'm having trouble making an API call. Have got Token, Secret etc, no problem. Difficulties occur when trying to retrieve Contact information. I've tried to access the Sage Developers Forum but just get taken round in circles by the Sage sight.

Here is my own trace.

ACCESS : 2a075f2f204a380505a4f27378056bfa326b582f
REFRESH : 2de459f637c1c89bc7add9a424b04f4a2c29a6ec
POST : POST&https%3A%2F%2Fapi.sageone.com%2Faccounts%2Fv1%2Fcontacts&contact_type=1&1435822573
SIGNING : 4c53564b7b9f1542838e65384b2c506b37bb5c28&2a075f2f204a380505a4f27378056bfa326b582f
HASH : NzY2ODE1ZjJmOTVlMmY5MWVjODI2MjdhMTAyMGMyNWM0N2MyNjA1Ng==
CURL ARGS:

URL : https://api.sageone.com/test/accounts/v1/contacts?contact_type=1

AUTHORIZATION : Bearer 2a075f2f204a380505a4f27378056bfa326b582f
X-SIGNATURE : NzY2ODE1ZjJmOTVlMmY5MWVjODI2MjdhMTAyMGMyNWM0N2MyNjA1Ng==
X-NONCE : 1435822573
ACCEPT : */*
CONTENT-TYPE : application/x-www-form-urlencoded
USER-AGENT : Great Water

STRING : Authorization=Bearer 2a075f2f204a380505a4f27378056bfa326b582f&X-Signature=NzY2ODE1ZjJmOTVlMmY5MWVjODI2MjdhMTAyMGMyNWM0N2MyNjA1Ng==&X-Nonce=1435822573&Accept=*/*&Content-Type=application/x-www-form-urlencoded&User-Agent=Great Water&
RESULTS

{"error":"Authorization header is missing.","error_description":"Please provide an 'Authorization' header with the following format: Bearer xxxxx."}

As you can see, despite the Authorization argument being present, Sage is rejecting it.

Any ideas?

Upvotes: 0

Views: 1830

Answers (1)

Sharn White
Sharn White

Reputation: 624

Not sure what language you are using, but there are a couple of PHP classes on github that you can use as a reference.

If you want to use clientId / accessToken like in this documentation: https://developers.sageone.com/docs/en/v1

Use the class by EddieHarrison @ https://github.com/eddieharrison/sageone-api-php

If you have requested an Api Key from: https://accounting.sageone.co.za/Marketing/DeveloperProgram.aspx

Use the class i put up today @ https://github.com/Sharnw/sage-one-accounting-api

Upvotes: 0

Related Questions