SparkHttpResponse

Represents the response form the HTTP call.

e.g.

var headers = response.getHeaders();

getHeaders

signature getHeaders()

returns JSON

Returns the headers from the response.

returns

A JSON object containing the headers

example

var response = Spark.getHttp(url).get();
var headers = response.getHeaders();

getCookies

signature getCookies()

returns JSON

Returns values for 'Set-Cookie' headers in the response.

returns

A JSON array containing values of the Set-Cookie headers

example

var response = Spark.getHttp(url).get();
var cookies = response.getCookies();

getResponseCode

signature getResponseCode()

returns number

Returns the response code.

e.g. 200

returns

the HTTP status code

example

var response = Spark.getHttp(url).get();
var statusCode = response.getResponseCode();

getResponseString

signature getResponseString()

returns string

Returns the body from the response.

returns

A string representing the body of the response.

example

var response = Spark.getHttp(url).get();
var body = response.getResponseString();

getResponseXml

signature getResponseXml()

returns JSON

Returns the body from the response as XML.

returns

An XML object representing the body of the response.

example

var response = Spark.getHttp(url).get();
var body = response.getResponseXml();

getResponseJson

signature getResponseJson()

returns JSON

Returns the body from the response as JSON.

returns

A JSON object representing the body of the response.

example

var response = Spark.getHttp(url).get();
var body = response.getResponseJson();
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here