Page 1 of 1

HTTP request POST

Posted: Sun Aug 20, 2023 10:06 pm
by joaodaffonsojr
Hello !

I have to connect to an API and i got this cURL working line command bellow
running on Postman.

What I need to do is make this run in Switch Execute Command, but couldn´t
resolve how to config it right.
HTTP REQUEST 01.png
HTTP REQUEST 01.png (21.66 KiB) Viewed 8677 times
HTTP REQUEST 02.png
HTTP REQUEST 02.png (17.56 KiB) Viewed 8677 times

Also I need a tip to whats better run all code inside Execute Command or
have the JSON part in a separate file.

This is cURL running on Postman:

Code: Select all

curl --location 'https://app.omie.com.br/api/v1/geral/clientes/' \
--header 'Content: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "call": "IncluirCliente",
    "app_key": "1111111111",
    "app_secret": "3bc234fgh701519f81d90ccc847bc1ad",
    "param": [
        {
            "codigo_cliente_integracao": "UtiOmi00001",
            "razao_social": "AOEN PUBLICIDADE LTDA.",
            "nome_fantasia": "AOEN",
            "endereco": "RUA BRIGADEIRO, 500",
            "complemento": "SALA 1",
            "bairro": "BELA VISTA",
            "cidade": "São Paulo",
            "estado": "SP",
            "cep": "01317-000",
            "cnpj_cpf": "00.123.345/0001-32",
            "inscricao_municipal": "",
            "inscricao_estadual": ""
        }
    ]
}'


Any help is very welcome!

Thanks in advance!

Re: HTTP request POST

Posted: Mon Sep 04, 2023 3:33 pm
by freddyp
What you need to do to make this work with the currently released version of "HTTP request" is to make sure that the input job is a JSON file as in your description. Do you have that file ready-made or not? If not you can create it with the "Make JSON" app. In "HTTP request" you should set the "Attached file" property as the value of the Switch variable [Job.Path].

The response from the API will be attached as a dataset to the JSON file. If that is your only input, that is fine, but if you have to attach the result from the API to e.g. a PDF file the flow becomes more complex to build. That is why we have prepared a new version of the "HTTP request" element that has an additional option for "Request type": "POST a body". You can choose the body from the input job (that is equivalent to what you have now), but also from a dataset and you can even create the body on the fly with a multi-line text with variables. A beta version will be available in the coming weeks. If you are registered as a beta user you will be notified automatically. If I remember it I will announce it here as well. If no problems are found, the official release is planned for the release train of October 24th.

Re: HTTP request POST

Posted: Tue Sep 05, 2023 12:54 pm
by joaodaffonsojr
Freddy thanks for your answer,

I managed to make JSON file and everything worked fine.


Thank you very much.

Re: HTTP request POST

Posted: Fri Oct 20, 2023 2:34 am
by nhan
joaodaffonsojr wrote: Tue Sep 05, 2023 12:54 pm Freddy thanks for your answer,

I managed to make JSON file and everything worked fine.


Thank you very much.
I intended to ask a similar question and found this article. Can anyone tell me how to use that json file after creating a json file?

Re: HTTP request POST

Posted: Fri Oct 20, 2023 4:45 pm
by sander
I intended to ask a similar question and found this article. Can anyone tell me how to use that json file after creating a json file?
This will do:
pic.png
pic.png (30.79 KiB) Viewed 7914 times