Hi,
When I call an Action with parameters I always get 400 BadRequest.
PseudeCode is as bellow.
Parameter names are correct.
URL is also correct - it works before adding the parameters (to both Action and message Content)
var message = new HttpRequestMessage(HttpMethod.Post, someURL);
var pars = new
{
requestType = "O"
, volumeNoteComment = "xx"
};
if (pars != null) message.Content =new JsonConvert(pars);
HttpClient client = new HttpClient();
/// here some client initialization....which is OK.
var response = client.SendAsync(message);
// response is 400 Bad request
Result of message.Content.ReadAsStringAsync():
Id = 769, Status = RanToCompletion, Method = "{null}", Result = "{\"requestType\":\"O\",\"volumeNoteComment\":\"xx\"}"
AsyncState: null
CancellationPending: false
CreationOptions: None
Exception: null
Id: 769
Result: "{\"requestType\":\"O\",\"volumeNoteComment\":\"xx\"}"
Status: RanToCompletion
Definition of arguments
*This post is locked for comments
Hi Nikica,
It is possibly a caching issue then. Glad it is now resolved.
Please close the thread and mark the suggestion as helpful if you feel it helped you :)
Hi Ravi,
thx for your help. In the end when I came to work on Monday everything worked fine. With the same code. I assume either
- some "Publish all customizations" happened (even I can't believe that no Publish All Customization" happened during several hours I investigated this issue and I don't see relation between Actions and publishing),
-or CRM needs some time to have actual version on WEB API.
Hi,
I would suggest to use Rest builder and check if you are able to call you custom action with paramters or not. This is to isolate if the problem is within the custom action or with your code. In my case, I created the custom action , activated it but then later changed some parameter. I found that the custom action was referring to the old paramters hence failing when calling. If this is the case,you may want to create your custom action again with some other name ensuring that you don't change the parameter once the custom action is created.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156