Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] When publishing an API from one APIM instance to another, how to update the URL in specification.yaml #726

Closed
aimtiaz11 opened this issue Feb 5, 2025 · 3 comments

Comments

@aimtiaz11
Copy link

aimtiaz11 commented Feb 5, 2025

Release version

v6.0.0-rc1

Question Details

When publishing an API after extracting from one APIM instance & publishing to another, how to update the servers.url in specification.yaml of an API?

File path: apim\apis\my-example-api\specification.yaml

openapi: 3.0.1
info:
  title: my-example-api
  description: ''
  version: '1.0'
servers:
  - url: https://dev.domain.com/my-example-api

Here, I want to update - url: https://dev.domain.com/my-example-api per environment.

The target environment I will be publishing to may have different URL like https://prod.domain.com/my-example-api. However, I cant find a way to overwrite it. Is there a way using the configuration.yaml files?

During publishing, I am seeing that it retains the URL from extracted environment and as a result it gives inconsistent value of
context.Request.Url.Path when evaluated in policy.xml unless its corrected manually or nulled out in APIs > MyAPI> Settings > Web Service URL field post publishing.

Expected behavior

A way to overwrite using configuration.yaml

Actual behavior

N/A

Reproduction Steps

N/A

Copy link

github-actions bot commented Feb 5, 2025

  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.

@aimtiaz11 aimtiaz11 changed the title [Question] When publishing an API from one APIM instance to another, how to update the URL specification.yaml [Question] When publishing an API from one APIM instance to another, how to update the URL in specification.yaml Feb 5, 2025
@JamesProant
Copy link

@aimtiaz11 You can use the configuration.yaml files to overwrite the url.

Add this to your configuration.yaml files:

configuration.dev.yaml:

apis:
  - name: my-example-api
    properties:
      serviceUrl: https://dev.domain.com/my-example-api

configuration.prod.yaml:

apis:
  - name: my-example-api
    properties:
      serviceUrl: https://prod.domain.com/my-example-api

@aimtiaz11
Copy link
Author

That worked. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants