REST api?


#1

The URL object has get and post, but it would be very helpful if it also had a way to do REST (HTTP PUT/DELETE/OPTIONS/HEAD).

It probably wouldn't be hard to add, but I wonder if anyone has already done this, or if Jules has plans to add it?


#2

HTTP isn't really my area of expertise, but am open to adding things like this if it's useful..


#3

A few years ago I posted some simple classes to do Amazon S3 REST operations. But I didn't really do a generic REST layer. One problem is that most REST api's have quirks.


#4

I would like to interact with a CouchDB compatible database using its REST API. I also need the ability to make different kinds of requests, not just GET and POST. I need at least GET, PUT, POST, and DELETE. At least for the libcurl version of WebInputStream, you could add something like 


//specify the request (PUT in our case) 

curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
 

for each request type. 

For reference jfitzpat's post about interacting with the Amazon S3 REST API: https://www.juce.com/forum/topic/amazon-s3

UPDATE: I found a small library that does what I need for now - https://github.com/Zintinio/HappyHTTP

It does not support SSL but currently I only need to interact with localhost so I don't need SSL. 

Would be nice to have a similar class for making http requests in JUCE 


#5

This looks like a useful addition to the JUCE URL class. I know that this will be an easy fix for the curl backend and I’d be surprised if it would be much more difficult for the other backends we are using. I’ll look into this first thing on Monday.


#6

Cool, I'd be up for a bit of REST action in the libary.  HTTP befuddles me.


#7

JUCE now supports custom HTTP request commands (such as 'DELETE', 'PUT' etc.) on the latest tip. The juce URL's method createInputStream now has an additional optional parameter called httpRequestCmd. Thank you for your input and comments on this fix!


#8

Thank you for sorting this out. Much appreciated :)