question

Upvotes
Accepted
22 6 8 8

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

world-checkworld-check-oneerror-401casepost
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
22 6 8 8

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3.1k 18 7 7
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.