Create a Currency
POSThttps://useast.api.elasticpath.com/v2/currencies
Create a currency.
Request
- application/json
Body
data object
Responses
- 201
- 400
- 422
Created
- application/json
- Schema
- Example (auto)
Schema
data object
{
"data": {
"id": "0c45e4ec-26e0-4043-86e4-c15b9cf985a0",
"type": "currency",
"code": "GBP",
"exchange_rate": 1,
"format": "£{price}",
"decimal_point": ".",
"thousand_separator": ",",
"decimal_places": 2,
"default": true,
"enabled": true,
"links": {
"self": "string"
},
"meta": {
"timestamps": {
"created_at": "2023-11-07T23:04:18.845Z",
"updated_at": "2023-11-07T23:04:18.845Z"
},
"owner": "store"
}
}
}
Bad Request
- application/json
- Schema
- Example (auto)
- Example
Schema
errors object[]
{
"errors": [
{
"detail": "string",
"status": 400,
"title": "string"
}
]
}
{
"errors": [
{
"status": 400,
"title": "Currency already exists",
"detail": "The specified currency code already exists"
}
]
}
Bad Request
- application/json
- Schema
- Example (auto)
- Example
Schema
errors object[]
{
"errors": [
{
"detail": "string",
"status": 400,
"title": "string"
}
]
}
{
"errors": [
{
"status": 422,
"title": "Currency limit reached",
"detail": "You have reached the maximum allowed currency limit of 10"
}
]
}
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/currencies");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("[\n {\n \"data\": {\n \"code\": \"GBP\",\n \"decimal_places\": 2,\n \"decimal_point\": \".\",\n \"default\": true,\n \"enabled\": true,\n \"exchange_rate\": 1,\n \"format\": \"£{price}\",\n \"thousand_separator\": \",\",\n \"type\": \"currency\"\n }\n }\n]", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear