Check consent for multiple users based on context.

POST /v1/checkconsent/granule/{granule}?idptr=/id&idtype=user&idtypeptr=/type&format=values&by.id=id&by.type=type
Content-Type: multipart/mixed | application/stream+json

This API accepts two types of inputs:

multipart/mixed
The input is two parts: The first part is a JSON document containing the context information. The second part is a JSON stream that is either concatenated or newline-delimited.
application/stream+json
The input is a JSON stream that is either concatenated or newline-delimited. This type of input is evaluated using an empty context.

The context document contains the fields defined by the consent granule.

The JSON stream contains a stream of JSON documents each representing a data subject. The unique identifier of the data subject is embedded in each document, and the location of the identifier is given with the idptr query parameter. If omitted, the subject identifier is assumed to be accessible via the JSON pointer /id. For example, the following subject document has a userId field under metadata, and the API must be called with idptr=/metadata/userId:

{
  "metadata": {
    "userId": "123aefgf354",
    "name": "userName"
  },
  ...

If idtype is specified, then all subjects are assumed to be of the given idtype. If idtypeptr is specified, then the subject types are read from each document, assuming idtypeptr is a JSON pointer to a string field. If neither idtype nor idtypeptr is specified, then all subjects are assumed to be users.

The output format depends on the format query parameter. If format=filter, then a subject document read from the input will be copied to the output only if the subject has consent for the granule. Otherwise the subject will be ommitted. If the format is ommitted or any other value, then the output will contain a stream of documents containing subject ID and the result:

{ "subject": {"type": "user", "id": "37376adef738726"}, "value": true}
{ "subject": {"type": "user", "id": "487398aef3565623e"}, "value": false}

JSON Streams

ConsentGrid works with concatenated or newline-delimited JSON streams. A concatenated JSON stream is simply JSON documents concatenated one after the other:

{"id": "abc",...}{"id": "6526",...}{"id": "efa52",...}...

Newline-delimited JSON stream contains one well-formed document at each line:

{"id": "abc",...}
{"id": "6526",...}
{"id": "efa52",...}
 ...