success

response.success(body, mimeType)

Returns a successful response (200 HTTP status code).

Parameters

The method has the following parameters:

ParameterDescription
bodyResponse body as string, number, boolean, array, object. Optional.
mimeTypeResponse content type.Optional.
Example

Successful response with no body.

var email = request.get("email");
var title = request.get("title");
var location = request.get("location");

// Script logic
// Emtpy response with HTTP status code 200
Apperyio.response.success();
// HTTP status code: 200
// MIME type: */*
Example

Successful response with body. This examples assumes there are three request parameters:

  • email
  • title
  • location
var email = request.get("email");
var title = request.get("title");
var location = request.get("location");

var res = {"email":email, "title":title, "location":location};
Apperyio.response.success(res);
// HTTP status code: 200
// MIME type: */*
{
	"email": "[email protected]",
	"location": "Barcelona",
	"title": "Engineer"
}
Example

Successful response with body and MIME type. This examples assumes there are three request parameters:

  • email
  • title
  • location
var email = request.get("email");
var title = request.get("title");
var location = request.get("location");

var res = {"email":email, "title":title, "location":location};
Apperyio.response.success(res, "application/json");
// HTTP status code: 200
// MIME type: application/json
{
	"email": "[email protected]",
	"location": "Barcelona",
	"title": "Engineer"
}