User photo

Resource: userphoto

This API call reads user photos. The photos are delivered as base64 strings. Without parameters the photos of all users are delivered. If you specify a user ID as resourceid, the photo of this user will be delivered. With the parameter filter you can specify an array of user IDs whose photos you want to read.

If no user photo is available under “Extras >> Settings >> User >> Tab basic data “, the photo of the linked address record is delivered.

You need read permission to query user data via API. This can be set under “Extras->Einstellungen->Benutzer” / “Extras->Settings->User”. Choose the tab “API user”, then the tab “Rights” with the setting “Benutzerdaten über API auslesen” / “Read out user data by API”. Only API users can see this setting.

Parameters:

  • filter
    OBJECT. Key: field, value: array of objects with filter expressions in the format "Nr": [{"op": "=", "val": 1}]. With op you specify the operator. Possible values for op are the following SQL operators:

    is or =, >, <, >=, <=, != or <>, between, like, not like, in, not in

    For the operator like the value % can be specified as a placeholder.

    With val you specify the value which should be applied to the filtering. The individual filter expressions are linked with the AND operation. See also the example below.

  • sortby
    OBJECT. Fields to sort by. The field name is used as the key, and the type of sorting as the value. Notation: {"Nr": "ASC"}
    Possible values for sorting are ASC for ascending, DESC for descending.

Example: Read user photos from users 17, 19 and 21

...
{
    "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
    "resourceid": "",
    "identifier": "",
    "resourcetype": "userphoto",
    "parameters": {
        "filter": {
            "Nr": [
                {
                    "op": "in",
                    "val": [
                        17,
                        19,
                        21
                    ]
                }
            ]
        },
        "sortby": {
            "Nr": "DESC"
        }
    }
}
...

Response:

...
{
    "status": {
        "code": 200,
        "errorcode": 0,
        "message": "OK"
    },
    "response": {
        "results": [
            {
                "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
                "resourceid": "",
                "resourcetype": "userphoto",
                "cacheable": true,
                "identifier": "",
                "data": {
                    "meta": {
                        "cntabsolute": null
                    },
                    "records": [
                        {
                            "id": 21,
                            "type": "user",
                            "elements": {
                                "photo": null
                            }
                        },
                        {
                            "id": 19,
                            "type": "user",
                            "elements": {
                                "photo": null
                            }
                        },
                        {
                            "id": 17,
                            "type": "user",
                            "elements": {
                                "phot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7d2us3qraRXGo6kPPgfR2F481trM3hWjDw2RcjxBJrkT7rf7HJo0NhOFXM32o3MV7PbF2x9nFuIpowCZjIeEB9X174kab4m0z+x9Z8U\/EG6sJZBNqOdI8Ix3uuXFjAV0m41\/UrOay1LX54bgu6z6\/eavNYxzE2sks0Zkn\/sDHRxcsThpYedanSoyUqyipqM4qVOcrKF2Q=="
                            }
                        }
                    ]
                },
                "status": {
                    "errorcode": 0,
                    "message": "OK"
                }
            }
        ]
    }
}
...