Home Community Blog Buy Now
Blog

Misty Community Forum

How can I send an image to an external server?

Hi, Misty community!
I want to take a picture from Misty and send it to a external server, so it could be sent in Base64, but I’m not sure how to apply it with misty.SendExternalRequest(), I mean, which parameter should contain the Base64.

In the JS API method SendExternalRequest, you can send body text in the arguments parameter. For example,

misty.SendExternalRequest(
    "POST",
    "http://192.168.2.234/submit",
    null,
    null,
    '{"data": "here"}'
)

causes the JSON data {"data": "here"} to be sent as an HTTP POST request to http://192.168.2.234/submit.

@slivingston, thanks for answering.
So for example, if I want to send an image to an external server, inside of “here”, would I put the Base64 dada?

The correct place to put the base64 text depends on the API of that external server. For example, it could go inside of “here”.

1 Like

Got it. Thank you very much!