Question

I am trying to create a PUT request using Fiddler but I am constantly receiving an error as follows.

PUT Request
https://127.0.0.1/odata/ControllerName('param')

Request Header
Accept: application/json;odata=minimalmetadata
Host: 127.0.0.1
Authorization: ApiKey uniqueKey
Content-Type: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

RequestBody
{"Name":"param"}

When I am trying to PUT, it returns me status code 400. When I double click error in fiddler and view JSON tab, it gives me following error.

odata.error
     innererror
         message=actionParameters : The last segment of the request URI 'ControllerName('param')' was not recognized as an OData action.

Where I am going wrong, with URI format or request body?

Was it helpful?

Solution

According to OData protocol, the value within the parenthesis following the entity set(corresponds to a controller) must be a key, for example:

  1. ~/odata/Products(1) if the key is of int type,
  2. ~/odata/Products('1') if the key is of string type.

So please make sure the key is of string type in your case, and try to

GET https://127.0.0.1/odata/ControllerName('param') 

to see whether the response is as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top