[Solved] Postman API, InstanceNotFoundError on single collection that is visible in the collection list

In our CICD pipeline, we use api requests to retrieve the relevant Collections to run through our tests. Therefore we do first a GET on the collections and do a GET on all collections to retrieve the content as JSON so we can run it with Newman.

Unfortunately, not all collections we get back do return a correct content. For example:
(anonymized with #)

curl -X GET \
  https://api.getpostman.com/collections \
    -H 'X-Api-Key: #############################' 

result:

{
    "collections": [
        {
            "id": "######-####-####-####-#######001",
            "name": "Collection ABC",
            "owner": "#######",
            "uid": "######-####-####-####-#######001"
        },
        {
            "id": "######-####-####-####-#######002",
            "name": "Collection DEF",
            "owner": "#######",
            "uid": "######-####-####-####-#######002"
        },
        {
            "id": "######-####-####-####-#######003",
            "name": "Collection XYZ",
            "owner": "#######",
            "uid": "######-####-####-####-#######003"
        }
}

When I do a get of Collection ABC and DEF, it returns a correct JSON. But when I do a get on Collection XYZ, I get the message:

curl -X GET \
  https://api.getpostman.com/collections/######-####-####-####-#######003 \
           -H 'X-Api-Key: #############################' 

{
    "error": {
        "name": "instanceNotFoundError",
        "message": "Instance not found in the database."
    }
}

It is reproducible for this and some other collections. Even when I make changes to their name or content. What am I doing wrong?

I could solve it by using the uid instead of id attribute to retrieve the collection. The difference seems to be as follow:

id is the id of the request
uid is the ownerid + id. I think to differentiate between different versions of users if you are working in a team.

When you try to get a collection by id, but it is created by another member it will throw the instanceNotFoundError. If you get the collection with the uid it works fine.

1 Like