Postman API: How to manipulate objects at collection level?

Hi folks,

I’be been fighting with the Postman API to manage my collections programatically.

Some context:

  • One of my collections has 2.2 megabytes.
  • It takes about 3 minutes to update using a PUT https://api.getpostman.com/collections/{{collectionId}}.
  • I also get an erratic and mysterious error HTTP 500 Server error
  • Sometimes it works, sometimes it doesn’t. Usually republishing the collection a second time does the trick, until the next time…

I’ve been able to get a delta/diff of the collection objects (Folders, Requests, Responses) and update only what has changed.

The problem is with new folders, I can create them fine, but I can’t find a way to put them in the correct order.
It seems a new folder goes to the end of the list, which is expected, but how do I change it’s order?

The collection does have an order property which accepts the id’s of the children objects and sorts them, however we can’t:

  • PATCH the collection, it only accepts name and description updates.
  • PUT the collection without the items, forcing a complete update (3 minutes)

I even tried to move all folders into a new folder, hoping that moving them out in the right order would work, but when we PUT to a folder you cant change the parent…

{
    "error": {
        "name": "changeParentError",
        "message": "You can't update the parent. Use transfer instead.",
        "details": {
            "server": {
                "model": "folder",
                "model_id": "dd2f62ac-0681-599b-80f0-16ef31c4e1e9"
            },
            "request": {
                "model": "folder",
                "model_id": "8119550-24586ca4-4fa8-5f3e-b41f-62015a40ab23"
            }
        }
    }
}

What is that transfer?

What am I doing wrong? How to solve this?

Cheers

Hi!
We recently made public a set of endpoints that allow you to manage collection items like folders, requests, and responses.

If you have all your folders inside a single folder, you can sort them using a PUT folders request like in this example.

You can also PUT a folder’s content to change the folder individually.

Please let us know if these endpoints would help you solve your problem. We have several examples on each endpoint, but if you find your use case is not covered, please let us know so we can improve the collection.
Thanks!

Hi @aerospace-geoscient2, thanks for you answer.

That is precisely the point.

I am using the endpoints you’ve suggested, for Folders, Requests, and Responses, no problems there.

But those endpoints do not allow me to manipulate objects at the collection level, and the collection endpoint does not allow me to manipulate objects without recreating the collection from scratch.

I now have 4 issues (3 more than yesterday):

  • How to update the sorting of Folders at collection level
  • How to update Authorization at collection level
  • How to update Variables at collection level
  • How to update scripts (both pre-request and test) at collection level

All of this without recreating the entire collection, which in my case takes about 3 minutes, and gives me an erratic HTTP 500 server error.

The PUT to the collection endpoint forces me to include all items recreating the collection
The PATCH end point of the collection can only be used to update name and description

How to solve this?

Hi!
So far we don’t have a PATCH at the collection level that allows us to change that information, so that won’t be possible with the current Postman API. I’m working with the internal development teams to see if that would be possible, but so far I don’t have any response. I’ll keep you informed if we find a solution.
Thank you for your patience.

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