Create
Create a pay config.
The config is created as a draft, and becomes visible to everyone in the organisation once a report that prices against it is published.
curl --request POST \
--url https://api.incident.io/v2/pay_configs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_rate_cents": 1200,
"currency": "GBP",
"name": "Engineering on-call",
"one_off_rules": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
],
"rate_time_unit": "hour",
"timezone": "Europe/London",
"weekly_rules": [
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": [
"monday"
]
}
]
}
'import requests
url = "https://api.incident.io/v2/pay_configs"
payload = {
"base_rate_cents": 1200,
"currency": "GBP",
"name": "Engineering on-call",
"one_off_rules": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
],
"rate_time_unit": "hour",
"timezone": "Europe/London",
"weekly_rules": [
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": ["monday"]
}
]
}
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({
base_rate_cents: 1200,
currency: 'GBP',
name: 'Engineering on-call',
one_off_rules: [
{
end_at: '2021-08-17T13:28:57.801578Z',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
name: 'Christmas day',
rate_cents: 4800,
start_at: '2021-08-17T13:28:57.801578Z'
}
],
rate_time_unit: 'hour',
timezone: 'Europe/London',
weekly_rules: [
{
end_time: '17:00',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
rate_cents: 2400,
start_time: '09:00',
weekdays: ['monday']
}
]
})
};
fetch('https://api.incident.io/v2/pay_configs', 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.incident.io/v2/pay_configs",
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([
'base_rate_cents' => 1200,
'currency' => 'GBP',
'name' => 'Engineering on-call',
'one_off_rules' => [
[
'end_at' => '2021-08-17T13:28:57.801578Z',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'name' => 'Christmas day',
'rate_cents' => 4800,
'start_at' => '2021-08-17T13:28:57.801578Z'
]
],
'rate_time_unit' => 'hour',
'timezone' => 'Europe/London',
'weekly_rules' => [
[
'end_time' => '17:00',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'rate_cents' => 2400,
'start_time' => '09:00',
'weekdays' => [
'monday'
]
]
]
]),
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://api.incident.io/v2/pay_configs"
payload := strings.NewReader("{\n \"base_rate_cents\": 1200,\n \"currency\": \"GBP\",\n \"name\": \"Engineering on-call\",\n \"one_off_rules\": [\n {\n \"end_at\": \"2021-08-17T13:28:57.801578Z\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Christmas day\",\n \"rate_cents\": 4800,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n }\n ],\n \"rate_time_unit\": \"hour\",\n \"timezone\": \"Europe/London\",\n \"weekly_rules\": [\n {\n \"end_time\": \"17:00\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"rate_cents\": 2400,\n \"start_time\": \"09:00\",\n \"weekdays\": [\n \"monday\"\n ]\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://api.incident.io/v2/pay_configs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_rate_cents\": 1200,\n \"currency\": \"GBP\",\n \"name\": \"Engineering on-call\",\n \"one_off_rules\": [\n {\n \"end_at\": \"2021-08-17T13:28:57.801578Z\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Christmas day\",\n \"rate_cents\": 4800,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n }\n ],\n \"rate_time_unit\": \"hour\",\n \"timezone\": \"Europe/London\",\n \"weekly_rules\": [\n {\n \"end_time\": \"17:00\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"rate_cents\": 2400,\n \"start_time\": \"09:00\",\n \"weekdays\": [\n \"monday\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/pay_configs")
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 \"base_rate_cents\": 1200,\n \"currency\": \"GBP\",\n \"name\": \"Engineering on-call\",\n \"one_off_rules\": [\n {\n \"end_at\": \"2021-08-17T13:28:57.801578Z\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Christmas day\",\n \"rate_cents\": 4800,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n }\n ],\n \"rate_time_unit\": \"hour\",\n \"timezone\": \"Europe/London\",\n \"weekly_rules\": [\n {\n \"end_time\": \"17:00\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"rate_cents\": 2400,\n \"start_time\": \"09:00\",\n \"weekdays\": [\n \"monday\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"pay_config": {
"base_rate_cents": 1200,
"created_at": "2021-08-17T13:28:57.801578Z",
"currency": "GBP",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Engineering on-call",
"one_off_rules": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
],
"published_at": "2021-08-17T13:28:57.801578Z",
"rate_time_unit": "hour",
"timezone": "Europe/London",
"updated_at": "2021-08-17T13:28:57.801578Z",
"weekly_rules": [
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": [
"monday"
]
}
]
}
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}schedule_pay_configs.create scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
Rate paid for any time no rule covers, in the lowest denomination of the currency
1200
Currency this config pays in, in ISO 4217 format
"GBP"
Human readable name for this pay config
"Engineering on-call"
The unit of time every rate on this config is quoted per
hour, day "hour"
IANA timezone this config's rules are interpreted in
"Europe/London"
Rules that apply over a single window of time
Show child attributes
Show child attributes
[
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
]
Rules that apply every week, in the order they should be evaluated
Show child attributes
Show child attributes
[
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": ["monday"]
}
]
Response
Created response.
A pay config sets what someone is paid for being on call: a base rate, plus rules that override it at particular times. An on-call pay report prices each person's shifts against one.
Rules are evaluated in the order they are returned, and the first one that covers a shift wins. Any time no rule covers is paid at the base rate.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.incident.io/v2/pay_configs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_rate_cents": 1200,
"currency": "GBP",
"name": "Engineering on-call",
"one_off_rules": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
],
"rate_time_unit": "hour",
"timezone": "Europe/London",
"weekly_rules": [
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": [
"monday"
]
}
]
}
'import requests
url = "https://api.incident.io/v2/pay_configs"
payload = {
"base_rate_cents": 1200,
"currency": "GBP",
"name": "Engineering on-call",
"one_off_rules": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
],
"rate_time_unit": "hour",
"timezone": "Europe/London",
"weekly_rules": [
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": ["monday"]
}
]
}
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({
base_rate_cents: 1200,
currency: 'GBP',
name: 'Engineering on-call',
one_off_rules: [
{
end_at: '2021-08-17T13:28:57.801578Z',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
name: 'Christmas day',
rate_cents: 4800,
start_at: '2021-08-17T13:28:57.801578Z'
}
],
rate_time_unit: 'hour',
timezone: 'Europe/London',
weekly_rules: [
{
end_time: '17:00',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
rate_cents: 2400,
start_time: '09:00',
weekdays: ['monday']
}
]
})
};
fetch('https://api.incident.io/v2/pay_configs', 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.incident.io/v2/pay_configs",
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([
'base_rate_cents' => 1200,
'currency' => 'GBP',
'name' => 'Engineering on-call',
'one_off_rules' => [
[
'end_at' => '2021-08-17T13:28:57.801578Z',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'name' => 'Christmas day',
'rate_cents' => 4800,
'start_at' => '2021-08-17T13:28:57.801578Z'
]
],
'rate_time_unit' => 'hour',
'timezone' => 'Europe/London',
'weekly_rules' => [
[
'end_time' => '17:00',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'rate_cents' => 2400,
'start_time' => '09:00',
'weekdays' => [
'monday'
]
]
]
]),
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://api.incident.io/v2/pay_configs"
payload := strings.NewReader("{\n \"base_rate_cents\": 1200,\n \"currency\": \"GBP\",\n \"name\": \"Engineering on-call\",\n \"one_off_rules\": [\n {\n \"end_at\": \"2021-08-17T13:28:57.801578Z\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Christmas day\",\n \"rate_cents\": 4800,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n }\n ],\n \"rate_time_unit\": \"hour\",\n \"timezone\": \"Europe/London\",\n \"weekly_rules\": [\n {\n \"end_time\": \"17:00\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"rate_cents\": 2400,\n \"start_time\": \"09:00\",\n \"weekdays\": [\n \"monday\"\n ]\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://api.incident.io/v2/pay_configs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_rate_cents\": 1200,\n \"currency\": \"GBP\",\n \"name\": \"Engineering on-call\",\n \"one_off_rules\": [\n {\n \"end_at\": \"2021-08-17T13:28:57.801578Z\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Christmas day\",\n \"rate_cents\": 4800,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n }\n ],\n \"rate_time_unit\": \"hour\",\n \"timezone\": \"Europe/London\",\n \"weekly_rules\": [\n {\n \"end_time\": \"17:00\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"rate_cents\": 2400,\n \"start_time\": \"09:00\",\n \"weekdays\": [\n \"monday\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/pay_configs")
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 \"base_rate_cents\": 1200,\n \"currency\": \"GBP\",\n \"name\": \"Engineering on-call\",\n \"one_off_rules\": [\n {\n \"end_at\": \"2021-08-17T13:28:57.801578Z\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Christmas day\",\n \"rate_cents\": 4800,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n }\n ],\n \"rate_time_unit\": \"hour\",\n \"timezone\": \"Europe/London\",\n \"weekly_rules\": [\n {\n \"end_time\": \"17:00\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"rate_cents\": 2400,\n \"start_time\": \"09:00\",\n \"weekdays\": [\n \"monday\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"pay_config": {
"base_rate_cents": 1200,
"created_at": "2021-08-17T13:28:57.801578Z",
"currency": "GBP",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Engineering on-call",
"one_off_rules": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Christmas day",
"rate_cents": 4800,
"start_at": "2021-08-17T13:28:57.801578Z"
}
],
"published_at": "2021-08-17T13:28:57.801578Z",
"rate_time_unit": "hour",
"timezone": "Europe/London",
"updated_at": "2021-08-17T13:28:57.801578Z",
"weekly_rules": [
{
"end_time": "17:00",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rate_cents": 2400,
"start_time": "09:00",
"weekdays": [
"monday"
]
}
]
}
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}