Web Api string parameter (fromQuery) always null when posted with value (FromBody)



I am using web api 2 and .net core 2.0

I’m trying to post to an endpoint but the propertyId in the in the query is always null, but the value in the body is populated. If I change propertyId to an int, it gets populated.

After LOTS of reading I found this, which has “confirmed” - for me - that what I’ve done should be working. It’s not so I don’t know what I’m missing. There are many threads on this issue but none have helped me. Could someone please advise what i’m missing?

I have tried a number of variations, including:

  • passing the query as ?propertyId=teststring

  • Removing [FromQuery]

  • Removing Route

  • Changing headers

  • Combos of above

    public class RoomsController : ControllerBase
    …other stuff…

    [HttpPost, Route("{propertyId}")]
    public async Task Post([FromQuery]string propertyId, [FromBody]List value)
    List result = await _mediator.Send(new NewRoomRequest() { PropertyId = propertyId, NewRoom = value });
    return Ok(result);

the postman script

POST /api/Rooms/testString HTTP/1.1
Host: localhost:49942
Cache-Control: no-cache
Content-Type: application/json
Postman-Token: f15b569d-84a2-4bde-bdf0-b1cdf3fff975

“Description”: “tesDescription”,
“Length”: 1.5,
“Width”: 1.8,
“Dimension”: 5,
“DimensionText”: “some DimensionText test”,
“PhotoUrls”: [“klklkl”, “oioioioii”]
“Description”: “tesDescription2”,
“Length”: 1.2,
“Width”: 1.9,
“Dimension”: 5,
“DimensionText”: “some DimensionText test2”,
“PhotoUrls”: [“klklklwewe”, “oioioioiinmnmnm”]