cart

Authentication

  • HTTP Authentication, scheme: bearer

cart

Get user cart

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/cart');
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer {access-token}');

xhr.send(data);

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

Body parameter

Parameters

Name
In
Type
Required
Description

body

body

true

none

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