Hooray wrote in Thu Dec 07, 2017 8:51 pm:May I politely suggest to actually look at the code/pointers (links) I posted and then use the built-in Nasal console to see for yourself ?
You could also refer to the implementation of the recently added STAMEN layers, which are basically using the same http API.
So there is quite a bit of existing Nasal code that you could look at, and play with - and then post your code here to ask a more specific question if something should still be unclear.
Hello Hooray
I understand your hesitance, but I must politely reply that I have already looked through everything that I could find, including the links you sent me.
Part of the trouble for me, is that I don't know C++, thus making it very hard for me to understand how exactly the different modules are exposed in Nasal.
The documentation on Nasal has also not been very clear to me. Perhaps it is, when I know my way around a little better.
So, using the examples from the Wiki-pages, I have been stuck with the following code:
- Code: Select all
var url = "http://127.0.0.1:5000/v1/planes/";
var request = http.load(url)
.done(func(r) print("Got response: " ~ r.status, " ", r.method, " ", r.response));
Note, that the API does not use URL encoded data exchange, but exchanges the data in the actual request body.
This returns a GET response perfectly. But I have not found any answers to the following:
- How do I define that my request is a "POST" request instead of a "GET"? I think this is the member I need to use, but I have no idea on how to include it in the code above.
- How can I include headers and request data (data that my API will extract and consume)?
So again, I apologize for wasting your time, but I have simply not been successful in comprehending the existing documentation and I hope that I can get some pointers, without having to learn C++.
I hope you understand.
Sincerely,
Ragerin