Home Community Blog Buy Now
Blog

Misty Community Forum

How to get an string from an external server?

Hi, Misty’s community.
If an external server only returns an string in a specific link, for example: https://misty22good.herokuapp.com/predict, Could Misty receive only that string with the method GET?
I’m not sure it would look like this: misty.SendExternalRequest(“GET”, “https://misty22good.herokuapp.com/predict”, null, null, “{}”)
The empty {} waits for the string.

Hi @RafaelRo,

I’m not sure I understand the question. The fifth argument is where you would place any arguments that you need to send with a request. Most of the time that is going to be used with POST requests. Usually you will append your query parameters for GET requests to the end of the resource URL, but that depends on how the server that you are querying expects the request to be formatted. Does that help at all?

This example shows how to get JSON data from an external resource using the SendExternalRequest method, in case you haven’t already seen it. I expect that you would format a request to get plain text (instead of a JSON data object) in a similar fashion. JavaScript-SDK/Sample Code/externalRequest_getData at master · MistyCommunity/JavaScript-SDK · GitHub