Unable to import v2 version from a dev API to staging API v2

Hamza Junaid 0 Reputation points
2024-12-23T22:25:27.1266667+00:00

User's image

Hi,

I have original, v1 and v2 version of dev API 'Food shop - Dev' set up in my Azure API Management resource. After making changes in the v1 and v2 of dev API 'Food shop - Dev', I want to bring all the changes to my staging API 'Food shop - Staging' which only has original and v1 version which are now ofcourse outdated.

I tried to use the export and import feature. I went to 'Food shop - Staging' and created a new version 'v2' by using v1 as the source. I then deleted all the records from v2. I went to 'Food shop - Dev' and selected 'export'. It exported the yaml file.
I went to 'Food shop - Staging' and under v2 I chose 'import'. I specified the file and when I hit import it showed me this error.

Please help us. We're in the middle of a release.
Thanks.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,247 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Khadeer Ali 1,790 Reputation points Microsoft Vendor
    2024-12-24T21:59:27.8533333+00:00

    @Hamza Junaid ,

    Thanks for the patience!

    It seems there might be some duplicate entries (like operation names or paths) in the file you're trying to import, causing the "item with the same key" error.

    Here's what we can do:

    1. Double-check the file: Let's take a look to see if there are any operations, paths, or other elements with the same name. We can use a free online tool like Swagger Editor (link: https://editor.swagger.io/) to help us find these duplicates.
    2. Pick the best import method: There are different ways to import the file, depending on what you want to achieve. If you want to keep existing definitions and just add new ones, there might be an "Append" option available. Otherwise, creating a fresh version from scratch might be easiest.

    Once we've cleaned things up, try importing the file again. If you run into any trouble along the way, feel free to reach back and we will be happy to help you further!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.