Why do I encounter problems when sending a request via API

  • infrati
    Perguntado em 12 de junho de 2024 às 10:26

    olá, Estou com problema ao enviar uma requisição via API para enviar os dados de um formulário, poderiam me ajudar?


    Segue o request e o return

    curl --location 'https://api.jotform.com/form/231353109460650/submissions?apiKey=f02415eab0a94c49f11e5b3f4a2b3dee' \

    --header 'Content-Type: application/x-www-form-urlencoded' \

    --header 'Cookie: JOTFORM_SESSION=130bfe0f-e3a6-7e41-80f2-0a833f66; guest=guest_78a7e7a4fe91efb5' \

    --data-urlencode 'submission%5B3_first%5D=Sergio' \

    --data-urlencode 'submission%5B3_last%5D=Maciel' \

    --data-urlencode 'submission%5Bnew%5D=1' \

    --data-urlencode 'submission%5Bflag%5D=0' \

    --data-urlencode 'submission%5B4%5D=sergio.maciel@guarida.com.br' \

    --data-urlencode 'submission%5B4%5D=51981479233' \

    --data-urlencode 'submission%5B16%5D=Endereço completo' \

    --data-urlencode 'submission%5B14%5D=Anunciar para Locação' \

    --data-urlencode 'submission%5B15%5D=Email' \

    --data-urlencode 'submission%5B8%5D=true' \

    --data-urlencode 'submission%5B23%5D=utm_surce' \

    --data-urlencode 'submission%5B24%5D=utm_medium' \

    --data-urlencode 'submission%5B25%5D=utm_campaign' \

    --data-urlencode 'submission%5B26%5D=utm_content' \

    --data-urlencode 'submission%5B27%5D=utm_term'



    Retorno

    {

        "responseCode": 401,

        "message": "You're not authorized to use (/form-id-submissions) ",

        "content": "",

        "duration": "25.66ms",

        "info": "https://api.jotform.com/docs#form-id-submissions"

    }

  • Filip Jotform Support
    Respondido em 12 de junho de 2024 às 11:07

    Hi Guarida,

    Thanks for reaching out to Jotform Support. Unfortunately, our Portuguese Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in Portuguese, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now coming back to your question. The form you are trying to reach is not under your account. To be able to use it, you will need to get the API key from the account where the form is.

    Let us know if there’s anything else we can help you with.


  • infrati
    Respondido em 12 de junho de 2024 às 14:21

    Hello, how do I make the request for this form? I'm using ID 231353109460650

    https://www.jotform.com/pt/build/231353109460650

    Why do I encounter problems when sending a request via API Image 1 Screenshot 20

  • infrati
    Respondido em 13 de junho de 2024 às 08:40

    Maybe the ID I'm using isn't the correct one, how do I get the correct one? Remembering that I have access to this form through my account and the API is from the same account.

  • Filip Jotform Support
    Respondido em 13 de junho de 2024 às 08:53

    Hi Guarida,

    You need to log in to the account where the form is, make a new API key, and use that one.

    Reach out again if you have any other questions.

  • infrati
    Respondido em 13 de junho de 2024 às 10:06


    It worked thank you very much, but I had already done this before, it was an API Key that I created yesterday. Why was there an error in the previous one?

  • Filip Jotform Support
    Respondido em 13 de junho de 2024 às 10:33

    Hi Guarida,

    The error occurred because you tried using the API key of the form from the account that is not the owner account. When you want to use API keys, you need to ensure that you create them from the owner account of the form.

    Reach out again if there’s anything else we can help you with.