pwrd by

Profiel

The profile API allows clients to query and update relations in the Procurios CRM. Relations have only a few default fields; most fields are dynamically configured. Not all of those fields are always exposed. For different situations, different combinations of fields may be useful. These configurations are called profile sets and all calls to the profile api must go through one of these sets. Call the schema method in order to figure out which fields are available.

Several different profile sets may be available to you, depending on the allowed scopes and requested scopes. The methods below use the example value of 42. You can request the set of profile sets that are available to you and use the id of one of the sets for further API calls.

Accept header for requests to Profiel

application/vnd.procurios.profile+json; version=1

Profile sets

GET/l/profile_api/profileset

Get the profile sets that are available to your access token

Request

Body

Response

json Status: 200
{
    "profileSet": [
        {
            "id": 42,
            "title": "Demo profile set"
        }
    ]
}

Schema

GET/l/profile_api/profileset/42/schema

Get the current schema for the API for the requested registration set. The exact fields in the response will change with the configuration of the registration set.

In the example bellow, "image" is a file type field. Files can be provided in a few ways, and each way has a different consequence. As you can see, we expect one of three types of input: an object, a string, or null. To correctly process the request, we expect these types of input as follows:

- object: when a new file is uploaded to our system. New files must contain a file name and content (A data url (RFC 2397) containing the type and contents of the file).

- string: when a file should be kept for the profile. The string is the document key we provide for this specific field in the profile GET call

- null: empty the field.

An example of the several inputs is provided in profile POST

Request

Body

Response

json Status: 200
{
    "$schema": "http:\\\/\\\/json-schema.org\\\/draft-07\\\/schema#",
    "title": "Demo profile set",
    "type": "object",
    "properties": {
        "first_name": {
            "title": "First name",
            "type": "string"
        },
        "insertion": {
            "title": "Insertion",
            "type": "string"
        },
        "name": {
            "title": "Name",
            "type": "string"
        },
        "birth_date": {
            "title": "Birth date",
            "type": "date"
        },
        "address": {
            "title": "Address",
            "type": "object",
            "properties": {
                "street": {
                    "type": "string",
                    "title": "Straat"
                },
                "number": {
                    "type": "integer",
                    "title": "Nummer"
                },
                "number_add": {
                    "type": "string",
                    "title": "Toevoeging"
                },
                "postcode": {
                    "type": "string",
                    "title": "Postcode"
                },
                "town": {
                    "type": "string",
                    "title": "Plaats"
                },
                "country": {
                    "type": "string",
                    "minimum": 2,
                    "maximum": 2,
                    "title": "Land"
                }
            }
        },
        "action_code": {
            "title": "Entered via action",
            "type": "integer"
        },
        "image": {
            "title": "Afbeelding",
            "type": [
                "object",
                "string",
                "null"
            ],
            "properties": {
                "fileName": {
                    "type": "string",
                    "title": "File name"
                },
                "contents": {
                    "type": "string",
                    "title": "File contents",
                    "description": "Data url (RFC 2397) containing the type and contents of the file",
                    "regex": "^data:\\S+\\\/\\S+(;\\S+)*(;base64)?,.*$"
                }
            },
            "description": "To empty this field, input null as value; to keep the current file(s), input the document key provided in the profile GET method (string) as value; to upload a new file, input an object containing fileName and content as value.",
            "required": [
                "fileName",
                "contents"
            ]
        }
    },
    "required": [
        "name",
        "address"
    ]
}

Profile

GET/l/profile_api/profileset/42/99

Get a user profile, where 42 is a profileSetId and 99 is a relationId



A profile GET response may contain one or more files. An example is field "image". In this case, we provide document key(s) in the endpoint's response. The key can be used to download the file in the Profile document's GET Endpoint or as a signal to keep that specific document when updating a file based field in profile in the Profile POST endpoint.

Request

Body

Response

json Status: 200
{
    "name": "Test name",
    "address": [
        "Fortweg",
        9,
        "",
        "3992LX",
        "Houten",
        "NL"
    ],
    "image": [
        {
            "documentTitle": "File one",
            "documentKey": "05c68636-70db-4bc8-a80a-039076be4f1e",
            "mimeType": "image\/jpeg",
            "fileSize": 1024
        },
        {
            "documentTitle": "File two",
            "documentKey": "cce33fac-e1ad-4822-bc91-14673e527ab1",
            "mimeType": "image\/jpeg",
            "fileSize": 2048
        }
    ]
}

Requesting a profile of a different user than the access token is linked to

Request

Body

Response

Status: 403

Requesting a profile set that is not available

Request

Body

Response

Status: 404

Profile

POST/l/profile_api/profileset/42/99

Update a user profile, where 42 is a profileSetId and 99 is a relationId



In the example bellow, "image1" and "image2" are file type fields. Files can be provided in a few ways, and each way has a different consequence. As you can see in the Profile schema example, we expect one of three types of input: an object, a string, or null. To correctly process the request, we expect these types of input as follows:

- object: when a new file is uploaded to our system.

- string: when a file should be kept for the profile. The string is the document key we provide for this specific field in the profile GET call

- null: empty the field.



The different options are displayed in the example below.

Request

Body
{
    "name": "Test name",
    "address": [
        "Fortweg",
        9,
        "",
        "3992LX",
        "Houten",
        "NL"
    ],
    "image1": null,
    "image2": [
        "05c68636-70db-4bc8-a80a-039076be4f1e",
        {
            "fileName": "Example file",
            "content": "data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4\/\/8\/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
        }
    ]
}

Response

Status: 200

Request

Body
{
    "name": "Test name"
}

Response

json Status: 400
{
    "errors": {
        "address": "Dit veld is verplicht"
    }
}

Requesting a profile of a different user than the access token is linked to

Request

Body

Response

Status: 403

Requesting a profile set that is not available

Request

Body

Response

Status: 404