Mock collection item update (delta update)

Hi,

The api exposes the endpoint /collections but i cannot seem to find anything else with regards to an item within a collection i.e. /collections/items/itemId

What I am seeing is that each existing item has its own id which makes me believe there’s a way to refer to it and perform an edit?

What I would like to do is to update one item at the time not the entire collection.

My request examples are quite heavy and I hit a bad request error when my entire request exceeds 20~mb.

I have read that you do not allow more than 1mb in the body and also that also that compressing the request body is not yet supported by postman.

What I want to understand is if there’s a way to perform a delta update on a collection?

Thanks

Hey @supply-technologist8 :wave:

Welcome to the Postman Community! :postman:

This might be something that could help you out here:

https://www.postman.com/postman/workspace/postman-public-workspace/collection/16473433-f2f0cb8f-609d-443f-913c-9831187c326e?action=share&source=copy-link&creator=14760314

Any endpoint in this collection needs the header Accept: application/vnd.postman.v2+json (already set in the collection). This will soon be removed and it will be part of the normal postman api docs.

Hey @danny-dainton, I focused so hard on the Postman API collection I have totally missed this one!!

What is the correct way to use it? I am afraid that the collection will grow a bit over time and I wont be able to get it and then determine the item ids Id like to update.

  1. GET https://api.getpostman/collections/id
  2. PUT https://api.getpostman/collections/responses/id

Could you link me to couple of examples please?

What are the requests and responses, the req/res within the item? The mock request and mock example response?

So far on a simple get by id on req or res I am only getting 404s, what am I missing?

Thank you

It’s me again, sorry I should learn to read, added the header you pointed out and I got some data back, thanks a million!

1 Like

Glad to see you have it working - The inclusion of the header is only temporarily required for those endpoints.

A blog post with examples and a more in depth look at the usages of those endpoints will be available soon.

Is it everything on the json request/response objects updatable? The examples only refer to few properties

For instance I am trying to update on the response

Url: {
  raw: “”,
  path: [
    “”,
    “”
  ]
}

And not having much luck with it this thus.

I need to update an entire item would that consist of two steps

1 update the request
2 update the response

Also is the body of the response updatable?

Thank you, thank you, looking forward to the blog post.

hey @danny-dainton I am trying to post a new request object to /collections/id/requests

Although I am having - method as post, the request created always appears as GET, am I wrong in using the Request object which is nested into Collection?

Where can I see more information on the expected request body for requests and responses endpoints?

Thank you

It’s me again it seems that the request one is easier than the response, I would really appreciate your help with the request body for /responses

Thanks

Hi, Cris!

Can you please attach the request body you are using?
In addition, if you can provide a bit of context on what are you trying to achieve that would be great:

  • Why are you doing this (what is your problem), what do you want to achieve
  • What is the process you are following
    … that would be great, so I could understand the problem better.

Thanks!

By the way, if you pass the “method” field in the request body when doing a POST on the collections/{id}/requests endpoint, it sets the request method to the method passed in the field (POST, PUT…)
We will add more examples to the documentation.

Hey @aerospace-geoscient2 I am playing a guessing game as I do not know what the request body model for both /requests and /responses should look like. I think I have wrongly assumed that it could use the ones listed here:

I have build a Collection object and cut the response/request pieces and tried to use them in the
/collections/id/requests
/collections/id/responses?request=requestId

I did manage to figure out the request body for /requests which is ultimately a flat json with name ;url;method fields

however I struggle with the request body for /responses as I have found out that for instance response code isn’t a code field but an entire object called responseCode.

Hence I requested some help in order to understand and use correctly the request body for both endpoints. Let me know if anything is unclear.

Providing some more answers to:
“Why are you doing this (what is your problem), what do you want to achieve”

I have a mock server to which I want to potentially add more items. By item I refer to an Item from the Collection object - Collection | Postman Collection Format - which consists of Request and Response objects. I am doing this programatically not manually hence I need to work with the API to achieve delta updates, rather than recreating the collection which is my current go to process.

So far I am recreating the whole collection (by sending PUT /collections/collectionId). When adding a new item (request with an example response pair) to the collection with my current process I receive a 400 error response because of the size of the request.
Each item’s response has a somewhat heavy body content and when they are all added together and then attempt to recreate the collection - the entire request to PUT /collections/collectionId - starts exceeding the maximum allowed size for the body of the request (from documentation is 1MB, I managed to push around 10+ mb).

Hence I started looking for ways to update items individually, but the documentation and ways to achieve that are scarce.

I had also tried to gzip the PUT /collections/collectionId request so that it’s lighter but that did not work out as I expected, i.e. nothing changed on the postman end and I still received the same 400 response

Hi!
I’ve created several examples that will help you with your problem:

  • Create a request passing a body: Postman
  • Get a request with body: Postman
  • Get a response with body: Postman
  • Create a response with body: Postman

I believe you can use these examples to solve your problem.
As Danny said, we will be working on the examples and the existing documentation, and we will also work on a blog post to help people with these endpoints.
Please let me know if this works for you.

1 Like

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