POST
/point-exchange-rule/Create point exchange rule
You can create a new point exchange rule.
| Attributes | Type | Required | Description |
|---|---|---|---|
| id | integer | yes | A unique identifier for the point acquire rule which is given by User.com |
Request
- CURL
- JavaScript
- PHP
- Python
curl --location --request POST 'https://<your_app_subdomain>.user.com/api/public/point-exchange-rule/' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <your_64_char_api_key>' \
--header 'Accept: */*; version=2' \
--data-raw '{ "name": "string", "amount": 0, "end_date": "2022-03-09T13:49:54.588Z", "max_daily_use_count": 0, "max_trigger_count_interval": 0, "max_trigger_count_value": 0, "perk": {}, "point_campaign": 1, "user_attribute": 1, "level_threshold": 0}'
var data = JSON.stringify({
name: "string",
amount: 0,
end_date: "2022-03-09T13:49:54.588Z",
max_daily_use_count: 0,
max_trigger_count_interval: 0,
max_trigger_count_value: 0,
perk: {},
point_campaign: 1,
user_attribute: 1,
level_threshold: 0,
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open(
"POST",
"https://<your_app_subdomain>.user.com/api/public/point-exchange-rule/"
);
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("Accept", "*/*; version=2");
xhr.send(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<your_app_subdomain>.user.com/api/public/point-exchange-rule/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{ "name": "string", "amount": 0, "end_date": "2022-03-09T13:49:54.588Z", "max_daily_use_count": 0, "max_trigger_count_interval": 0, "max_trigger_count_value": 0, "perk": {}, "point_campaign": 1, "user_attribute": 1, "level_threshold": 0}',
CURLOPT_HTTPHEADER => array(
'accept: application/json',
'Content-Type: application/json',
'Authorization: Token <your_64_char_api_key>',
'Accept: */*; version=2'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
import json
url = "https://<your_app_subdomain>.user.com/api/public/point-exchange-rule/"
payload = json.dumps({
"name": "string",
"amount": 0,
"end_date": "2022-03-09T13:49:54.588Z",
"max_daily_use_count": 0,
"max_trigger_count_interval": 0,
"max_trigger_count_value": 0,
"perk": {},
"point_campaign": 1,
"user_attribute": 1,
"level_threshold": 0
})
headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Token <your_64_char_api_key>',
'Accept': '*/*; version=2'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
{
"id": 1,
"name": "string",
"amount": 0,
"end_date": "2022-03-09T13:49:54.588000Z",
"max_daily_use_count": 0,
"max_trigger_count_interval": 0,
"max_trigger_count_value": 0,
"perk": {},
"point_campaign": 1,
"user_attribute": 1,
"level_threshold": 1
}