Closed devang93 closed 3 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @miaojiang.
Hi service team, would you have a look at this issue? I don't reproduce this in my side, and the message should comes from the service http response. Thank you.
@changlong-liu Were you able to create an api using the api parameters listed above? Are those parameters looks good to you?
Hi, @devang93 , I get ErrorResponseException with a different error message using the api parameters listed above. The error message is returned by the service side.
@changlong-liu got it. I am trying to debug it by changing some parameters to None but still unable to figure out for which parameters its giving me this error. Waiting on the service team's response. Thanks
@changlong-liu Any updates here? I am not sure how to reach out to the service team and we are blocked here.
@devang93 are you using actual OpenApiSpec in the Value field (instead of sample_test)? you can first try to do this using REST API https://docs.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/apis/createorupdate
value= "sample_test", format="openapi"
@KedarJoshi I didn't quite understand it. What is the expected value for "value" field?
I just commented the "value" field out and I was able to create the api in apim. However, it doesn't import all the operations automatically.
@KedarJoshi after going through the rest api documentation I understand that "value" field requires api spec documentation.
I am passing the following values for a sample api but it still fails with the same error. The sample api in this example uses swagger specs.
value= "https://conferenceapi.azurewebsites.net/",
format="swagger-link-json"
I also tried to download the swaggerspec file and then pass that entire file string into value but it again failed with same error.
with open ("api_spec.yaml", "r") as specfile:
api_spec=specfile.readlines()
...
value= api_spec,
format="swagger-json"
just verified, please try this one:
value= "https://conferenceapi.azurewebsites.net/", format="openapi-link"
@RupengLiu yes, it worked. I was also able to figure out another swagger-link-json as well. I figured out that the ConferenceApi I was trying out with was not swagger formatted.
My issue has been resolved but however, it would be nice if the error/exception given described which field is missing or have incorrect value. Following error doesn't explain much or help in debugging:
azure.mgmt.apimanagement.models._models_py3.ErrorResponseException: One or more fields contain incorrect values:
Hi @devang93 , the detail reasons are in the response body of the apimanagement service response. It's too complex to show in one exception message.
Would you try this code:
try:
deployed_api_response = apim_client.api.create_or_update( resource_group_name, apim_service_name, "test-api", api_create_or_update_parameters)
except Exception as e:
print(e.response.content) # all response body returned by service side.
You may find details information for the error.
Hi, this issue seems to be resolved, so I'll close it for now. If you still have more questions, please reopen. Thanks!
Describe the bug We are trying to use apimanagement python sdk to automate api deployment into api management service over azure. Using apimanagement v 0.2.0.
Using following configs and code to create a simple test api using sdk and its throwing "One or more fields contain incorrect values" error. It doesn't tell us which fields are incorrect, making it harder to debug.
Exception or Stack Trace
Note: I am able to trigger api.delete() or api.get() operations successfully. Facing the error while trying to create a new one.
Environment Setup