API Documentation

This document is a work in progress and your opinion helps us to improve. Please let us know what we can do better. Thanks! support@procurios.com

Profile

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 set. 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. 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 Profile

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

Profile sets GET

URL: /l/profile_api/profileset

Scope:

Last used: Never

Request the set of profile sets that are available to your access token and use the id of one of the sets for further API calls. The method example returns the example ID 42.

Live testing disabled

Profile sets

Request

json

Response

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

Schema GET

URL: /l/profile_api/profileset/42/schema

Scope:

Last used: Never

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

Live testing disabled

Schema

Request

json

Response

jsonStatus: 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": "Street"
                },
                "number": {
                    "type": "integer",
                    "title": "Number"
                },
                "number_add": {
                    "type": "string",
                    "title": "Addition"
                },
                "postcode": {
                    "type": "string",
                    "title": "ZIP code"
                },
                "town": {
                    "type": "string",
                    "title": "Town"
                },
                "country": {
                    "type": "string",
                    "minimum": 2,
                    "maximum": 2,
                    "title": "Country"
                }
            }
        },
        "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

URL: /l/profile_api/profileset/42/99

Scope:

Last used: Never

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.

Live testing disabled

Profile

Request

json

Response

jsonStatus: 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

Profile

Request

Response

Status: 403

Requesting a profile set that is not available

Profile

Request

Response

Status: 404

Profile POST

URL: /l/profile_api/profileset/42/99

Scope:

Last used: Never

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.

Live testing disabled

Profile

Request

{
    "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

Profile

Request

json
{
    "name": "Test name"
}

Response

jsonStatus: 400
{
    "errors": {
        "address": "Dit veld is verplicht"
    }
}

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

Profile

Request

Response

Status: 403

Requesting a profile set that is not available

Profile

Request

Response

Status: 404