Hi,
I am currently moving away from XML to be using the JSON endpoints on your api and I found an issue.
When I try to create a new client I have a (400) Bad Request returned from your endpoint.
I’ve tried to use the API sandbox which seems to work with the same Json request I have.
Can you help?
This is the Json I am sending on the request. (Obscured personal details)
Without seeing the code that you’re using to send the request it could be a number of things, e.g. the wrong Content-Type header, reusing the same SubmissionNumber from a previous request, a problem in exactly how you’ve computed the MD5 signature, etc. etc. There should be some sort of body to the 400 response giving more details but how you access the body in error cases is another thing that varies depending on which HTTP request library you’re using.
I’ve tested the code above and it works fine on my end. It may be, as @ian_roberts suggested, one of the values that you’ve blocked out relating to the authentication.
Again, if you want us to be able to help you debug you will have to share the code you are using to call the API, in whatever language that is written. There should be some way to extract the error message from the 400 response, or at the very least a way to enable wire-level logging so you can see what your code is sending and receiving, but exactly how you do that depends what language and library you’re using.
OK, so you need to wrap everything from the WebRequest.create to the end of the CommonRequest method in a try block as you will get a WebException thrown when the server responds with 400. If you catch that exception then the exception itself provides access to the response body, which should include the actual error message.
A bit of additional advice though - it’s far too easy to introduce syntax errors when you construct JSON by hand with string concatenation, I strongly recommend you use System.Text.Json or similar.