User

Authentication

  • HTTP Authentication, scheme: bearer

User

Get user info

Code samples

const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', 'https://fakestoreapi.ru/user');
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer {access-token}');

xhr.send(data);

GET /user

Example responses

200 Response

Responses

Status
Meaning
Description
Schema

200

User info recived

5XX

Unknown

Server error

None

4XX

Unknown

Check response message

None

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Update user info

Code samples

PATCH /user

Body parameter

Parameters

Name
In
Type
Required
Description

body

body

true

none

Responses

Status
Meaning
Description
Schema

200

User info updated

None

5XX

Unknown

Server error

None

4XX

Unknown

Check response message

None

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Update user password

Code samples

PATCH /user/password

Body parameter

Parameters

Name
In
Type
Required
Description

body

body

true

none

Responses

Status
Meaning
Description
Schema

200

User password updated

None

5XX

Unknown

Server error

None

4XX

Unknown

Check response message

None

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Get user cart

Code samples

GET /user/cart

Parameters

Name
In
Type
Required
Description

l

query

number

false

Items limit on page ( from 1 to 50 )

p

query

number

false

Items page ( min 1 )

Example responses

200 Response

Responses

Status
Meaning
Description
Schema

200

User cart recived

5XX

Unknown

Server error

None

4XX

Unknown

Check response message

None

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Add product to user cart

Code samples

POST /user/cart

Parameters

Name
In
Type
Required
Description

pid

query

string

true

Product id

Responses

Status
Meaning
Description
Schema

200

Success added

None

5XX

Unknown

Server error

None

4XX

Unknown

Check response message

None

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Remove products from user cart

Code samples

DELETE /user/cart

Body parameter

Parameters

Name
In
Type
Required
Description

body

body

true

none

Responses

Status
Meaning
Description
Schema

200

Success removed

None

5XX

Unknown

Server error

None

4XX

Unknown

Check response message

None

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Last updated