question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"One or more fields contain incorrect values" error while creating new API through apimanagement python sdk

See original GitHub issue

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.

apim_client = azure.mgmt.apimanagement.ApiManagementClient(credentials=credentials, subscription_id=subscription_id)

api_create_or_update_parameters = azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter(
    description="AI reserve deployed sample api",
    authentication_settings = None,
    subscription_key_parameter_names = None,
    api_type = None,
    api_revision= "1",
    api_version= None,
    is_current= True,
    is_online= None,
    api_revision_description= None,
    api_version_description= None,
    api_version_set_id= None,
    subscription_required= True,
    source_api_id= None,
    display_name= "Sample API",
    service_url= "https://conferenceapi.azurewebsites.net",
    path= 'sample',
    protocols= ['https'],
    api_version_set= None,
    value= "sample_test",
    format="openapi"
)

deployed_api_response = apim_client.api.create_or_update( resource_group_name, apim_service_name, "test-api", api_create_or_update_parameters)
print(deployed_api_response.result())

Exception or Stack Trace

Traceback (most recent call last):
  File "/Users/devpatel/Desktop/projects/Ai-Reserve-PlatformProvisioning/aml_service/configureAPIM.py", line 63, in <module>
    deployed_api_response = apim_client.api.create_or_update( resource_group_name, apim_service_name, "test-api", api_create_or_update_parameters)
  File "/Users/devpatel/Desktop/projects/.venv/lib/python3.7/site-packages/azure/mgmt/apimanagement/operations/_api_operations.py", line 378, in create_or_update
    **operation_config
  File "/Users/devpatel/Desktop/projects/.venv/lib/python3.7/site-packages/azure/mgmt/apimanagement/operations/_api_operations.py", line 314, in _create_or_update_initial
    raise models.ErrorResponseException(self._deserialize, response)
azure.mgmt.apimanagement.models._models_py3.ErrorResponseException: One or more fields contain incorrect values:

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

  • Python Version: [e.g. Python 3.7]
  • SDK Version: [azure-mgmt-apimanagement v0.2.0]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
devang93commented, Jul 27, 2020

@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.

0reactions
lilyjmacommented, Jan 13, 2021

Hi, this issue seems to be resolved, so I’ll close it for now. If you still have more questions, please reopen. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Management Fails while adding API App - MSDN - Microsoft
One or more fields contain incorrect values: Cannot create API 'my-big-api-aux' with the same Path '' as API 'my-big-api' unless it's a part ......
Read more >
API with specified name already exists - Stack Overflow
The Azure API Management error, "API with specified name already exists," can be misleading, and in this case, it is inaccurate.
Read more >
Error messages - Resource Manager - Google Cloud
This document identifies some of the error codes and messages that Google APIs return. Specifically, the errors listed here are in the global,...
Read more >
azure.mgmt.apimanagement.models module - NET
gateway_regional_url (str) – Gateway URL of the API Management service in the Region. ... If no value is provided, default revision 1 is...
Read more >
Stripe API reference – curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found