Rest API database

Hello,

I have a Rest API database. Now I’m trying to upload data in json format. Is that possible? I’m using HTTPSocket.

Dim socket As New HTTPSocket
result = socket.POST(…)

Br
Sebastian

1 Like

Yes it’s possible.

Following documentation you can attach a dictionary httpsocket-setformdata or use a string httpsocket-setpostcontent.

Just convert your JSON or Dictionary to string to use SetPostContent (not tested, just read the documentation)

Then you can call .Post(url) method of your socket

You can also check URLConnection and set URLConnection.SetRequestContent with a string generated from a JSON or Dictionary and the right mimetype, then call .Send method

Julien

Thanks. I’ve found out that I have to upload the data in a file. If I try to upload just the json data or string I’ll get an error. So how can I do this?

What the type mimetype that the API is expecting, is it multipart/form-data or application/octet-stream ?