Files
Start a batch import for relationships
POST
/
admin
/
import
/
relationships
/
batch
Start a batch import for relationships
curl --request POST \
--url https://api.gratona.com/v1/admin/import/relationships/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"original_filename": "<string>",
"csv_entity_field": "<string>",
"entity_field": "<string>",
"csv_donor_field": "<string>",
"donor_field": "<string>",
"csv_commitment_field": "<string>",
"csv_date_field": "<string>",
"csv_frequency_field": "<string>",
"csv_payment_method_field": "<string>",
"is_per_period_amount": true,
"program_id": 123,
"update_sponsorship": true
}
'import requests
url = "https://api.gratona.com/v1/admin/import/relationships/batch"
payload = {
"filename": "<string>",
"original_filename": "<string>",
"csv_entity_field": "<string>",
"entity_field": "<string>",
"csv_donor_field": "<string>",
"donor_field": "<string>",
"csv_commitment_field": "<string>",
"csv_date_field": "<string>",
"csv_frequency_field": "<string>",
"csv_payment_method_field": "<string>",
"is_per_period_amount": True,
"program_id": 123,
"update_sponsorship": 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({
filename: '<string>',
original_filename: '<string>',
csv_entity_field: '<string>',
entity_field: '<string>',
csv_donor_field: '<string>',
donor_field: '<string>',
csv_commitment_field: '<string>',
csv_date_field: '<string>',
csv_frequency_field: '<string>',
csv_payment_method_field: '<string>',
is_per_period_amount: true,
program_id: 123,
update_sponsorship: true
})
};
fetch('https://api.gratona.com/v1/admin/import/relationships/batch', 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/import/relationships/batch",
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([
'filename' => '<string>',
'original_filename' => '<string>',
'csv_entity_field' => '<string>',
'entity_field' => '<string>',
'csv_donor_field' => '<string>',
'donor_field' => '<string>',
'csv_commitment_field' => '<string>',
'csv_date_field' => '<string>',
'csv_frequency_field' => '<string>',
'csv_payment_method_field' => '<string>',
'is_per_period_amount' => true,
'program_id' => 123,
'update_sponsorship' => 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://api.gratona.com/v1/admin/import/relationships/batch"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"original_filename\": \"<string>\",\n \"csv_entity_field\": \"<string>\",\n \"entity_field\": \"<string>\",\n \"csv_donor_field\": \"<string>\",\n \"donor_field\": \"<string>\",\n \"csv_commitment_field\": \"<string>\",\n \"csv_date_field\": \"<string>\",\n \"csv_frequency_field\": \"<string>\",\n \"csv_payment_method_field\": \"<string>\",\n \"is_per_period_amount\": true,\n \"program_id\": 123,\n \"update_sponsorship\": true\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.gratona.com/v1/admin/import/relationships/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"original_filename\": \"<string>\",\n \"csv_entity_field\": \"<string>\",\n \"entity_field\": \"<string>\",\n \"csv_donor_field\": \"<string>\",\n \"donor_field\": \"<string>\",\n \"csv_commitment_field\": \"<string>\",\n \"csv_date_field\": \"<string>\",\n \"csv_frequency_field\": \"<string>\",\n \"csv_payment_method_field\": \"<string>\",\n \"is_per_period_amount\": true,\n \"program_id\": 123,\n \"update_sponsorship\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/import/relationships/batch")
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 \"filename\": \"<string>\",\n \"original_filename\": \"<string>\",\n \"csv_entity_field\": \"<string>\",\n \"entity_field\": \"<string>\",\n \"csv_donor_field\": \"<string>\",\n \"donor_field\": \"<string>\",\n \"csv_commitment_field\": \"<string>\",\n \"csv_date_field\": \"<string>\",\n \"csv_frequency_field\": \"<string>\",\n \"csv_payment_method_field\": \"<string>\",\n \"is_per_period_amount\": true,\n \"program_id\": 123,\n \"update_sponsorship\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Relationship import batch has been started.",
"batch_id": 123
}Authorizations
bearerAuthapiKeyAuth
Passport bearer token authentication for legacy admin sessions.
Body
application/json
S3 filename of the CSV
Original uploaded filename
CSV header name for entity identifier
Gratona entity field key used for matching
CSV header name for donor identifier
Gratona donor field key used for matching
CSV header name for commitment amount
CSV header name for date
CSV header name for frequency (accepted values: monthly, bi_weekly, 2_months, 3_months, 6_months, yearly)
CSV header name for payment method (accepted values: credit_card, bank_transfer, cash, check, wire_transfer, paypal, external)
Whether the commitment amount is the charge per billing period. Defaults to false, meaning monthly base amount.
Program ID
Whether to update existing sponsorships
⌘I
Start a batch import for relationships
curl --request POST \
--url https://api.gratona.com/v1/admin/import/relationships/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"original_filename": "<string>",
"csv_entity_field": "<string>",
"entity_field": "<string>",
"csv_donor_field": "<string>",
"donor_field": "<string>",
"csv_commitment_field": "<string>",
"csv_date_field": "<string>",
"csv_frequency_field": "<string>",
"csv_payment_method_field": "<string>",
"is_per_period_amount": true,
"program_id": 123,
"update_sponsorship": true
}
'import requests
url = "https://api.gratona.com/v1/admin/import/relationships/batch"
payload = {
"filename": "<string>",
"original_filename": "<string>",
"csv_entity_field": "<string>",
"entity_field": "<string>",
"csv_donor_field": "<string>",
"donor_field": "<string>",
"csv_commitment_field": "<string>",
"csv_date_field": "<string>",
"csv_frequency_field": "<string>",
"csv_payment_method_field": "<string>",
"is_per_period_amount": True,
"program_id": 123,
"update_sponsorship": 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({
filename: '<string>',
original_filename: '<string>',
csv_entity_field: '<string>',
entity_field: '<string>',
csv_donor_field: '<string>',
donor_field: '<string>',
csv_commitment_field: '<string>',
csv_date_field: '<string>',
csv_frequency_field: '<string>',
csv_payment_method_field: '<string>',
is_per_period_amount: true,
program_id: 123,
update_sponsorship: true
})
};
fetch('https://api.gratona.com/v1/admin/import/relationships/batch', 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/import/relationships/batch",
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([
'filename' => '<string>',
'original_filename' => '<string>',
'csv_entity_field' => '<string>',
'entity_field' => '<string>',
'csv_donor_field' => '<string>',
'donor_field' => '<string>',
'csv_commitment_field' => '<string>',
'csv_date_field' => '<string>',
'csv_frequency_field' => '<string>',
'csv_payment_method_field' => '<string>',
'is_per_period_amount' => true,
'program_id' => 123,
'update_sponsorship' => 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://api.gratona.com/v1/admin/import/relationships/batch"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"original_filename\": \"<string>\",\n \"csv_entity_field\": \"<string>\",\n \"entity_field\": \"<string>\",\n \"csv_donor_field\": \"<string>\",\n \"donor_field\": \"<string>\",\n \"csv_commitment_field\": \"<string>\",\n \"csv_date_field\": \"<string>\",\n \"csv_frequency_field\": \"<string>\",\n \"csv_payment_method_field\": \"<string>\",\n \"is_per_period_amount\": true,\n \"program_id\": 123,\n \"update_sponsorship\": true\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.gratona.com/v1/admin/import/relationships/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"original_filename\": \"<string>\",\n \"csv_entity_field\": \"<string>\",\n \"entity_field\": \"<string>\",\n \"csv_donor_field\": \"<string>\",\n \"donor_field\": \"<string>\",\n \"csv_commitment_field\": \"<string>\",\n \"csv_date_field\": \"<string>\",\n \"csv_frequency_field\": \"<string>\",\n \"csv_payment_method_field\": \"<string>\",\n \"is_per_period_amount\": true,\n \"program_id\": 123,\n \"update_sponsorship\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/import/relationships/batch")
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 \"filename\": \"<string>\",\n \"original_filename\": \"<string>\",\n \"csv_entity_field\": \"<string>\",\n \"entity_field\": \"<string>\",\n \"csv_donor_field\": \"<string>\",\n \"donor_field\": \"<string>\",\n \"csv_commitment_field\": \"<string>\",\n \"csv_date_field\": \"<string>\",\n \"csv_frequency_field\": \"<string>\",\n \"csv_payment_method_field\": \"<string>\",\n \"is_per_period_amount\": true,\n \"program_id\": 123,\n \"update_sponsorship\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Relationship import batch has been started.",
"batch_id": 123
}