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
For some reason I can't get the JSON values to post to a basic Net Core API.
I've tried the different methods APICaller_Web_Extended, APICaller_POST_Extended, etc., but still can't get the value to post to the API as I get an immediate reject.
Can someone please help?
Error
Result:
{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-ebe41ad40e4609a7ba247b3c55687ca7-b98e61eaac0c50b3-00","errors":{"astring":["The astring field is required."]}}
Hello,
For some reason I can't get the JSON values to post to a basic Net Core API.
I've tried the different methods APICaller_Web_Extended, APICaller_POST_Extended, etc., but still can't get the value to post to the API as I get an immediate reject.
Can someone please help?
DECLARE @httpMethod nvarchar(max) = 'POST'
DECLARE @url nvarchar(max) = 'https://localhost:42368/api/myapi'
DECLARE @headers nvarchar(max) = '[{
"Name": "Content-Type",
"Value" :"application/json; charset=utf-8"
}]';
Declare @cJSONbody NVARCHAR(MAX) = '{
"astring": "Foo"
}'
exec [dbo].[APICaller_POST_Extended]
@url
,@headers
,@JsonBody = @cJSONbody
API:
[HttpPost]
public async Task myapi(string astring)
{
try
{
var j = astring;
//....
return Ok("OK");
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, "Database Failure");
}
}
Error
Result:
{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-ebe41ad40e4609a7ba247b3c55687ca7-b98e61eaac0c50b3-00","errors":{"astring":["The astring field is required."]}}
ContentType:
application/problem+json; charset=utf-8
The text was updated successfully, but these errors were encountered: