Skip to content

Difference

Description

This operation finds the difference between the primary (first) set and all other specified sets. To find the difference, the operation subtracts identical values across multiple sets and returning the remainder (i.e. the difference) in a new set. The first set in the request is considered the main set whose remainder is left after the subtraction operation.

Method

POST

Endpoint URL

Important

Make sure to replace xxxx in the domain name in the request specification below to the one assigned to your application.

https://xxxx.backendless.app/api/hive/[hive-name]/set/action/difference

where:

Argument                Description
[hive-name] Name of a hive where the operation is performed.

Request Headers

Content-Type:application/json

where:

Argument                Description
Content-Type Must be set to application/json. This header is mandatory.

Request Body

The request body must be a JSON array containing string values that identify the names of the specified sets:

["setname_1", "setname_2", ...]

Response Body

A JSON array containing values retrieved after the primary and all other consecutive sets are subtracted. Each individual value is of the JSON data type.

Example

The example below subtracts all identical values and returns a new set containing the remainder.

curl --location --request POST "https://xxxx.backendless.app/api/hive/transport/set/action/difference" \--header 'Content-Type: application/json' \--data-raw '["cars", "cars_2"]'

where:

Argument                Description
transport Name of a hive where the operation is performed.
["cars", "cars_2"] An array of key names each identifying a set containing multiple values.

Contents Of Specified Sets

set_api_example_sdks_diff_inter_union

Response

set_api_example_sdks_diff_inter_union_output

Codeless Reference

set_api_difference

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key names A list containing key names identifying unique sets.

Returns a list containing values retrieved after the primary and all other consecutive sets are subtracted.

Consider the following Set storages:
set_api_example_sdks_diff_inter_union

The example below subtracts items in the following sets: "cars" and "cars_2"; and gets the remainder:
set_api_example_difference

The output will look as shown below after the Codeless logic runs. Unique items(i.e. "Coupe") that are outside of the primary set("cars") are skipped.
set_api_example_sdks_diff_inter_union_output