postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.82k stars 839 forks source link

Ability to Update Collections when manually importing an API Spec #8950

Open obieo opened 4 years ago

obieo commented 4 years ago

Is your feature request related to a problem? Please describe. Currently when manually importing an API spec that was not built in postman, the user has no option to "update" a collection that was previously created based off of that spec. Therefore the only option is to replace the collection (all tests, parameters, etc. are not retained) or make a copy of that collection and manually add test and parameters back.

Describe the solution you'd like

  1. User makes changes to API spec outside of Postman that has already had a collection created from it in Postman
  2. User manually imports the API spec to incorporate new changes to the spec
  3. User has option to "update" the existing collection that is associated with the API spec, allowing all tests, parameters, etc to be retained

Describe alternatives you've considered As more integrations become available for different repositories, automating the import and update of the spec/collection would make for a very seamless process for managing our APIs with Postman.

ahsankarimbhai commented 3 years ago

We have similar workflow. Our API specs are independently generated outside of Postman by our CI pipelines. Our use case is following:

  1. Import the OpenAPI spec initially to create a Postman collection. Write tests in the collection for the requests by adding missing parameters, header and body data. Run the collection via Newman CLI as part of CI pipeline
  2. Our OpenAPI could change from build to build so we want a way (from UI and programmatic/CLI) to now sync the collection with the new spec file. We expect the collection to not completely replace the old collection but rather keep the tests, parameters, header and body values that we added previously. If the new spec has a new API added then the API should be added to the updated collection without losing old data.

Is this currently possible to do with Postman?

Does this issue: https://github.com/postmanlabs/postman-app-support/issues/6722 only apply to use cases where we are developing APIs and OpenAPI specs within postman? Is there a programmatic option to update the collection or via CLI that we can do it on runtime as part of automation.

We'd like a seamless workflow that doesn't require manual intervention. When the spec changes then we should be able to run a command from CI pipeline to update the collection and then run the postman tests using Newman using the updated collection.

arlemi commented 3 years ago

@ahsankarimbhai This is not possible for now, though we're hoping to release an API endpoint to update collections linked to an API spec in the short term which should solve your issue as you'd be able to trigger the update from your CI/CD pipeline. We'll post updates on this issue once it is released: https://github.com/postmanlabs/postman-app-support/issues/8697

stewartie4 commented 3 years ago

The major win of postman docs is they are so easy to create with collections the team is probably already using, but the more I use it the more I realise how half-baked it is and how most basic features are stuck in 'roadmap hell':

Getting so sick of figuring out that a basic feature is missing, only to see it added to a roadmap and never moved from there.

sansfromage46 commented 3 years ago

Hello, I have the same problem. I would need to be able to update a collection, imported from a URL containing a WADL, from this same URL. This is to keep all the tests created.

This could be done from a right click or an "Update collection" button, or by a new import from the URL (identical URL = request:

Thank you

sn0rk64 commented 3 years ago

I have the same problem and I'm agree with @sansfromage46

neil-119 commented 3 years ago

In our case, we have a GraphQL endpoint and our GraphQL SDL is dynamically generated. In Postman, we are importing from a URL and generating the collection, which works great, but we find ourselves having to repeatedly import / delete the old collection and setup auth/tests again. This feature would be great!

ffffionn commented 3 years ago

This is definitely a workflow issue using Postman with OpenAPI. I still use it because Postman is great, but having to reset auth, tests and pre-request scripts every time is a pain, and that's without dealing with a new Mock API each time too.

arlemi commented 3 years ago

@ffffionn For OpenAPI specs you can import it as an API, generate the collection from it once and then keep on updating it instead of re-generating from scratch, check this video and the docs which might help.

ffffionn commented 3 years ago

@arlemi This looks like what I need, thanks! The video helped with what I was missing from the workflow

ffffionn commented 2 years ago

@arlemi I dont see how to do this in Postman 9.0

arlemi commented 2 years ago

@ffffionn Good catch, looks like the new UI doesn't allow to update a mock from a schema. I've opened #10307 to track it.

In the meantime, you can generate a Test collection, then mock that collection. You can then update the Test collection and the mock will be updated subsequently. Screenshot 2021-09-20 103744

andre-dasilva commented 2 years ago

any updates on this issue? currently its not possible to update a manually imported api

spacecat commented 2 years ago

@ffffionn For OpenAPI specs you can import it as an API, generate the collection from it once and then keep on updating it instead of re-generating from scratch, check this video and the docs which might help.

@arlemi

I tried this:

Setup new github integration Configured all of my branches in postman push and pull works fine I gave postman app authorization on github as per prompted so postman can read/write etc in my repo I imported my swagger.json (generated from my Headless CMS) as API in postman I generated collection in postman I added a new pagetype in the CMS which in turn autogenerates the new endpoints for my swagger.json schema I then took the new swagger.json and overwrote the old swagger.json that I have in version control I commited the changes where I could clearly see the new pagetype I added I then went back to postman Did a pull to pull the latest changes from the schema that I pushed earlier on github Then I expected postman to automatically update the collections in the left pane but it didn't So what am I doing wrong?

If I click on the generate collection button it will create a new collection which is not what I want. I just want to update the already available one.

The definition has been updated however, I can see that under the "Definition" tab.

Edit 1: This article talks about you having to have a pro subscription in order for the github integration to work? I'm currently on the FREE tier. https://blog.postman.com/backup-and-sync-your-postman-collections-on-github/

arlemi commented 2 years ago

@spacecat Once you've generated the collection once, you can update it using the validation feature, there's a demo of it in this video from 5:40: https://youtu.be/BUZiRtGRHj0?t=340

The blog you mentioned about GitHub is about the back up feature, not the version control integration, but I can see how it can be confusing. 😅

Fak3 commented 2 years ago

@arlemi I dont even have the "develop" tab in my postman client. Is this video old, and the feature does not exist anymore?

Screenshot_20220819_090259

arlemi commented 2 years ago

@Fak3 Good point, the UI did change a bit over the last few months. Here's how you can do it now: updatedocs4

If you do not see a "Collection Documentation" make sure you generate one first.

VShingala commented 1 year ago

With the v10 release, we've made some changes around syncing collection with the API definition feature. Collection updates from API definition are now accessible in the "Collections" section under the API overview page. One can choose to Enable update suggestions from definition for the corresponding collection under API. This will make sure whenever certain changes are done in the definition, they can be also included in the corresponding collection.

https://github.com/postmanlabs/postman-app-support/assets/16756296/452a0490-64c5-460b-a90c-dac1732622ce

We're evaluating how this can be done within import flow and updates can be suggested. We will add an update here once we have something in place.

EmreSURK commented 10 months ago

@VShingala Can we watch a swagger link?

VShingala commented 9 months ago

@EmreSURK This is only supported for OpenAPI 3.0 at the moment.

ElanHasson commented 3 weeks ago

Where is this supported? I import from URL and it makes a local file vs storing the URL to the openapi spec at the remote URL.

The Enable update suggestions from definition option is disabled saying it can't find a valid API definition.

image

Edit: Found the issue: https://community.postman.com/t/invalid-api-definition-due-to-null-in-response/59838/2