401 Unauthorized when attempting to post a case

I am attempting to integrate an API call into our sales system. I have managed to receive a reply to a GET request for groups, but I'm having trouble with posting new cases. I'm wondering if it could be due to the body having no whitespaces? The API returns a 401 Unauthorized when attempting to post this request:

Signing text:

(request-target): post /v1/cases

host: rms-world-check-one-api-pilot.thomsonreuters.com

date: Mon, 19 Sep 2016 12:50:42 GMT

content-type: application/json

content-length: 211

{"secondaryFields":[{"typeId":"SFCT_6","value":"AUS"}],"providerTypes":["WATCHLIST"],"name":"Aus T1768","caseId":"0017E000005k0PYQAY","groupId":"e6b0cb9a-73e8-408e-a206-482c93c8d7e5","entityType":"ORGANISATION"}

Headers:

Authorization: Signature keyId="{key}",algorithm="hmac-sha256",headers="(request-target) host date",signature="{signature}" Mon, 19 Sep 2016 12:50:42 GMT application/json 211

Date: Mon, 19 Sep 2016 12:50:42 GMT

Content-Type: application/json

Content-Length: 211

Body (as is, no line breaks or spaces removed):

{"secondaryFields":[{"typeId":"SFCT_6","value":"AUS"}],"providerTypes":["WATCHLIST"],"name":"Aus T1768","caseId":"0017E000005k0PYQAY","groupId":"e6b0cb9a-73e8-408e-a206-482c93c8d7e5","entityType":"ORGANISATION"}

Endpoint:

https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases

Best Answer

  • ivan
    Answer ✓

    I found the problem myself when I looked at the request again. I apparently forgot to add the content-type and content-length headers to the authorization header. I have added them, and the request returns.

Answers