cURL
curl -X POST "$EXSITED_BASE_URL/api/v4/settings/discount_profiles" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"discount_profile": {
"name": "Launch discount",
"discount_type": "PERCENTAGE",
"percentage_amount": 10,
"owner_type": "saleOrder",
"start_time": "2099-01-01 00:00",
"end_time": "2099-01-31 23:59",
"accounting_code": "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d"
}
}'from exsited import build_client
client = build_client()
response = client.settings.create_settings_discount_profile(
{
"discount_profile": {
"name": "Launch discount",
"discount_type": "PERCENTAGE",
"percentage_amount": 10,
"owner_type": "saleOrder",
"start_time": "2099-01-01 00:00",
"end_time": "2099-01-31 23:59",
"accounting_code": "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d",
}
}
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.settings.createSettingsDiscountProfile({
discount_profile: {
name: 'Launch discount',
discount_type: 'PERCENTAGE',
percentage_amount: 10,
owner_type: 'saleOrder',
start_time: '2099-01-01 00:00',
end_time: '2099-01-31 23:59',
accounting_code: '121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d',
},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->settings->createSettingsDiscountProfile([
'discount_profile' => [
'name' => 'Launch discount',
'discount_type' => 'PERCENTAGE',
'percentage_amount' => 10,
'owner_type' => 'saleOrder',
'start_time' => '2099-01-01 00:00',
'end_time' => '2099-01-31 23:59',
'accounting_code' => '121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d',
],
]);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.settings.settings_dto.SettingsDto.SettingsDiscountProfileRead;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<SettingsDiscountProfileRead> response = client.settings().createSettingsDiscountProfile(
Map.of(
"discount_profile", Map.of(
"name", "Launch discount",
"discount_type", "PERCENTAGE",
"percentage_amount", 10,
"owner_type", "saleOrder",
"start_time", "2099-01-01 00:00",
"end_time", "2099-01-31 23:59",
"accounting_code", "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d")));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.Settings.CreateSettingsDiscountProfileAsync(new Dictionary<string, object?>
{
["discount_profile"] = new Dictionary<string, object?>
{
["name"] = "Launch discount",
["discount_type"] = "PERCENTAGE",
["percentage_amount"] = 10,
["owner_type"] = "saleOrder",
["start_time"] = "2099-01-01 00:00",
["end_time"] = "2099-01-31 23:59",
["accounting_code"] = "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d",
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.settings.createSettingsDiscountProfile({
'discount_profile': {
'name': 'Launch discount',
'discount_type': 'PERCENTAGE',
'percentage_amount': 10,
'owner_type': 'saleOrder',
'start_time': '2099-01-01 00:00',
'end_time': '2099-01-31 23:59',
'accounting_code': '121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d',
},
});
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.Settings().CreateSettingsDiscountProfile(context.Background(), map[string]any{
"discount_profile": map[string]any{
"name": "Launch discount",
"discount_type": "PERCENTAGE",
"percentage_amount": 10,
"owner_type": "saleOrder",
"start_time": "2099-01-01 00:00",
"end_time": "2099-01-31 23:59",
"accounting_code": "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d",
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"discount_profile": {
"accounting_code": {
"object": "<string>",
"id": "<string>",
"name": "<string>",
"href": "<string>"
},
"created_by": "<unknown>",
"created_on": "<string>",
"description": "<string>",
"discount_type": "<string>",
"display_name": "<string>",
"end_time": "<string>",
"fixed_amount": 123,
"href": "<string>",
"id": "<string>",
"invoice_note": "<string>",
"last_updated_by": "<unknown>",
"last_updated_on": "<string>",
"max_use_per_account": 123,
"max_use_per_order": 123,
"max_use_total": 123,
"name": "<string>",
"object": "<string>",
"owner_type": "<string>",
"percentage_amount": 123,
"price_is_inclusive_of_discount": true,
"priority": 123,
"redemption_required": true,
"stackable": true,
"start_time": "<string>",
"status": "<string>",
"tax_code": {
"href": "<string>",
"id": "<string>",
"object": "<string>"
},
"version": 123
}
}{
"object": "<string>",
"request_id": "<string>",
"status": 123,
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>"
}
]
}Instance settings
Create a discount profile
Creates a discount profile and returns it under discount_profile.
POST
/
settings
/
discount_profiles
cURL
curl -X POST "$EXSITED_BASE_URL/api/v4/settings/discount_profiles" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"discount_profile": {
"name": "Launch discount",
"discount_type": "PERCENTAGE",
"percentage_amount": 10,
"owner_type": "saleOrder",
"start_time": "2099-01-01 00:00",
"end_time": "2099-01-31 23:59",
"accounting_code": "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d"
}
}'from exsited import build_client
client = build_client()
response = client.settings.create_settings_discount_profile(
{
"discount_profile": {
"name": "Launch discount",
"discount_type": "PERCENTAGE",
"percentage_amount": 10,
"owner_type": "saleOrder",
"start_time": "2099-01-01 00:00",
"end_time": "2099-01-31 23:59",
"accounting_code": "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d",
}
}
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.settings.createSettingsDiscountProfile({
discount_profile: {
name: 'Launch discount',
discount_type: 'PERCENTAGE',
percentage_amount: 10,
owner_type: 'saleOrder',
start_time: '2099-01-01 00:00',
end_time: '2099-01-31 23:59',
accounting_code: '121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d',
},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->settings->createSettingsDiscountProfile([
'discount_profile' => [
'name' => 'Launch discount',
'discount_type' => 'PERCENTAGE',
'percentage_amount' => 10,
'owner_type' => 'saleOrder',
'start_time' => '2099-01-01 00:00',
'end_time' => '2099-01-31 23:59',
'accounting_code' => '121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d',
],
]);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.settings.settings_dto.SettingsDto.SettingsDiscountProfileRead;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<SettingsDiscountProfileRead> response = client.settings().createSettingsDiscountProfile(
Map.of(
"discount_profile", Map.of(
"name", "Launch discount",
"discount_type", "PERCENTAGE",
"percentage_amount", 10,
"owner_type", "saleOrder",
"start_time", "2099-01-01 00:00",
"end_time", "2099-01-31 23:59",
"accounting_code", "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d")));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.Settings.CreateSettingsDiscountProfileAsync(new Dictionary<string, object?>
{
["discount_profile"] = new Dictionary<string, object?>
{
["name"] = "Launch discount",
["discount_type"] = "PERCENTAGE",
["percentage_amount"] = 10,
["owner_type"] = "saleOrder",
["start_time"] = "2099-01-01 00:00",
["end_time"] = "2099-01-31 23:59",
["accounting_code"] = "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d",
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.settings.createSettingsDiscountProfile({
'discount_profile': {
'name': 'Launch discount',
'discount_type': 'PERCENTAGE',
'percentage_amount': 10,
'owner_type': 'saleOrder',
'start_time': '2099-01-01 00:00',
'end_time': '2099-01-31 23:59',
'accounting_code': '121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d',
},
});
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.Settings().CreateSettingsDiscountProfile(context.Background(), map[string]any{
"discount_profile": map[string]any{
"name": "Launch discount",
"discount_type": "PERCENTAGE",
"percentage_amount": 10,
"owner_type": "saleOrder",
"start_time": "2099-01-01 00:00",
"end_time": "2099-01-31 23:59",
"accounting_code": "121b2c3d4e5f4a6b8c7d9e0f1a2b3c4d",
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"discount_profile": {
"accounting_code": {
"object": "<string>",
"id": "<string>",
"name": "<string>",
"href": "<string>"
},
"created_by": "<unknown>",
"created_on": "<string>",
"description": "<string>",
"discount_type": "<string>",
"display_name": "<string>",
"end_time": "<string>",
"fixed_amount": 123,
"href": "<string>",
"id": "<string>",
"invoice_note": "<string>",
"last_updated_by": "<unknown>",
"last_updated_on": "<string>",
"max_use_per_account": 123,
"max_use_per_order": 123,
"max_use_total": 123,
"name": "<string>",
"object": "<string>",
"owner_type": "<string>",
"percentage_amount": 123,
"price_is_inclusive_of_discount": true,
"priority": 123,
"redemption_required": true,
"stackable": true,
"start_time": "<string>",
"status": "<string>",
"tax_code": {
"href": "<string>",
"id": "<string>",
"object": "<string>"
},
"version": 123
}
}{
"object": "<string>",
"request_id": "<string>",
"status": 123,
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>"
}
]
}Send the new profile under
discount_profile. Write start_time and end_time as YYYY-MM-DD HH:mm, and set accounting_code to the id of an accounting code whose default_match_key is discount.
The SDK samples get their client from credentials your app registers once when it starts, as shown in Authentication. To try the call here, click Try it, set
host to your Exsited API host name and paste an access token from Get an access token. To send a raw JSON body instead of filling in fields, copy the cURL sample and edit its -d payload.Authorizations
An access token from POST /api/v4/oauth2/token. The SDKs get and renew it for you.
Body
application/json
Show child attributes
Show child attributes
Response
The new discount profile, under discount_profile.
Show child attributes
Show child attributes