We are sending "name" parameter in the request as "Rajiv D'silva" but the request is not validated and the response is 401 Unauthorized.
401 error occurs because the request has failed an authorization check. This can happen for a variety of reasons, such as
a) An invalid or expired API key,
b)An invalid HMAC signature.
c) Request timing issue/problem with the Date header value. The API client should ensure a correctly synchronized clock is used to generate request timestamps.
d)Incorrect JSON payload formation at the customer’s end that can cause them to observe 401 response.
Can you please share the complete request and response so that i can investigate this further?
We are getting 401 only if the name parameter in the request contains apostrophe e.g. Rajiv D'silva. But if the name parameter is Rajiv Dsilva without apostrophe then the response is 200. Is there any validation on the name parameter for special characters?
Does it work when you pass using postman?
Yes, for special characters you need to pass the request payload by
a. encoding the request payload as ‘UTF-8’ and then use it to calculate the content length of the payload.
b.This is mandatory if you are trying to screen names with special characters. This is done to properly calculate the content byte length and not the string length.
c.It’s the length of the content/payload sent to the API which determines that the request will succeed or not if your request contains special characters. Also, when the payload is being sent in the request, it has to be sent as UTF-8 encoded.
Let me know if this helps.
Can you turn on the postman console logs by clicking Alt+Ctrl+C on postman and send the request and send me the complete request and response ?
Also, about UTF-8 ecoding can you implement that and retry the request ?