Create an Account Cart Association
POSThttps://useast.api.elasticpath.com/v2/carts/:cartID/relationships/accounts
You can create associations between an account and one or more carts. After cart associations exist for an account, the account can access those carts across any device.
Request
Path Parameters
cartID stringrequired
The ID for the cart created by the account. Ensure that you follow the guidelines for Safe Characters.
Header Parameters
EP-Account-Management-Authentication-Token string
An Account Management Authentication token to access a specific account's carts.
- application/json
Body
data object[]
Responses
- 200
- 204
- 400
- 403
- 422
OK
Response Headers
- application/json
- Schema
- Example (auto)
Schema
data object[]
{
"data": [
{
"id": "string",
"type": "string"
}
]
}
No Content is sent back in case the account has already been associated to the cart.
Response Headers
Bad Request
- application/json
- Schema
- Example (auto)
Schema
errors object[]required
{
"errors": [
{
"title": "string",
"detail": "string",
"meta": {
"id": "string",
"ids": [
"string"
],
"item_ids": [
"string"
],
"shipping_group_id": "string",
"shipping_group_ids": [
"string"
],
"cart_id": "string",
"code": "string",
"order_id": "string"
}
}
]
}
Forbidden
- application/json
- Schema
- Example (auto)
Schema
errors object[]required
{
"errors": [
{
"title": "string",
"detail": "string",
"meta": {
"id": "string",
"ids": [
"string"
],
"item_ids": [
"string"
],
"shipping_group_id": "string",
"shipping_group_ids": [
"string"
],
"cart_id": "string",
"code": "string",
"order_id": "string"
}
}
]
}
Unprocessable Entity
- application/json
- Schema
- Example (auto)
Schema
errors object[]required
{
"errors": [
{
"title": "string",
"detail": "string",
"meta": {
"id": "string",
"ids": [
"string"
],
"item_ids": [
"string"
],
"shipping_group_id": "string",
"shipping_group_ids": [
"string"
],
"cart_id": "string",
"code": "string",
"order_id": "string"
}
}
]
}
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://useast.api.elasticpath.com/v2/carts/:cartID/relationships/accounts");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": [\n {\n \"id\": \"string\",\n \"type\": \"string\"\n }\n ]\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear