Creates a custom objective.
curl --request POST \
--url https://api.bonifiq.com.br/v1/pvt/Objectives/custom \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"Name": "<string>",
"AmountOfPoints": 123,
"Active": true,
"CustomerMaxCompletion": 123,
"ShowOnWidgetAndLandingPage": true,
"IconUrl": "<string>",
"CardTitle": "<string>",
"CardDescription": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"NotifyCustomerWhenPointIsGiven": true
}
'import requests
url = "https://api.bonifiq.com.br/v1/pvt/Objectives/custom"
payload = {
"Name": "<string>",
"AmountOfPoints": 123,
"Active": True,
"CustomerMaxCompletion": 123,
"ShowOnWidgetAndLandingPage": True,
"IconUrl": "<string>",
"CardTitle": "<string>",
"CardDescription": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"NotifyCustomerWhenPointIsGiven": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Name: '<string>',
AmountOfPoints: 123,
Active: true,
CustomerMaxCompletion: 123,
ShowOnWidgetAndLandingPage: true,
IconUrl: '<string>',
CardTitle: '<string>',
CardDescription: '<string>',
ActionButtonText: '<string>',
ActionButtonUrl: '<string>',
NotifyCustomerWhenPointIsGiven: true
})
};
fetch('https://api.bonifiq.com.br/v1/pvt/Objectives/custom', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bonifiq.com.br/v1/pvt/Objectives/custom",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'Name' => '<string>',
'AmountOfPoints' => 123,
'Active' => true,
'CustomerMaxCompletion' => 123,
'ShowOnWidgetAndLandingPage' => true,
'IconUrl' => '<string>',
'CardTitle' => '<string>',
'CardDescription' => '<string>',
'ActionButtonText' => '<string>',
'ActionButtonUrl' => '<string>',
'NotifyCustomerWhenPointIsGiven' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bonifiq.com.br/v1/pvt/Objectives/custom"
payload := strings.NewReader("{\n \"Name\": \"<string>\",\n \"AmountOfPoints\": 123,\n \"Active\": true,\n \"CustomerMaxCompletion\": 123,\n \"ShowOnWidgetAndLandingPage\": true,\n \"IconUrl\": \"<string>\",\n \"CardTitle\": \"<string>\",\n \"CardDescription\": \"<string>\",\n \"ActionButtonText\": \"<string>\",\n \"ActionButtonUrl\": \"<string>\",\n \"NotifyCustomerWhenPointIsGiven\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bonifiq.com.br/v1/pvt/Objectives/custom")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"Name\": \"<string>\",\n \"AmountOfPoints\": 123,\n \"Active\": true,\n \"CustomerMaxCompletion\": 123,\n \"ShowOnWidgetAndLandingPage\": true,\n \"IconUrl\": \"<string>\",\n \"CardTitle\": \"<string>\",\n \"CardDescription\": \"<string>\",\n \"ActionButtonText\": \"<string>\",\n \"ActionButtonUrl\": \"<string>\",\n \"NotifyCustomerWhenPointIsGiven\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bonifiq.com.br/v1/pvt/Objectives/custom")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Name\": \"<string>\",\n \"AmountOfPoints\": 123,\n \"Active\": true,\n \"CustomerMaxCompletion\": 123,\n \"ShowOnWidgetAndLandingPage\": true,\n \"IconUrl\": \"<string>\",\n \"CardTitle\": \"<string>\",\n \"CardDescription\": \"<string>\",\n \"ActionButtonText\": \"<string>\",\n \"ActionButtonUrl\": \"<string>\",\n \"NotifyCustomerWhenPointIsGiven\": true\n}"
response = http.request(request)
puts response.read_body{
"ErrorMessage": "<string>",
"ErrorCode": 123,
"Result": {
"Id": 123,
"Guid": "<string>",
"Name": "<string>",
"AmountOfPoints": 123,
"Active": true,
"CustomerMaxCompletion": 123,
"ShowOnWidgetAndLandingPage": true,
"IconUrl": "<string>",
"CardTitle": "<string>",
"CardDescription": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"NotifyCustomerWhenPointIsGiven": true,
"CreatedAt": "2023-11-07T05:31:56Z"
},
"Code": "<string>",
"CodeName": "<string>",
"Severity": 0,
"HasWarning": true,
"HasError": true
}Objectives
Creates a custom objective.
The objective is created for the store of the API key and is listed by the objectives list endpoints. Use the returned Guid to reward customers through POST v1/pvt/Objectives//importpoints.
This endpoint is not idempotent: each successful call creates a new objective.
POST
/
v1
/
pvt
/
Objectives
/
custom
Creates a custom objective.
curl --request POST \
--url https://api.bonifiq.com.br/v1/pvt/Objectives/custom \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"Name": "<string>",
"AmountOfPoints": 123,
"Active": true,
"CustomerMaxCompletion": 123,
"ShowOnWidgetAndLandingPage": true,
"IconUrl": "<string>",
"CardTitle": "<string>",
"CardDescription": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"NotifyCustomerWhenPointIsGiven": true
}
'import requests
url = "https://api.bonifiq.com.br/v1/pvt/Objectives/custom"
payload = {
"Name": "<string>",
"AmountOfPoints": 123,
"Active": True,
"CustomerMaxCompletion": 123,
"ShowOnWidgetAndLandingPage": True,
"IconUrl": "<string>",
"CardTitle": "<string>",
"CardDescription": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"NotifyCustomerWhenPointIsGiven": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Name: '<string>',
AmountOfPoints: 123,
Active: true,
CustomerMaxCompletion: 123,
ShowOnWidgetAndLandingPage: true,
IconUrl: '<string>',
CardTitle: '<string>',
CardDescription: '<string>',
ActionButtonText: '<string>',
ActionButtonUrl: '<string>',
NotifyCustomerWhenPointIsGiven: true
})
};
fetch('https://api.bonifiq.com.br/v1/pvt/Objectives/custom', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bonifiq.com.br/v1/pvt/Objectives/custom",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'Name' => '<string>',
'AmountOfPoints' => 123,
'Active' => true,
'CustomerMaxCompletion' => 123,
'ShowOnWidgetAndLandingPage' => true,
'IconUrl' => '<string>',
'CardTitle' => '<string>',
'CardDescription' => '<string>',
'ActionButtonText' => '<string>',
'ActionButtonUrl' => '<string>',
'NotifyCustomerWhenPointIsGiven' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bonifiq.com.br/v1/pvt/Objectives/custom"
payload := strings.NewReader("{\n \"Name\": \"<string>\",\n \"AmountOfPoints\": 123,\n \"Active\": true,\n \"CustomerMaxCompletion\": 123,\n \"ShowOnWidgetAndLandingPage\": true,\n \"IconUrl\": \"<string>\",\n \"CardTitle\": \"<string>\",\n \"CardDescription\": \"<string>\",\n \"ActionButtonText\": \"<string>\",\n \"ActionButtonUrl\": \"<string>\",\n \"NotifyCustomerWhenPointIsGiven\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bonifiq.com.br/v1/pvt/Objectives/custom")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"Name\": \"<string>\",\n \"AmountOfPoints\": 123,\n \"Active\": true,\n \"CustomerMaxCompletion\": 123,\n \"ShowOnWidgetAndLandingPage\": true,\n \"IconUrl\": \"<string>\",\n \"CardTitle\": \"<string>\",\n \"CardDescription\": \"<string>\",\n \"ActionButtonText\": \"<string>\",\n \"ActionButtonUrl\": \"<string>\",\n \"NotifyCustomerWhenPointIsGiven\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bonifiq.com.br/v1/pvt/Objectives/custom")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Name\": \"<string>\",\n \"AmountOfPoints\": 123,\n \"Active\": true,\n \"CustomerMaxCompletion\": 123,\n \"ShowOnWidgetAndLandingPage\": true,\n \"IconUrl\": \"<string>\",\n \"CardTitle\": \"<string>\",\n \"CardDescription\": \"<string>\",\n \"ActionButtonText\": \"<string>\",\n \"ActionButtonUrl\": \"<string>\",\n \"NotifyCustomerWhenPointIsGiven\": true\n}"
response = http.request(request)
puts response.read_body{
"ErrorMessage": "<string>",
"ErrorCode": 123,
"Result": {
"Id": 123,
"Guid": "<string>",
"Name": "<string>",
"AmountOfPoints": 123,
"Active": true,
"CustomerMaxCompletion": 123,
"ShowOnWidgetAndLandingPage": true,
"IconUrl": "<string>",
"CardTitle": "<string>",
"CardDescription": "<string>",
"ActionButtonText": "<string>",
"ActionButtonUrl": "<string>",
"NotifyCustomerWhenPointIsGiven": true,
"CreatedAt": "2023-11-07T05:31:56Z"
},
"Code": "<string>",
"CodeName": "<string>",
"Severity": 0,
"HasWarning": true,
"HasError": true
}Body
application/json
Custom objective data.
Request to create a custom objective. Customers are rewarded later through the import points endpoint (POST v1/pvt/Objectives/{guid}/importpoints), using the Guid returned on creation.
Response
200 - application/json
The created custom objective, including its Guid.
Standard response envelope used by the External API.
Was this page helpful?