Trips
Apply a task template to a trip
Task templates belong to the authenticated organization. Applying a template requires a trip start date, offsets due dates from that date, creates tasks in template order and resolves dependencies from earlier template indexes.
POST
/
admin
/
trips
/
{tripId}
/
apply-template
/
{templateId}
Apply a task template to a trip
curl --request POST \
--url https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}', 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.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "Saved successfully.",
"data": {
"tasks_created": 123,
"tasks": [
{
"title": "<string>",
"task_type": "standard",
"document_path": "<string>",
"document_name": "<string>",
"description": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"is_required": true,
"requires_document": true,
"requires_approval": true,
"depends_on_task_id": 123,
"sort_order": 1,
"reminder_days_before": 0,
"reminders": [
{
"days_before": 0,
"send_at_date": "2023-11-07T05:31:56Z"
}
],
"depends_on_task_ids": [
123
],
"dependency_mode": "and",
"target_role": "all",
"target_minors_only": true,
"target_guardians_only": true,
"target_tags_include": [
"<string>"
],
"target_tags_exclude": [
"<string>"
],
"id": 123,
"trip_id": 123,
"document_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"completion_count": 123,
"total_participants": 123,
"completion_percent": 123,
"depends_on_task": {
"id": 123,
"title": "<string>"
},
"target_tags": [
{
"id": 123,
"trip_task_id": 123,
"tag": "<string>",
"mode": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}
]
}
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}Authorizations
bearerAuthapiKeyAuth
Passport bearer token authentication for legacy admin sessions.
Path Parameters
Trip ID belonging to the authenticated organization.
Dropbox Sign template ID.
⌘I
Apply a task template to a trip
curl --request POST \
--url https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}', 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.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/trips/{tripId}/apply-template/{templateId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "Saved successfully.",
"data": {
"tasks_created": 123,
"tasks": [
{
"title": "<string>",
"task_type": "standard",
"document_path": "<string>",
"document_name": "<string>",
"description": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"is_required": true,
"requires_document": true,
"requires_approval": true,
"depends_on_task_id": 123,
"sort_order": 1,
"reminder_days_before": 0,
"reminders": [
{
"days_before": 0,
"send_at_date": "2023-11-07T05:31:56Z"
}
],
"depends_on_task_ids": [
123
],
"dependency_mode": "and",
"target_role": "all",
"target_minors_only": true,
"target_guardians_only": true,
"target_tags_include": [
"<string>"
],
"target_tags_exclude": [
"<string>"
],
"id": 123,
"trip_id": 123,
"document_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"completion_count": 123,
"total_participants": 123,
"completion_percent": 123,
"depends_on_task": {
"id": 123,
"title": "<string>"
},
"target_tags": [
{
"id": 123,
"trip_task_id": 123,
"tag": "<string>",
"mode": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}
]
}
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}