We are sending "name" parameter in the request as "Rajiv D'silva" but the request is not validated and the response is 401 Unauthorized.
@ashish22
401 error occurs because the request has failed an authorization check. This can happenfor a variety of reasons, such as
a) An invalid orexpired API key,
b)An invalid HMAC signature.
c) Request timingissue/problem with the Date header value. The API client should ensure acorrectly synchronized clock is used to generate request timestamps.
d)Incorrect JSON payload formation at the customer’s end thatcan 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 tocalculate the content length of the payload.
b.This is mandatory if you are trying to screen names withspecial characters. This is done to properly calculate the content byte lengthand not the string length.
c.It’s the length of the content/payload sent to the API whichdetermines that the request will succeed or not if your request containsspecial characters. Also, when the payload is being sent in the request, it hasto be sent as UTF-8 encoded.
Let me know if this helps.
Regards
It does not work with Postman also.
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 ?