400 when Posting a case

Options

when trying to post a new case in php, I keep getting a 400 response after around 20 seconds. I'm using php's file_get_contents along with stream_context_create. I have successfully retrieved a case this way using the following request object:

[method] => GET
[url] => https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/0a599156-6eb7-1e40-9bb3-2aae00039721
[header] => [
    [Date] => Tue, 10 Dec 2019 14:57:56 GMT
    [Authorization] => Signature keyId="0b8f7e24-16d0-4672-9234-9b07b84d90d3",algorithm="hmac-sha256",headers="(request-target) host date",signature="qDJDsCI8vxWgcPXbQG21zV5F89+G932NPGrH90AvKeU="
]

[content] =>

[wrapper] => http
[options] => [
    [http] => [
        [content] =>

        [header] => [
            [0] => Date: Tue, 10 Dec 2019 14:57:56 GMT
            [1] => Authorization: Signature keyId="0b8f7e24-16d0-4672-9234-9b07b84d90d3",algorithm="hmac-sha256",headers="(request-target) host date",signature="qDJDsCI8vxWgcPXbQG21zV5F89+G932NPGrH90AvKeU="
        ]

        [method] => GET
    ]
]

That returns the case as expected. The following request object is what keeps returning a 400 response:

[method] => POST
[url] => https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases
[header] => [
    [Date] => Tue, 10 Dec 2019 14:56:17 GMT
    [Content-Type] => application/json
    [Content-Length] => 233
    [Authorization] => Signature keyId="0b8f7e24-16d0-4672-9234-9b07b84d90d3",algorithm="hmac-sha256",headers="(request-target] host date content-type content-length",signature="+pY/EAeJtN5/nGlVLN0ux/0j56ItyZd+ghpNRcutxXg="
]

[content] => [
    [groupId] => 0a3687d0-6d92-196f-9b87-2dc30000256c
    [caseId] => 1238
    [entityType] => INDIVIDUAL
    [providerTypes] => [ [0] => WATCHLIST ]
    [name] => Joseph
    [customFields] => []
    [secondaryFields] => []
]

[wrapper] => http
[options] => [
    [http] => [
        [content] => [
            [groupId] => 0a3687d0-6d92-196f-9b87-2dc30000256c
            [caseId] => 1238
            [entityType] => INDIVIDUAL
            [providerTypes] => [ [0] => WATCHLIST ]
            [name] => Joseph
            [customFields] => []
            [secondaryFields] => []
        ]

        [header] => [
            [0] => Date: Tue, 10 Dec 2019 14:56:17 GMT
            [1] => Content-Type: application/json
            [2] => Content-Length: 233
            [3] => Authorization: Signature keyId="0b8f7e24-16d0-4672-9234-9b07b84d90d3",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="+pY/EAeJtN5/nGlVLN0ux/0j56ItyZd+ghpNRcutxXg="
        ]

        [method] => POST
    ]
]


Best Answer

  • d.marcella
    d.marcella Newcomer
    Answer ✓

    I discovered the reason this wasn't working was because I was sending my content as a JSON/php associative array, while the server expects it to be stringified/json_encoded.

Answers