# Postman API - /collections/id/responses endpoint 400 error

**URL:** <https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706>\
**Category:** Help Hub\
**Tags:** postman-api\
**Created:** [September 13, 2023, 8:34am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706 "2023-09-13T08:34:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![supply-technologist8](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@supply-technologist8](https://community.postman.com/u/supply-technologist8)\
**Post date:** [September 13, 2023, 8:34am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/1 "2023-09-13T08:34:55Z")

</div>

Hello team,

I am receiving the following error

Error code 400 and an error message:

```auto
{
	"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

---

<div class="post-metadata">

**Author:** ![supply-technologist8](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@supply-technologist8](https://community.postman.com/u/supply-technologist8)\
**Post date:** [September 13, 2023, 8:57am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/2 "2023-09-13T08:57:51Z")

</div>

This is the request body I am using:

```auto
{
    "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\"}"
}

```

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 13, 2023, 9:19am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/3 "2023-09-13T09:19:24Z")

</div>

400 is a client error.

[HTTP response status codes - HTTP | MDN (mozilla.org)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses)

_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.

---

<div class="post-metadata">

**Author:** ![supply-technologist8](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@supply-technologist8](https://community.postman.com/u/supply-technologist8)\
**Post date:** [September 13, 2023, 10:35am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/4 "2023-09-13T10:35:07Z")

</div>

Hey @michaelderekjones,

Postman works alright, programmatically not yet

body

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/5/c5f932c1073d6d8a9552673d3c56d74fb72524bd.png)

headers

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/9/d9b667a6a069d621979e88fe9cd3d0f33b86c3aa.png)

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.

---

<div class="post-metadata">

**Author:** ![supply-technologist8](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@supply-technologist8](https://community.postman.com/u/supply-technologist8)\
**Post date:** [September 13, 2023, 11:23am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/5 "2023-09-13T11:23:45Z")

</div>

```auto
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

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 13, 2023, 11:34am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/6 "2023-09-13T11:34:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![supply-technologist8](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@supply-technologist8](https://community.postman.com/u/supply-technologist8)\
**Post date:** [September 13, 2023, 11:47am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/7 "2023-09-13T11:47:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [October 28, 2023, 11:47am UTC](https://community.postman.com/t/postman-api-collections-id-responses-endpoint-400-error/51706/8 "2023-10-28T11:47:56Z")

</div>

Closed on October 28, 2023, 11:47am UTC

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.
