Show/Hide Toolbars

PerfectApps™ Help Guide

PerfectApps supports the four HTTP methods most commonly used in RESTful APIs.

 

GET

Use GET requests to retrieve resource representation/information only – and not to modify it in any way. As GET requests do not change the resource's state, these are said to be safe methods.

POST

Use POST requests to create new subordinate resources, e.g., a file is subordinate to a directory containing it, or a row is subordinate to a database table.

When talking strictly about REST, POST methods are used to create a new resource into the collection of resources.

PUT

Use PUT requests primarily to update an existing resource (if the resource does not exist, then the API may decide to create a new resource or not).

DELETE

As the name implies, DELETE requests are used to delete resources (identified by the Request-URL).

 

Send Parameters - Placement

REST Send Parameters are supported in a few different ways.

 

Path

RESTful services allow the location of resources through the URL (Uniform Resources Locators). That way, we can find REST operations like this:

 

    "https://api.spotify.com/v1/1fCHHaC4f2uG3yhpwWsIA6/albums"

 

- where the id (1fCHHa .......) will be dynamically taken from a field in the app.

 

This should be expressed as:

 

    "https://api.spotify.com/v1/{id}/albums"

 

- where {id}/albums is a template and {id} will be replaced by a value from a field in the app.

 

REST - Send Parameters - Placement - Path

 

(1) - Note the brackets in the Service Parameter Name. This is the only type of parameter that requires the use of brackets, but only if it's part of a template (as shown in the example above).

 

(2) - The Service Full URL is a combination of the Service URL, from the connections page, the Action Endpoint and the Service Parameter Name due to the use of the Path placement option.

Body

These parameters are transported in the body of the request.

They are sent in the format selected in the field "Request Type" which can be:

 

JSON - (See: https://www.json.org/json-en.html )

XML

Key - (as in Key/Value, or commonly called x-www-form-urlencoded)

Raw - a single parameter sent purely as a string without any format.

 

Red_Warning

Lists are not supported in body send parameters for JSON and XML.

Path & Body

In some cases, the REST API requires attributes to be sent both in the Path and the Body sections. To avoid duplicating some Send Parameters, we offer a way to configure a single parameter to be sent both in the Path and the Body of the request.

Header

These are parameters the REST API is expecting to receive in the HTTP header. - https://www.rfc-editor.org/rfc/rfc9110.html

 

There are some reserved names that cannot be used as header parameter names:

 

accept-charset

accept-encoding

access-control-request-headers

access-control-request-method

connection

content-length

cookie

cookie2

date

dnt

expect

feature-policy

host, keep-alive

origin

proxy-

sec-

referer

te

trailer

transfer-encoding

upgrade

user-agent

via

Query String

These parameters are typical of GET requests, and they are sent in the URL as a key/value series separated by the & character.

 

Typically a request like this:

 

  "https://api.spotify.com/v1/7fG6yy83HKd2DFd62h7Sww/tracks?offset=0&limit=2"

 

- would be configured like this:

 

REST - Send Parameters - Placement - QueryString

 

Response Types

The response type defines the format in which the Return Parameters are expected to be returned by the consumed REST Web Service. These parameters are always in the body of the response.

 

JSON

The parameters are returned in JSON format - https://www.json.org/json-en.html

XML

The parameters are returned in XML format.

Key

As in Key/Value.

Binary

The expected return is a binary, on the PerfectApps side it is processed and returned in two separate parameters:

 

FileName is the file name received in the response

base64 is the base 64 representation of the binary

 

These two values can be used to populate a File Attachment object in an app.

Raw

The parameters are returned in a single parameter received as a string without any format.

 

Request & Response MIME type mapping

JSON

application/json

XML

text/xml

Key

application/x-www-form-urlencoded

Binary

text/plain

Raw

application/octet-stream

 

tipbulb

If there are no body parameters, we recommend using this option.

 

See also: App Connections, Connection and Action Permissions

 

Return to: Creating PerfectApps Connections, Integration