pwrd by

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

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

Examples

[]
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, "class_1_ff_428" 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

Examples

[]
200
{
    "$schema": "http:\\\/\\\/json-schema.org\\\/draft-07\\\/schema#",
    "title": "Demo profile set",
    "type": "object",
    "properties": {
        "class_1_relation_firstname": {
            "title": "First name",
            "type": "string"
        },
        "class_1_relation_insertion": {
            "title": "Insertion",
            "type": "string"
        },
        "class_1_relation_name": {
            "title": "Name",
            "type": "string"
        },
        "class_1_ff_447": {
            "title": "Birth date",
            "type": "date"
        },
        "class_1_relation_address_0": {
            "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"
        },
        "class_1_ff_428": {
            "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": [
        "class_1_relation_name",
        "class_1_relation_address_0"
    ]
}

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 "class_1_ff_6887". 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.

Examples

[]
200
{
    "class_1_relation_name": "Test name",
    "class_1_relation_address_0": [
        "Hoefzijde",
        3,
        "",
        "3961MX",
        "Wijk bij Duurstede",
        "NL"
    ],
    "class_1_ff_6887": [
        {
            "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

[]
403
[]

Requesting a profile set that is not available

[]
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, "class_1_ff_428" and "class_1_ff_6887" 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.

Examples

{
    "class_1_relation_name": "Test name",
    "class_1_relation_address_0": [
        "Hoefzijde",
        3,
        "",
        "3961MX",
        "Wijk bij Duurstede",
        "NL"
    ],
    "class_1_ff_428": null,
    "class_1_ff_6887": [
        "05c68636-70db-4bc8-a80a-039076be4f1e",
        {
            "fileName": "Example file",
            "content": "data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4\/\/8\/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
        }
    ]
}
200
[]
{
    "class_1_relation_name": "Test name"
}
400
{
    "errors": {
        "class_1_relation_address_0": "Dit veld is verplicht"
    }
}

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

[]
403
[]

Requesting a profile set that is not available

[]
404
[]