Consume Rest API problems with command send

Consume Rest API problems with command send

  

Hi!

I have some troubles with commands send via rest request.

When I am testing the request sends with command "fire-all-rules" in braces:


But when I launch request with parameters (button pressed in "FeedBackFromDrools" screen) according to log "fire-all-rules" sends without braces:

So, I think I make some mistake in assigning parameters (oml is in attachment). Could you help me to handle with it?

Hi Ivan,

Since the Fireallrules Attribute of the CommandItem Structure is not a Structure itself, it shouldn't get braces (since it isn't a JSON object - only Stuctures are converted to JSON objects), so the logging is correct. How did you produce the first request that does have the braces?

Hi Kilian,

  1. Yep, I understand that "Fireallrules" is not a structure and don`t need it like structure, because it just a command for Drools. But drools recognize it only when "Fireallrules" is in braces.
  2. First request was produced when I created method request body at the tab "Request" of test tab.

We have solved the problem with braces via Replace command in OnBeforeRequest like:


Replace(CustomizedRequest.RequestText,"},","}},{")


So everything works, but as for me it is not quite correct decision. Maybe you can offer something better?

Hi Ivan,

I don't have time to properly test it, but I think you could wrap the "Fireallrules" Attribute in a Structure (e.g. "Command") and put that structure instead of the Fireallrules in in CommandItem. That way it's an object, and it should be wrapped in braces.