You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying to subscribe a user to a product (add a subscription) with a PUT call. But I keep getting a "400 BAD REQUEST", which has to do with the userId and productId fields. I got the correct ids because I made calls to the get users and get products before. So I know how to use the Azure API Management REST API. Too bad your management samples don't contain samples for all the calls (I'd like to have examples for the PUT calls too).
REQUEST: (numbers have been changed of course):
PUT /subscriptions/361296af6f48a5263c91b0eb?api-version=2014-02-14-preview HTTP/1.1
Connection: close
Content-Length: 228
Content-Type: application/json
Authorization: SharedAccessSignature uid=663252382f83fe019d040003&ex=2016-11-24T01:12:00.0000000&sn=BUOr1j1uO8PnHja20UNeTWkE5z/dtgJw0DKTCybY+JLEF0OZ2aqCQBOU0Cg4FWzejTyUW1tMjBF9jd9WRRENew==
Host: [OUR APIM INSTANCE].management.azure-api.net
RESPONSE:
{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"userId","message":"Invalid field 'userId' specified"},{"code":"ValidationError","target":"productId","message":"Invalid field 'productId' specified"}]}}
The text was updated successfully, but these errors were encountered:
Found it by debugging with Paw and reverse engineering the Azure PowerShell module "AzureRM.ApiManagement\1.0.5".
It should be /users/4633a02dc1dd7b1240b60882 and /products/56bc8a99b9668d0cb078c2e5
The API Management REST documentation is wrong in this regard..
Hi,
I'm trying to subscribe a user to a product (add a subscription) with a PUT call. But I keep getting a "400 BAD REQUEST", which has to do with the userId and productId fields. I got the correct ids because I made calls to the get users and get products before. So I know how to use the Azure API Management REST API. Too bad your management samples don't contain samples for all the calls (I'd like to have examples for the PUT calls too).
REQUEST: (numbers have been changed of course):
PUT /subscriptions/361296af6f48a5263c91b0eb?api-version=2014-02-14-preview HTTP/1.1
Connection: close
Content-Length: 228
Content-Type: application/json
Authorization: SharedAccessSignature uid=663252382f83fe019d040003&ex=2016-11-24T01:12:00.0000000&sn=BUOr1j1uO8PnHja20UNeTWkE5z/dtgJw0DKTCybY+JLEF0OZ2aqCQBOU0Cg4FWzejTyUW1tMjBF9jd9WRRENew==
Host: [OUR APIM INSTANCE].management.azure-api.net
{
"userId": "users/4633a02dc1dd7b1240b60882",
"productId": "products/56bc8a99b9668d0cb078c2e5",
"state": "active",
"primaryKey": "aedf306ba80f4058b0e0e82439c11a91",
"secondaryKey": "f1d9ad0c091d4a7c92091447c336dd44"
}
RESPONSE:
{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"userId","message":"Invalid field 'userId' specified"},{"code":"ValidationError","target":"productId","message":"Invalid field 'productId' specified"}]}}
The text was updated successfully, but these errors were encountered: