1b.app
Link copied -

json request action pass business process to API

trying to write api request joyson
it turns out like this
{"id":"3589","phonenumber":"0994259117","api_key":xxxxxxxxxx"}
https://prnt.sc/urtvw6
and the server wants some of the parameters in an array
{"id":"3589", "params": {"phonenumber": "0994259117", "api_key": "xxxxxxxx"}}
How can I do that?
Original question is available on version: ru

Answers:

Try slash /
Those. first you specify the first parameter, let's say this is id in one field, to specify the nesting of the phone number, specify id/phonenumber and id/api_key in the next field
Without a specific example of use in action, I can’t say more precisely.
02.10.2020, 15:34
Original comment available on version: ru

this parameter is simply not included in the request
http://prntscr.com/urw4ml
https://adapter.crm-onebox.com/admin/shop/workflow/14/procedure/15/?status=0
and writes an error in the comment
http://prntscr.com/urw69g
02.10.2020, 15:51
Original comment available on version: ru


Mironenko Dmitry
Client wrote:
such a parameter simply does not get into the requesthttp://prntscr.com/urw4mlhttps://adapter.crm-onebox.com/admin/shop/workflow/14/p... writes an error in the commenthttp://prntscr .com/urw69g
sorry, I thought that you are not passing the process fields, but the fields in the custom block below http://i.imgur.com/yMnmEXy.png
there is just what you need
02.10.2020, 15:56
Original comment available on version: ru

http://prntscr.com/ury3w1
song...
if [requestUrl] and [request] are added in the address bar of the browser, then we get the desired result
http://prntscr.com/ury65l
but for some reason through the action "pass the business process to the API" there is no answer?
02.10.2020, 17:22
Original comment available on version: ru

Try also to twitch in the settings of the action "Authorization method used", for example Basic
or transfer something from the URL "Additional request headers (specify several separated by semicolons)" to the headers

Mironenko Dmitry
Client wrote:
but for some reason through the action "pass the business process to the API" there is no answer?
[/ Quote] I understand that your answers in the comments should be loaded? try another field...
A lot depends on the API itself, which we are knocking on, so it's hard to suggest something concrete...
02.10.2020, 17:35
Original comment available on version: ru

Yes, and with the processing of the response, you obviously have done something http://i.imgur.com/UIEMBI7.png
02.10.2020, 17:42
Original comment available on version: ru


Shcherbatykh Ivan Alexandrovich Employee wrote:
Yes, and with the processing of the response, you obviously have done something http://i.imgur.com/UIEMBI7.png

if i see this answer all the time
http://prntscr.com/urzl72
and try to process it
02.10.2020, 18:33
Original comment available on version: ru

can i change the encoding of the request?
And you can really see what boxing sends on some service?
02.10.2020, 21:51
Original comment available on version: ru

If I'm not mistaken, the default encoding for JSON is UTF-8. There is no possibility to change the action itself.
And you already see the logs, namely what is sent https://prnt.sc/ury3w1
What do you mean by service? You send a request to a specific resource, namely to https://blackbox.net.ua/ - that's where it is possible that there are logs of what comes in.
05.10.2020, 12:29
Original comment available on version: ru


Mironenko Dmitry
Client wrote:
song...
if [requestUrl] and [request] are added in the address bar of the browser, then we get the desired result


We have the same situation. Everything is OK in the browser, the answer is correct and the number of requests is reduced by 1. But through the box, there is no way https://i.imgur.com/CcPUncE.png/
Please tell me, did you find a way to get the correct answer through boxing?
14.01.2021, 16:31
Original comment available on version: ru

how to write parameters - yes.

according to the logs, even everything turns out correctly with the request
but the site still gives an error.
15.01.2021, 12:50
Original comment available on version: ru


Mironenko Dmitry
Client wrote:
how to write parameters - yes.
according to the logs, even everything turns out correctly with the request
but the site still gives an error.

Thanks for the answer.
Too bad it's not set up yet :(
We also figured out the prescribing of parameters, albeit a little differently. It remains to understand why it works directly, but not through boxing.
15.01.2021, 12:58
Original comment available on version: ru


Mironenko Dmitry

With the action discussed in the task, I continue to slowly butt heads, but for now I set up the receipt of information in a different way. I share :-)
First, using the "Write value to additional field" action and variables, I created query parameters including "data=". https://i.imgur.com/usbSLle.png/
The text is:
data=%7B%22id%22%3A%22{|$orderid|}%22%2C%22params%22%3A%7B%22phonenumber%22%3A%22{|$clientphone|}%22%2C%22api_key %22%3A%22YourApiKey%22%2C%22name%22%3A%22{|$clientfio|}%22%7D%7D
Variable order numbers, phone number and full name of the client are already inserted in the text, and the text YourApiKey (blurred in the screenshot) must be replaced with your api key in its pure form (without quotes and brackets). And carefully with spaces in the request. With extra spaces (for example, around the key), I got the same 101st error in response.
Then, in the action "Run a GET request with parameters" in the GET URL, I wrote http://blackbox.net.ua/api/, and in the GET Parameters - a variable for the additional field of the order, into which the request was inserted by the action above. The question mark between the URL and the parameters is inserted by the box itself, so I didn’t write it anywhere. Response text in an additional order field, only in another https://i.imgur.com/S3R4d7p.png/
And finally, if necessary, redirected the order to a special stage for cases with blacklisted clients. In the action "Change the business process and stage depending on the values of the fields", I checked the additional field of the order with the answer for the presence of the word data in the response text, because in case of an error or the absence of a client in the data array list, there is no response.
https://i.imgur.com/JXBjoPW.png/
If you need to see the full answer, you can display an additional field in the order interface or open the order history.
The possibilities for processing the response with this method are much narrower, but at least some kind of automation already works :-)
ps: I have suspicions that the standard action "Submit a business process to the API" also inserts a question mark or something else between the URL and the parameters into the request, which is why the error. To check, you need to insert only "http://blackbox.net.ua/api/" into the URL, and make sure that the parameters are in the form "data={...}". But I haven't figured out how to do it.
15.01.2021, 18:02
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment