Trying to POST form-data in API request

Options

Hi,

I'm trying to POST form-data to another API (using a webhook/Xano Endpoint URL) but I can't seem to send data in curl as '—form' data.

Here's the external API request:

Here's the request logged (output):

It seems the headers are not set, while I did use the 'Import CURL' function to map all the fields correctly. When I use Postman to do the same request it works without any problems. It seems to be a problem with the fact that the body needs to send 'form-data' but I don't see that option in Xano.

Here's my Xano API settings:

Best Answer

Answers

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Multipart/form-data is typically used for file uploads, which is probably why you're not having success.

    I would first reference the API documentation from the API provider you're using. My guess is you'll probably have better luck with application/json or application/www-x-form-urlencoded. But please reference the API documentation, this will be your best resource.

  • lowielowie
    Options

    Hi Michael,

    Thanks for you reply. The API I'm using is Manatal ( https://developers.manatal.com/reference/career_page_jobs_apply_for_job )

    The following call should be made to successfully do a POST:

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    @lowielowie - I'm now noticing your response is "false" which typically means either the server is failing to respond or there could be a typo or extra space in the URL of the API call

  • lowielowie
    Options

    Hi Michael, you're right. There was a space in my endpoint URL…

    Perhaps Xano could trim it at all times? It's really hard to see.

    Thanks for your help.

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    I hear you, the difficulty here though is your URL is coming from a variable - trimming all variables automatically probably wouldn't make sense for every use case

  • lowielowie
    Options

    Hi Michael,

    That's true. You could create something like a warning message though informing users there's a space in the variable.

    I got it up and working now, great tool.