product-apim icon indicating copy to clipboard operation
product-apim copied to clipboard

Error while updating API through Rest API

Open JoaozinhoKz4 opened this issue 3 years ago • 1 comments

Description:

While trying to update an API throught publisher API v2, got the error below: Request Payload: { "name": "PizzaShackAPI", "context": "/pizzashack", "version": "1.0.0", "additionalProperties" : [{"name":"detailedDescripasdtion","value":"asdasd","display":true},{"name":"asd","value":"asdf","display":true}] } Response: { "code": 500, "message": "Internal server error", "description": "Error while updating the API : cf7bd734-0650-4626-940c-cf2dfcb87890 - 900763:No resources found::API must have at least one resource defined", "moreInfo": "", "error": [] }

Then I've tried to GET my API info using the rest API, this time using the devportal API, but unfortunatelly, my operations(resources) appears as blank, even if there are resources that can be checked at the portal.

image

image

Steps to reproduce:

1- Try to update an existing API using Publisher rest API, without sending operations at the request body 2- Try to get your API info, there will be no operations

Affected Product Version:

APIM 4.0.0 Publisher API v2 DevPortal API v2

Environment details (with versions):

  • OS: Windows

JoaozinhoKz4 avatar May 11 '21 18:05 JoaozinhoKz4

Please note that this is the expected behavior, even from Publisher UI we can not keep a API without any resource (Operations). when creating an API from UI also by default we are getting the resources with * .

Please refer the following screenshot for the error message we are getting if we tried to remove all resource(operations) paths (check right side bottom)

image

So to solve this issue you can use one of default resource (operation) in the payload as follows

 "operations": [
      {
        "target": "*",
        "verb": "POST",
        "authType": "Application & Application User",
        "throttlingPolicy": "Unlimited"
      }
    ]

vikumkbv avatar Sep 30 '22 17:09 vikumkbv