3
votes

I followed the example which was provided by Azure documentation. Azure documentation section. However i got 404 resource not found error all the time.

This is the URL i used - https://xxxx.management.azure-api.net/subscriptions/xxxxxx/resourceGroups/xxxxx/providers/Microsoft.ApiManagement/service/xxxxxx/users/xxxxxx?api-version=2016-07-07

Header as - Authorization: SharedAccessSignature ###########

Further subscription id, resource group and service name was taken from properties. Which was shown in below image.

enter image description here

I couldn't find an error in my code and please help me to solve this issue.

Updated response image

enter image description here

2
so what request are you sending exactly?4c74356b41
I tried Create Or Update request (docs.microsoft.com/en-us/rest/api/apimanagement/users). Did you try to create users in Azure Rest API management?mugzi
can you update your question with the request you are sending? obviously, remove all the sensitive information4c74356b41
Ok sure ill do that nowmugzi
Have you tried this from Fiddler or Postman? Also, be sure to use the PUT (not POST) http operationErik Oppedijk

2 Answers

1
votes

So this is what worked for me:

PUT https://{apim-name}.management.azure-api.net/users/{username}?api-version=2016-07-07

headers:  
Authorization = SharedAccessSignature KEY  
Content-Type = application/json

body:  
{
    "email": "[email protected]",
    "password": "Qwerty123$",
    "firstname": "name",
    "lastname": "notname"
}
1
votes

It seems you mixed up the old REST url with the new one:

Try https://management.azure.com/subscriptions/xxxx/yyyy

You used the old REST URL: https://docs.microsoft.com/nl-nl/rest/api/apimanagement/apimanagementrest/api-management-rest which expects /users

The documentation on this doesn't mention this very clearly! With the new URL you will receive 401 messages (unauthorized)

You will also need to authenticate on a different way, take a look at this example: https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-disaster-recovery-backup-restore

EXAMPLE:

GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/{MY_RG_APIMANAGEMENT}/providers/Microsoft.ApiManagement/service/{MY_APIM_NAME}/users?api-version=2014-02-14

headers:
Authorization = Bearer {KEY}
Content-Type = application/json