curl --request POST \
--url https://schoolmaker.co/api/v1/offers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"title": "<string>",
"description": "<string>",
"long_description": "<string>",
"is_published": true,
"is_access_program_shown": true,
"is_search_engine_indexing_enabled": true,
"max_purchase_amount": 1,
"trial_period_days": 1,
"trial_period_days_multiplier": 1,
"settings_allow_multiple_purchase": true,
"accesses_attributes": [
{
"id": "<string>",
"element_id": "<string>",
"end_delay": 2,
"quantity": 2,
"quantity_hours": 1,
"quantity_minutes": 1,
"_destroy": true,
"lesson_ids": [
"<string>"
]
}
],
"prices_attributes": [
{
"id": "<string>",
"recurring_interval_count": 2,
"recurring_iterations": 3,
"amount": 1,
"_destroy": true
}
]
}
'import requests
url = "https://schoolmaker.co/api/v1/offers"
payload = {
"name": "<string>",
"title": "<string>",
"description": "<string>",
"long_description": "<string>",
"is_published": True,
"is_access_program_shown": True,
"is_search_engine_indexing_enabled": True,
"max_purchase_amount": 1,
"trial_period_days": 1,
"trial_period_days_multiplier": 1,
"settings_allow_multiple_purchase": True,
"accesses_attributes": [
{
"id": "<string>",
"element_id": "<string>",
"end_delay": 2,
"quantity": 2,
"quantity_hours": 1,
"quantity_minutes": 1,
"_destroy": True,
"lesson_ids": ["<string>"]
}
],
"prices_attributes": [
{
"id": "<string>",
"recurring_interval_count": 2,
"recurring_iterations": 3,
"amount": 1,
"_destroy": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
title: '<string>',
description: '<string>',
long_description: '<string>',
is_published: true,
is_access_program_shown: true,
is_search_engine_indexing_enabled: true,
max_purchase_amount: 1,
trial_period_days: 1,
trial_period_days_multiplier: 1,
settings_allow_multiple_purchase: true,
accesses_attributes: [
{
id: '<string>',
element_id: '<string>',
end_delay: 2,
quantity: 2,
quantity_hours: 1,
quantity_minutes: 1,
_destroy: true,
lesson_ids: ['<string>']
}
],
prices_attributes: [
{
id: '<string>',
recurring_interval_count: 2,
recurring_iterations: 3,
amount: 1,
_destroy: true
}
]
})
};
fetch('https://schoolmaker.co/api/v1/offers', 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://schoolmaker.co/api/v1/offers",
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>',
'title' => '<string>',
'description' => '<string>',
'long_description' => '<string>',
'is_published' => true,
'is_access_program_shown' => true,
'is_search_engine_indexing_enabled' => true,
'max_purchase_amount' => 1,
'trial_period_days' => 1,
'trial_period_days_multiplier' => 1,
'settings_allow_multiple_purchase' => true,
'accesses_attributes' => [
[
'id' => '<string>',
'element_id' => '<string>',
'end_delay' => 2,
'quantity' => 2,
'quantity_hours' => 1,
'quantity_minutes' => 1,
'_destroy' => true,
'lesson_ids' => [
'<string>'
]
]
],
'prices_attributes' => [
[
'id' => '<string>',
'recurring_interval_count' => 2,
'recurring_iterations' => 3,
'amount' => 1,
'_destroy' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://schoolmaker.co/api/v1/offers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"long_description\": \"<string>\",\n \"is_published\": true,\n \"is_access_program_shown\": true,\n \"is_search_engine_indexing_enabled\": true,\n \"max_purchase_amount\": 1,\n \"trial_period_days\": 1,\n \"trial_period_days_multiplier\": 1,\n \"settings_allow_multiple_purchase\": true,\n \"accesses_attributes\": [\n {\n \"id\": \"<string>\",\n \"element_id\": \"<string>\",\n \"end_delay\": 2,\n \"quantity\": 2,\n \"quantity_hours\": 1,\n \"quantity_minutes\": 1,\n \"_destroy\": true,\n \"lesson_ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prices_attributes\": [\n {\n \"id\": \"<string>\",\n \"recurring_interval_count\": 2,\n \"recurring_iterations\": 3,\n \"amount\": 1,\n \"_destroy\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://schoolmaker.co/api/v1/offers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"long_description\": \"<string>\",\n \"is_published\": true,\n \"is_access_program_shown\": true,\n \"is_search_engine_indexing_enabled\": true,\n \"max_purchase_amount\": 1,\n \"trial_period_days\": 1,\n \"trial_period_days_multiplier\": 1,\n \"settings_allow_multiple_purchase\": true,\n \"accesses_attributes\": [\n {\n \"id\": \"<string>\",\n \"element_id\": \"<string>\",\n \"end_delay\": 2,\n \"quantity\": 2,\n \"quantity_hours\": 1,\n \"quantity_minutes\": 1,\n \"_destroy\": true,\n \"lesson_ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prices_attributes\": [\n {\n \"id\": \"<string>\",\n \"recurring_interval_count\": 2,\n \"recurring_iterations\": 3,\n \"amount\": 1,\n \"_destroy\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://schoolmaker.co/api/v1/offers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"long_description\": \"<string>\",\n \"is_published\": true,\n \"is_access_program_shown\": true,\n \"is_search_engine_indexing_enabled\": true,\n \"max_purchase_amount\": 1,\n \"trial_period_days\": 1,\n \"trial_period_days_multiplier\": 1,\n \"settings_allow_multiple_purchase\": true,\n \"accesses_attributes\": [\n {\n \"id\": \"<string>\",\n \"element_id\": \"<string>\",\n \"end_delay\": 2,\n \"quantity\": 2,\n \"quantity_hours\": 1,\n \"quantity_minutes\": 1,\n \"_destroy\": true,\n \"lesson_ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prices_attributes\": [\n {\n \"id\": \"<string>\",\n \"recurring_interval_count\": 2,\n \"recurring_iterations\": 3,\n \"amount\": 1,\n \"_destroy\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"title": "<string>",
"long_description": "<string>",
"is_published": true,
"is_access_program_shown": true,
"is_search_engine_indexing_enabled": true,
"max_purchase_amount": 123,
"trial_period_days": 123,
"trial_period_days_multiplier": 123,
"settings_allow_multiple_purchase": true,
"id": "<string>",
"image_cover_url": "<string>",
"accesses": [
{
"id": "<string>",
"element_id": "<string>",
"element_type": "<string>",
"access_type": "<string>",
"end_delay": 123,
"quantity": 123,
"lessons": [
{
"id": "<string>",
"is_enabled": true
}
]
}
],
"prices": [
{
"id": "<string>",
"amount": 123,
"price_type": "<string>",
"recurring_interval": "<string>",
"recurring_interval_count": 123,
"recurring_iterations": 123
}
]
}{
"error": "Access denied"
}{
"error": "Record not found"
}{
"error": "Invalid arguments: /attributes/name minLength"
}Create an Offer
Creates an offer with its settings, accesses and prices. Offers are unpublished by default.
curl --request POST \
--url https://schoolmaker.co/api/v1/offers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"title": "<string>",
"description": "<string>",
"long_description": "<string>",
"is_published": true,
"is_access_program_shown": true,
"is_search_engine_indexing_enabled": true,
"max_purchase_amount": 1,
"trial_period_days": 1,
"trial_period_days_multiplier": 1,
"settings_allow_multiple_purchase": true,
"accesses_attributes": [
{
"id": "<string>",
"element_id": "<string>",
"end_delay": 2,
"quantity": 2,
"quantity_hours": 1,
"quantity_minutes": 1,
"_destroy": true,
"lesson_ids": [
"<string>"
]
}
],
"prices_attributes": [
{
"id": "<string>",
"recurring_interval_count": 2,
"recurring_iterations": 3,
"amount": 1,
"_destroy": true
}
]
}
'import requests
url = "https://schoolmaker.co/api/v1/offers"
payload = {
"name": "<string>",
"title": "<string>",
"description": "<string>",
"long_description": "<string>",
"is_published": True,
"is_access_program_shown": True,
"is_search_engine_indexing_enabled": True,
"max_purchase_amount": 1,
"trial_period_days": 1,
"trial_period_days_multiplier": 1,
"settings_allow_multiple_purchase": True,
"accesses_attributes": [
{
"id": "<string>",
"element_id": "<string>",
"end_delay": 2,
"quantity": 2,
"quantity_hours": 1,
"quantity_minutes": 1,
"_destroy": True,
"lesson_ids": ["<string>"]
}
],
"prices_attributes": [
{
"id": "<string>",
"recurring_interval_count": 2,
"recurring_iterations": 3,
"amount": 1,
"_destroy": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
title: '<string>',
description: '<string>',
long_description: '<string>',
is_published: true,
is_access_program_shown: true,
is_search_engine_indexing_enabled: true,
max_purchase_amount: 1,
trial_period_days: 1,
trial_period_days_multiplier: 1,
settings_allow_multiple_purchase: true,
accesses_attributes: [
{
id: '<string>',
element_id: '<string>',
end_delay: 2,
quantity: 2,
quantity_hours: 1,
quantity_minutes: 1,
_destroy: true,
lesson_ids: ['<string>']
}
],
prices_attributes: [
{
id: '<string>',
recurring_interval_count: 2,
recurring_iterations: 3,
amount: 1,
_destroy: true
}
]
})
};
fetch('https://schoolmaker.co/api/v1/offers', 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://schoolmaker.co/api/v1/offers",
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>',
'title' => '<string>',
'description' => '<string>',
'long_description' => '<string>',
'is_published' => true,
'is_access_program_shown' => true,
'is_search_engine_indexing_enabled' => true,
'max_purchase_amount' => 1,
'trial_period_days' => 1,
'trial_period_days_multiplier' => 1,
'settings_allow_multiple_purchase' => true,
'accesses_attributes' => [
[
'id' => '<string>',
'element_id' => '<string>',
'end_delay' => 2,
'quantity' => 2,
'quantity_hours' => 1,
'quantity_minutes' => 1,
'_destroy' => true,
'lesson_ids' => [
'<string>'
]
]
],
'prices_attributes' => [
[
'id' => '<string>',
'recurring_interval_count' => 2,
'recurring_iterations' => 3,
'amount' => 1,
'_destroy' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://schoolmaker.co/api/v1/offers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"long_description\": \"<string>\",\n \"is_published\": true,\n \"is_access_program_shown\": true,\n \"is_search_engine_indexing_enabled\": true,\n \"max_purchase_amount\": 1,\n \"trial_period_days\": 1,\n \"trial_period_days_multiplier\": 1,\n \"settings_allow_multiple_purchase\": true,\n \"accesses_attributes\": [\n {\n \"id\": \"<string>\",\n \"element_id\": \"<string>\",\n \"end_delay\": 2,\n \"quantity\": 2,\n \"quantity_hours\": 1,\n \"quantity_minutes\": 1,\n \"_destroy\": true,\n \"lesson_ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prices_attributes\": [\n {\n \"id\": \"<string>\",\n \"recurring_interval_count\": 2,\n \"recurring_iterations\": 3,\n \"amount\": 1,\n \"_destroy\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://schoolmaker.co/api/v1/offers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"long_description\": \"<string>\",\n \"is_published\": true,\n \"is_access_program_shown\": true,\n \"is_search_engine_indexing_enabled\": true,\n \"max_purchase_amount\": 1,\n \"trial_period_days\": 1,\n \"trial_period_days_multiplier\": 1,\n \"settings_allow_multiple_purchase\": true,\n \"accesses_attributes\": [\n {\n \"id\": \"<string>\",\n \"element_id\": \"<string>\",\n \"end_delay\": 2,\n \"quantity\": 2,\n \"quantity_hours\": 1,\n \"quantity_minutes\": 1,\n \"_destroy\": true,\n \"lesson_ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prices_attributes\": [\n {\n \"id\": \"<string>\",\n \"recurring_interval_count\": 2,\n \"recurring_iterations\": 3,\n \"amount\": 1,\n \"_destroy\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://schoolmaker.co/api/v1/offers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"long_description\": \"<string>\",\n \"is_published\": true,\n \"is_access_program_shown\": true,\n \"is_search_engine_indexing_enabled\": true,\n \"max_purchase_amount\": 1,\n \"trial_period_days\": 1,\n \"trial_period_days_multiplier\": 1,\n \"settings_allow_multiple_purchase\": true,\n \"accesses_attributes\": [\n {\n \"id\": \"<string>\",\n \"element_id\": \"<string>\",\n \"end_delay\": 2,\n \"quantity\": 2,\n \"quantity_hours\": 1,\n \"quantity_minutes\": 1,\n \"_destroy\": true,\n \"lesson_ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prices_attributes\": [\n {\n \"id\": \"<string>\",\n \"recurring_interval_count\": 2,\n \"recurring_iterations\": 3,\n \"amount\": 1,\n \"_destroy\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"title": "<string>",
"long_description": "<string>",
"is_published": true,
"is_access_program_shown": true,
"is_search_engine_indexing_enabled": true,
"max_purchase_amount": 123,
"trial_period_days": 123,
"trial_period_days_multiplier": 123,
"settings_allow_multiple_purchase": true,
"id": "<string>",
"image_cover_url": "<string>",
"accesses": [
{
"id": "<string>",
"element_id": "<string>",
"element_type": "<string>",
"access_type": "<string>",
"end_delay": 123,
"quantity": 123,
"lessons": [
{
"id": "<string>",
"is_enabled": true
}
]
}
],
"prices": [
{
"id": "<string>",
"amount": 123,
"price_type": "<string>",
"recurring_interval": "<string>",
"recurring_interval_count": 123,
"recurring_iterations": 123
}
]
}{
"error": "Access denied"
}{
"error": "Record not found"
}{
"error": "Invalid arguments: /attributes/name minLength"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
- Option 1
- Option 2
Offer details, accesses and prices.
Offer name. Required when creating and cannot be blank.
1 - 255255200000Formatted offer description. Omit to keep the current description or use null to clear it.
200000Whether the offer and payment pages are published. Unpublishing keeps member accesses. Deleting the offer removes them.
Omit to keep the current value. Cannot be null on update.
Omit to keep the current value. Cannot be null on update.
Omit to keep the current value. Cannot be null on update.
x >= 0x >= 0x >= 0100Show child attributes
Show child attributes
Add prices without an ID. Existing amounts and billing terms cannot be changed. To archive a price, supply its id and _destroy: true. Existing purchases are kept.
20Show child attributes
Show child attributes
Format of long_description. Defaults to HTML. Markdown is also supported.
html, markdown Response
Successful response.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?