Temporary Limitations of the HTTP System Operation
The HTTP system operation currently supports responses which provide data in JSON format. Support for XML, and plain text responses are under development.
The HTTP system operation provides the developer with the option to make HTTP/S requests. The purpose of this is to access data from external APIs
var request = new HTTP;
The HTTP system operation currently supports responses which provide data in JSON format. Support for XML, and plain text responses are under development.
The HTTP request method. The following methods are currently supported by Cuneiform.
The url if the resource the HTTP/S request is intended to be sent to.
Data being sent along with the HTTP/S request. This data is converted from a Cuneiform object into JSON, and is sent as a JSON payload.
An example of making a request to an external API can be found in the PizzaShop sample application. The http properties are provided as follows:
var orderData = {
name : typeName,
crust : selectedCrust,
size : selectedSize,
address : address,
time : dateTime
};
var http = new HTTP;
http.method = "post";
http.url = "https://pizzashop-sample.herokuapp.com/api/order/add";
http.data = orderData;
Makes an HTTP/S request using the properties provided.
Obtains the HTTP response as a JSON value, converts it to a Cuneiform object and returns it.
The next part discusses the implementation of the HTTP system operation.