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 facedb671a8aea3c031940781975535320a94550c9e0914d7d0620bdd3246b33ac89ef562691434f7b9c4503f17ec9172dd7db8782e688704418241d65ef629caf4b76ac9250ae6039bbe072e7fe65d3dc9d552799ca7fb208e56ed6cbd86d5bbac0f7b6
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 facedb671a8aea3c031940781975535320a94550c9e0914d7d0620bdd3246b33ac89ef562691434f7b9c4503f17ec9172dd7db8782e688704418241d65ef629caf4b76ac9250ae6039bbe072e7fe65d3dc9d552799ca7fb208e56ed6cbd86d5bbac0f7b6
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 facedb671a8aea3c031940781975535320a94550c9e0914d7d0620bdd3246b33ac89ef562691434f7b9c4503f17ec9172dd7db8782e688704418241d65ef629caf4b76ac9250ae6039bbe072e7fe65d3dc9d552799ca7fb208e56ed6cbd86d5bbac0f7b6
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 72
{
    "email": "other-email-settings.100703972-1592307619@example.com"
}

Example request 4 Change the email and notifications at once

PATCH /user HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer facedb671a8aea3c031940781975535320a94550c9e0914d7d0620bdd3246b33ac89ef562691434f7b9c4503f17ec9172dd7db8782e688704418241d65ef629caf4b76ac9250ae6039bbe072e7fe65d3dc9d552799ca7fb208e56ed6cbd86d5bbac0f7b6
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.100703972-1592307619@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 facedb671a8aea3c031940781975535320a94550c9e0914d7d0620bdd3246b33ac89ef562691434f7b9c4503f17ec9172dd7db8782e688704418241d65ef629caf4b76ac9250ae6039bbe072e7fe65d3dc9d552799ca7fb208e56ed6cbd86d5bbac0f7b6
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 facedb671a8aea3c031940781975535320a94550c9e0914d7d0620bdd3246b33ac89ef562691434f7b9c4503f17ec9172dd7db8782e688704418241d65ef629caf4b76ac9250ae6039bbe072e7fe65d3dc9d552799ca7fb208e56ed6cbd86d5bbac0f7b6
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 65
{
    "email": "existing-mail-351288733-1592307619@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: 460

{
    "firstname": "Carl",
    "lastname": "Bauwens",
    "email": "bogaert.jasper674630@example.com",
    "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": 126,
    "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: 461

{
    "firstname": "Carl",
    "lastname": "Bauwens",
    "email": "bogaert.jasper674630@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": 126,
    "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: 482

{
    "firstname": "Carl",
    "lastname": "Bauwens",
    "email": "other-email-settings.100703972-1592307619@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": 126,
    "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: 484

{
    "firstname": "Carl",
    "lastname": "Bauwens",
    "email": "2.other-email-settings.100703972-1592307619@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": 126,
    "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