Create a new shipping group for a cart
POSThttps://useast.api.elasticpath.com/v2/carts/:cartID/shipping-groups
Create a new shipping group for a cart
Request
Path Parameters
cartID stringrequired
The ID of the cart
- application/json
Bodyrequired
data object
Responses
- 201
- 400
- 401
- 404
Shipping group created successfully
- application/json
- Schema
- Example (auto)
Schema
typestring
Possible values: [shipping_group
]
idstring
relationstring
cart_idstring
order_idstring
shipping_typestring
tracking_referencestring
address object
delivery_estimate object
createdAtdate-time
updatedAtdate-time
relationships object
discounts object[]
meta object
{
"type": "shipping_group",
"id": "string",
"relation": "string",
"cart_id": "string",
"order_id": "string",
"shipping_type": "string",
"tracking_reference": "string",
"address": {
"first_name": "string",
"last_name": "string",
"phone_number": "string",
"company_name": "string",
"line_1": "string",
"line_2": "string",
"city": "string",
"postcode": "string",
"county": "string",
"country": "string",
"region": "string",
"instructions": "string"
},
"delivery_estimate": {
"start": "2024-07-29T15:51:28.071Z",
"end": "2024-07-29T15:51:28.071Z"
},
"createdAt": "2024-07-29T15:51:28.071Z",
"updatedAt": "2024-07-29T15:51:28.071Z",
"relationships": {
"cart": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
},
"order": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
}
},
"discounts": [
{
"amount": {
"amount": 0,
"currency": "string",
"includes_tax": true
},
"code": "string",
"id": "string",
"promotion_source": "string",
"is_cart_discount": true,
"ordinal": 0
}
],
"meta": {
"shipping_display_price": {
"total": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"base": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"fees": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
}
},
"total_display_price": {
"with_tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"without_tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"balance_owing": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"paid": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"authorized": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"without_discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"shipping": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"shipping_discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
}
}
}
}
Invalid request
- application/json
- Schema
- Example (auto)
- currency_mismatch
- invalid_dates
Schema
detailstring
statusstring
titlestring
[
null
]
{
"errors": [
{
"status": 400,
"title": "Cart Currency Mismatch",
"detail": "This cart uses USD, cannot add shipping group with currency EUR"
}
]
}
{
"errors": [
{
"status": 400,
"title": "Date Logic Discrepancy",
"detail": "The start date cannot occur after the end date"
}
]
}
Unauthorized
- application/json
- Schema
- Example (auto)
- Example
Schema
detailstring
statusstring
titlestring
[
null
]
{
"errors": [
{
"status": 401,
"title": "Unauthorized",
"detail": "Invalid or missing authentication token"
}
]
}
Cart not found
- application/json
- Schema
- Example (auto)
- Example
Schema
detailstring
statusstring
titlestring
[
null
]
{
"errors": [
{
"status": 404,
"title": "Not Found",
"detail": "Cart not found"
}
]
}
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/shipping-groups");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"shipping_group\",\n \"shipping_type\": \"string\",\n \"tracking_reference\": \"string\",\n \"shipping_price\": {\n \"total\": 0,\n \"base\": 0,\n \"tax\": 0,\n \"fees\": 0,\n \"discount\": 0\n },\n \"address\": {\n \"first_name\": \"string\",\n \"last_name\": \"string\",\n \"phone_number\": \"string\",\n \"company_name\": \"string\",\n \"line_1\": \"string\",\n \"line_2\": \"string\",\n \"city\": \"string\",\n \"postcode\": \"string\",\n \"county\": \"string\",\n \"country\": \"string\",\n \"region\": \"string\",\n \"instructions\": \"string\"\n },\n \"includes_tax\": true,\n \"delivery_estimate\": {\n \"start\": \"2024-07-29T15:51:28.071Z\",\n \"end\": \"2024-07-29T15:51:28.071Z\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear