How to update a request that is inside a folder?

we have a large API spec that we are trying to manually update by updating folders, requests and responses through the postman API. I am having a hard time understanding how to use the APIs mostly because the documentation that is provided through the collection is so limited. Here is the particular request I am trying to use: Postman

When updating a request that is in a folder, I get the “changeParentError” even though I am supplying the same folderId that the request is currently in. I don’t know if there is some different way that I am supposed to update the request but I don’t want to change the parent, I just want to update the request. Am I missing something?

Here is an example that gives the error:

https://api.getpostman.com/collections/23836355-6224d51a-d924-4c39-a58f-6970735aac8e/requests/71b872a7-3236-4fff-8a43-32631992c720
{
  "id": "71b872a7-3236-4fff-8a43-32631992c720",
  "name": "Get Password Dictionary",
  "folder": "1477f045-6191-7376-08cd-f2a75c60325b",
  "data": [
  ],
  "description": "This gets password dictionary for the organization",
  "headers": [],
  "headerData": [],
  "method": "GET",
  "pathVariables": [],
  "pathVariableData": [],
  "url": "{{baseUrl}}/password-dictionary",
  "responses": []
}

and the resulting error:

{
    "error": {
        "name": "changeParentError",
        "message": "You can't update the parent. Use transfer instead.",
        "details": {
            "server": {
                "model": "collection",
                "model_id": "6224d51a-d924-4c39-a58f-6970735aac8e"
            },
            "request": {
                "model": "collection",
                "model_id": "23836355-6224d51a-d924-4c39-a58f-6970735aac8e"
            }
        }
    }
}

Hi @philip-ellis. Welcome to the Postman Community.

The Postman API has a published documentation on Postmans documenter. You can access this documentation here as it has a lot of useful information.

The update request endpoint acts like a PATCH method. It only updates the values that you pass in the request body (for example, the name property). The endpoint does not update the entire resource. Including a folder ID in the request body signifies that you want to update the requests folder which is why you’re getting that error. Your collection ID and request ID in the path parameter should be sufficient.

The payload in this endpoint(as well as other endopoints on the Postman API) expects you to send a valid collection request as described by the Collection Format specifcation. You can take a look at this section of the documentation to see how a request is structured and follow that structure to update only relevant fields in your request.

1 Like

Thanks for the link to the documentation. I never actually saw that documentation before!

For the request issue, I figured it out. What you said about the folderId is not correct. You actually have to pass the folder, collection AND the original ID in order for the update to work. I had tried that before and I was getting the error, but then I realized that you cannot use the UUID, it has to be just the collection ID. It seems that this is different from all the other requests, and it’s also very confusing that it has to be specified BOTH in the url AND the body for it to work correctly. Here is the example body that worked for me. No other combination would work:

{
  "id": "71b872a7-3236-4fff-8a43-32631992c720",
  "collection": "6224d51a-d924-4c39-a58f-6970735aac8e",
  "name": "Get Password Dictionary",
  "folder": "1477f045-6191-7376-08cd-f2a75c60325b",
  "data": [
  ],
  "description": "This gets password dictionary for the organization",
  "headers": [],
  "headerData": [],
  "method": "GET",
  "pathVariables": [],
  "pathVariableData": [],
  "url": "{{baseUrl}}/password-dictionary",
  "responses": []
}

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