Here is the problem… There is no standard way to upload files to servers. There are many different ways that servers can secure themselves and validate who you are. While REST is somewhat well defined as far as allowing JSON or XML input/output, using GET, POST, PUT and DELETE to do actions and such, once you get to the actual API call’s its all as the whim of the API provider as to what is expected.
We have no way of knowing what rules your service needs or wants. Do they have any documentation on how to use this API endpoint? For instance for the image, you seem to be giving them a URL. That tells me they want to fetch the image from another webserver. Some web services want POST requests using multi-part MIME encoding. Some web services will take straight binary with a PUT request, others will want the binary file base64 encoded before it’s uploaded. You almost certainly will not ever provide an image as part of the URL if you’re uploading it since GET requests (where the &key=value pairs are part of the URL) are limited to about 256 bytes in length. POST and PUT are more likely to be the method to upload the data.
For POST requests, you will have to add the data (once you know how it’s to be encoded, i.e. base64) to the post.body table. Generally the things in the post.body are also &key=value pairs and have to be specifed as such. You will need to know the right key’s to use, similar to:
post.body = “someparam=somevalue&filename=” … base64encode(thebinarydataofthefiletoupload)
One of the tutorial’s above covers using PUT.
Generally authentication is done using the post.header for basic authentication, but again you need to know what’s being asked of you and what key-value pairs they want for that as well.
You need to talk to the provider of the API endpoint you are using (ask them, look for docs on their site, etc.) and find out how they want data sent to them. Once we know that we might be able to help you format your requests.
Rob