Set the information about the authenticated user

PATCH /user

Request

Authentication

This endpoint requires authentication.

Header Value
Authorization Set the value to Bearer + + access_token

Body

Pass the following properties via application/json or form encoding in the body of the request.

Information about a user

Field Type Description
firstname String A String value
lastname String A String value
email Email Email address
telephone Phone International phone number
notifications UserNotifications Information about the notifications a user want to receive

Example request 1 Set the user firstname

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer b34d0efe94c82f6e220aa10b8c348bc4e3ec42e55f3493dde427adb4f8ab97dbb3d98140a6ae16d3323f0e13b3cdb0e25ad0ef2029e5528aca0da9e5ea4c4cf2c9d98ba805b1d3fac0ea7f1d4c1a471f9abd02eaaba8964d9435725bedb111c0b2708857
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 27
{
    "firstname": "Carl"
}

Example request 2 Set the user notification settings

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer b34d0efe94c82f6e220aa10b8c348bc4e3ec42e55f3493dde427adb4f8ab97dbb3d98140a6ae16d3323f0e13b3cdb0e25ad0ef2029e5528aca0da9e5ea4c4cf2c9d98ba805b1d3fac0ea7f1d4c1a471f9abd02eaaba8964d9435725bedb111c0b2708857
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 112
{
    "notifications": {
        "email_when_comment": false,
        "email_when_order_confirmed": true
    }
}

Example request 3 Change the email

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer b34d0efe94c82f6e220aa10b8c348bc4e3ec42e55f3493dde427adb4f8ab97dbb3d98140a6ae16d3323f0e13b3cdb0e25ad0ef2029e5528aca0da9e5ea4c4cf2c9d98ba805b1d3fac0ea7f1d4c1a471f9abd02eaaba8964d9435725bedb111c0b2708857
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 72
{
    "email": "other-email-settings.205341425-1608038815@example.com"
}

Example request 4 Change the email and notifications at once

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer b34d0efe94c82f6e220aa10b8c348bc4e3ec42e55f3493dde427adb4f8ab97dbb3d98140a6ae16d3323f0e13b3cdb0e25ad0ef2029e5528aca0da9e5ea4c4cf2c9d98ba805b1d3fac0ea7f1d4c1a471f9abd02eaaba8964d9435725bedb111c0b2708857
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 184
{
    "email": "2.other-email-settings.205341425-1608038815@example.com",
    "notifications": {
        "email_when_comment": true,
        "email_when_order_confirmed": false
    }
}

Example request 5 Can't set the user's bank account

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer b34d0efe94c82f6e220aa10b8c348bc4e3ec42e55f3493dde427adb4f8ab97dbb3d98140a6ae16d3323f0e13b3cdb0e25ad0ef2029e5528aca0da9e5ea4c4cf2c9d98ba805b1d3fac0ea7f1d4c1a471f9abd02eaaba8964d9435725bedb111c0b2708857
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 47
{
    "bank_account_number": "BE123123123123"
}

Example request 6 Update to an email address that already exists

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer b34d0efe94c82f6e220aa10b8c348bc4e3ec42e55f3493dde427adb4f8ab97dbb3d98140a6ae16d3323f0e13b3cdb0e25ad0ef2029e5528aca0da9e5ea4c4cf2c9d98ba805b1d3fac0ea7f1d4c1a471f9abd02eaaba8964d9435725bedb111c0b2708857
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 65
{
    "email": "existing-mail-945334935-1608038815@example.com"
}

Response

Information about a user

Field Type Description
firstname String A String value
lastname String A String value
email Email Email address
telephone Phone International phone number
notifications UserNotifications Information about the notifications a user want to receive
id Int An integer value
delivery_address Address.simple? Nullable. An address
company Checkout.Company? Nullable.
bank_account_number String? Nullable. A String value

Example response 1 Set the user firstname

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 455

{
    "firstname": "Carl",
    "lastname": "Jacques",
    "email": "rlibert9059495@example.net",
    "telephone": "+32 479 56 73 45",
    "notifications": {
        "email_when_order": true,
        "email_when_comment": true,
        "email_when_order_confirmed": true,
        "email_when_order_cancel": true,
        "email_when_newsletter": true
    },
    "id": 1284,
    "delivery_address": null,
    "company": null,
    "bank_account_number": ""
}

Example response 2 Set the user notification settings

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 456

{
    "firstname": "Carl",
    "lastname": "Jacques",
    "email": "rlibert9059495@example.net",
    "telephone": "+32 479 56 73 45",
    "notifications": {
        "email_when_order": true,
        "email_when_comment": false,
        "email_when_order_confirmed": true,
        "email_when_order_cancel": true,
        "email_when_newsletter": true
    },
    "id": 1284,
    "delivery_address": null,
    "company": null,
    "bank_account_number": ""
}

Example response 3 Change the email

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 483

{
    "firstname": "Carl",
    "lastname": "Jacques",
    "email": "other-email-settings.205341425-1608038815@example.com",
    "telephone": "+32 479 56 73 45",
    "notifications": {
        "email_when_order": true,
        "email_when_comment": false,
        "email_when_order_confirmed": true,
        "email_when_order_cancel": true,
        "email_when_newsletter": true
    },
    "id": 1284,
    "delivery_address": null,
    "company": null,
    "bank_account_number": ""
}

Example response 4 Change the email and notifications at once

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 485

{
    "firstname": "Carl",
    "lastname": "Jacques",
    "email": "2.other-email-settings.205341425-1608038815@example.com",
    "telephone": "+32 479 56 73 45",
    "notifications": {
        "email_when_order": true,
        "email_when_comment": true,
        "email_when_order_confirmed": false,
        "email_when_order_cancel": true,
        "email_when_newsletter": true
    },
    "id": 1284,
    "delivery_address": null,
    "company": null,
    "bank_account_number": ""
}

Example response 5 Can't set the user's bank account

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 136

[
    {
        "code": "unknown_field",
        "message": "Field bank_account_number is not expected",
        "field": "data"
    }
]

Example response 6 Update to an email address that already exists

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 76

{
    "code": "invalid_field",
    "message": "3350",
    "field": "email"
}
1.5.0 stable