Hello team,
I am receiving the following error
Error code 400 and an error message:
{
"error": {
"name": "parentMissingError",
"message": "Parent field is missing for the given model.",
"details": {
"model": "response",
"model_id": "121fac2d-d3m1-6gg2-3xl6-7k9d63bd7zq3",
"parent": "request"
}
}
}
I am calling that endpoint programatically with the same body, url, headers etc. which would work via the postman client and I get no errors?
Any ideas?
Thank you,
C
This is the request body I am using:
{
"name": "test_response",
"responseCode": {
"code": 200,
"name": "OK"
},
"headers": [
{
"key": "content-type",
"value": "application/json"
}
],
"text": "{\n\"testKey\":\"testValue\"}\n",
"language": "json",
"requestObject": "{\"method\":\"POST\",\"url\":\"https://test_server.com/test/test_response\"}"
}
400 is a client error.
HTTP response status codes - HTTP | MDN (mozilla.org)
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
The issue is with your request, but I doubt anyone here will be able to tell you what is wrong. Itโs down to what your API will accept. We would need to see the API specs as a starter for 10.
How have you configured this in Postman? (Can you post screenshots of the headers and body)?
If it works programmatically. Then check the logs for the working request. In particular the request headers and body and then cross check what Postman is sending.
Hey @michaelderekjones,
Postman works alright, programmatically not yet
body
headers
programmatically I only add the Accept header which was said to be required when using these collection items endpoints (and obviously the x-api-key one)
I had similar problem with the /requests endpoint and managed to figure out that a collection property was missing from the request body (which is not there when using postman, not even in the examples)
error message:
{"error":{"name":"parentMissingError","message":"Parent field is missing for the given model.","details":{"model":"request","model_id":"7x09658x-9x6x-3xx6-385x-3x123418xx4x","parent":"collection"}}}'
so I end up adding a property to the request model called - collection with a value the id of the collection and only then itโs worked.
So that got me thinking that I am not providing something essential to the request body of /responses which the error highlights to be - request field/object?
Itโs really though to get through this as the existing examples do not have such properties in the request bodies but still work, which makes me believe these things are worked out internally by the postman client.
I will give it a try adding request property with the request id as value and see where this leads me.
System.Exception: 'Postman request failed with status code: 404 and an error message: {"error":{"name":"instanceNotFoundError","message":"We could not find the request you are looking for","details":{"model":"request","model_id":"609763ec-c750-9534-936d-152be6ebb084","owner":"14561006"}}}'
ok this looks better, so thereโs indeed a missing request property or object, though it really is a painful empirical discovery
If its working in Postman, check the โ</>โ code option in the right hand pane.
You can select the programming language and it will create a code snippet as a starting point.
Also check the console log in Postman, so you can see exactly what was sent in the body and headers.
thanks, this helps
the problem was with the way I was calling the endpoint it requires a concatenated string of: owner-requestId, to be provided as requestId to the query filter