Introduction
This documentation aims to provide all the information you need to work with Site API.
To make POST request you need to send a csrf token with the request. It is handled automatically with most of JS frameworks
https://laravel.com/docs/13.x/csrf#csrf-x-csrf-token
Authenticating requests
This API is not authenticated.
Helper APIs
CSRF cookie
requires authentication
Return an empty response simply to trigger the storage of the CSRF cookie in the browser.
Site State
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/site_state" \
--header "Accept: application/json"const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/site_state"
);
const headers = {
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/site_state'
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/site_state';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"site_id": "abc", ...
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Is Authenticated
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/is_authenticated" \
--header "Accept: application/json"const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/is_authenticated"
);
const headers = {
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/is_authenticated'
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/is_authenticated';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": {
"is_authenticated": true,
"visitor_id": "1abc"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Client Config
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/client_config" \
--header "Accept: application/json"const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/client_config"
);
const headers = {
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/client_config'
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/client_config';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"post_max_size": "8 MiB",...
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mime Type Mapping
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/mime_types_mapping" \
--header "Accept: application/json"const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/mime_types_mapping"
);
const headers = {
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/mime_types_mapping'
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/mime_types_mapping';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{"success":true,"data":{"1km":"application\/vnd.1000minds.decision-model+xml",...
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor State
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/get_visitor_state" \
--header "Accept: application/json"const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/get_visitor_state"
);
const headers = {
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/get_visitor_state'
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/get_visitor_state';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"visitor_id": "131NUHD9mqeCuNGrchfvFp4ZWeBWRNk6hF",
"is_site_admin": false,
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Records and Resources
Site API Query Endpoint
requires authentication
Endpoint to query local or peer database
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/query_endpoint" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"query_parameters\": \"Json body of query parameters - {\\\"table\\\":\\\"posts\\\",\\\"where\\\":[[\\\"title\\\",\\\"!=\\\",\\\"excluded_title\\\"]]}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/query_endpoint"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"query_parameters": "Json body of query parameters - {\"table\":\"posts\",\"where\":[[\"title\",\"!=\",\"excluded_title\"]]}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/query_endpoint'
payload = {
"query_parameters": "Json body of query parameters - {\"table\":\"posts\",\"where\":[[\"title\",\"!=\",\"excluded_title\"]]}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/query_endpoint';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'query_parameters' => 'Json body of query parameters - {"table":"posts","where":[["title","!=","excluded_title"]]}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"body": "Post body"
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Visitor Files
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/visitor_files" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"query_parameters\": \"{\\\"visitor_id\\\":\\\"hwy4phcbfbigqgr5duodyntqcz34ypr2bdwx6d3oa36rsuvujt7a\\\"}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/visitor_files"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"query_parameters": "{\"visitor_id\":\"hwy4phcbfbigqgr5duodyntqcz34ypr2bdwx6d3oa36rsuvujt7a\"}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_files'
payload = {
"query_parameters": "{\"visitor_id\":\"hwy4phcbfbigqgr5duodyntqcz34ypr2bdwx6d3oa36rsuvujt7a\"}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_files';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'query_parameters' => '{"visitor_id":"hwy4phcbfbigqgr5duodyntqcz34ypr2bdwx6d3oa36rsuvujt7a"}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"entity_id": "2026...",
"original_file_name": "..."
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Serve Visitor File
Get contents of Visitor Resource (File) by specifing id of previously uploaded file
Example request:
curl --request GET \
--get "http://site_id.snet.localhost:15080/visitor_file/20261216121630346240_hwy4..."const url = new URL(
"http://site_id.snet.localhost:15080/visitor_file/20261216121630346240_hwy4..."
);
fetch(url, {
method: "GET",
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/visitor_file/20261216121630346240_hwy4...'
response = requests.request('GET', url, )
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/visitor_file/20261216121630346240_hwy4...';
$response = $client->get($url);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor Record Create
requires authentication
Receives a json body of a record to be created (in _sn_record_json parameters) Json requires target table (_sn_table) and site's database fields
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/visitor_record_create" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"_sn_record_json\": \"{\\\"title\\\":\\\"My title\\\", \\\"_sn_table\\\":\\\"posts\\\"}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/visitor_record_create"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"_sn_record_json": "{\"title\":\"My title\", \"_sn_table\":\"posts\"}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_record_create'
payload = {
"_sn_record_json": "{\"title\":\"My title\", \"_sn_table\":\"posts\"}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_record_create';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'_sn_record_json' => '{"title":"My title", "_sn_table":"posts"}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"entity_id": "2026...",
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor Record Update
requires authentication
Receives a json body of a record to be updated (in _sn_record_json parameters) Json requires target table (_sn_table), entity id to be updated (_sn_entity_id) and site's database fields Send _sn_mark_as_deleted to mark as deleted
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/visitor_record_update" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"_sn_record_json\": \"{\\\"_sn_entity_id\\\": \\\"2026...\\\", \\\"_sn_table\\\":\\\"posts\\\", \\\"title\\\":\\\"Updated title\\\"}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/visitor_record_update"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"_sn_record_json": "{\"_sn_entity_id\": \"2026...\", \"_sn_table\":\"posts\", \"title\":\"Updated title\"}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_record_update'
payload = {
"_sn_record_json": "{\"_sn_entity_id\": \"2026...\", \"_sn_table\":\"posts\", \"title\":\"Updated title\"}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_record_update';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'_sn_record_json' => '{"_sn_entity_id": "2026...", "_sn_table":"posts", "title":"Updated title"}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"_sn_entity_id": "2026...",
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor File Upload
requires authentication
Upload a file as form data
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/visitor_file_upload" \
--header "Accept: application/json" \
--header "Content-Type: undefined" \
--data "{
\"data\": \"formData\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/visitor_file_upload"
);
const headers = {
"Accept": "application/json",
"Content-Type": "undefined",
};
let body = {
"data": "formData"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_file_upload'
payload = {
"data": "formData"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'undefined'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_file_upload';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'undefined',
],
'json' => [
'data' => 'formData',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success":true,"data": {"id":"new_id"},...
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor File Delete
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/visitor_file_delete" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"_sn_entity_id\": \"\\\"2026...\\\"\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/visitor_file_delete"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"_sn_entity_id": "\"2026...\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_file_delete'
payload = {
"_sn_entity_id": "\"2026...\""
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/visitor_file_delete';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'_sn_entity_id' => '"2026..."',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"metadata": "2026..."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Can Post to Table
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/check_can_post_to_table" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"table\": \"posts\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/check_can_post_to_table"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"table": "posts"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/check_can_post_to_table'
payload = {
"table": "posts"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/check_can_post_to_table';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'table' => 'posts',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"can_post_to_table": "true",
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Can Upload
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/check_can_upload" \
--header "Accept: application/json"const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/check_can_upload"
);
const headers = {
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/check_can_upload'
headers = {
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/check_can_upload';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"can_upload_files": "true",
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Api Token Endpoints
Visitor Record Create (API Token)
requires authentication
See regular Upsert Endpoint for details
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_create" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"api_token\": \"your_visitor_api_token\",
\"_sn_record_json\": \"{\\\"title\\\":\\\"My title\\\", \\\"_sn_table\\\":\\\"posts\\\"}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_create"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"api_token": "your_visitor_api_token",
"_sn_record_json": "{\"title\":\"My title\", \"_sn_table\":\"posts\"}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_create'
payload = {
"api_token": "your_visitor_api_token",
"_sn_record_json": "{\"title\":\"My title\", \"_sn_table\":\"posts\"}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_create';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'api_token' => 'your_visitor_api_token',
'_sn_record_json' => '{"title":"My title", "_sn_table":"posts"}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"entity_id": "2026...",
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor File Upload (API Token)
requires authentication
See regular Endpoint for details
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_file_upload" \
--header "Accept: application/json" \
--header "Content-Type: undefined" \
--data "{
\"api_token\": \"your_visitor_api_token\",
\"data\": \"formData\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_file_upload"
);
const headers = {
"Accept": "application/json",
"Content-Type": "undefined",
};
let body = {
"api_token": "your_visitor_api_token",
"data": "formData"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_file_upload'
payload = {
"api_token": "your_visitor_api_token",
"data": "formData"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'undefined'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_file_upload';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'undefined',
],
'json' => [
'api_token' => 'your_visitor_api_token',
'data' => 'formData',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{"success":true,"data": {"id":"new_id"},...
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Site API Query Endpoint (API Token)
requires authentication
This API needs to be enabled before use See regular Query Endpoint for details
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/api_query_endpoint" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"api_token\": \"your_visitor_api_token\",
\"query_parameters\": \"Json body of query parameters - {\\\"table\\\":\\\"posts\\\",\\\"where\\\":[[\\\"title\\\",\\\"!=\\\",\\\"excluded_title\\\"]]}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/api_query_endpoint"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"api_token": "your_visitor_api_token",
"query_parameters": "Json body of query parameters - {\"table\":\"posts\",\"where\":[[\"title\",\"!=\",\"excluded_title\"]]}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/api_query_endpoint'
payload = {
"api_token": "your_visitor_api_token",
"query_parameters": "Json body of query parameters - {\"table\":\"posts\",\"where\":[[\"title\",\"!=\",\"excluded_title\"]]}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/api_query_endpoint';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'api_token' => 'your_visitor_api_token',
'query_parameters' => 'Json body of query parameters - {"table":"posts","where":[["title","!=","excluded_title"]]}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"body": "Post body"
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Is Authenticated API (API Token)
requires authentication
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/api_is_authenticated" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"api_token\": \"your_visitor_api_token\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/api_is_authenticated"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"api_token": "your_visitor_api_token"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/api_is_authenticated'
payload = {
"api_token": "your_visitor_api_token"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/api_is_authenticated';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'api_token' => 'your_visitor_api_token',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": {
"is_authenticated": true,
"visitor_id": "1abc"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Visitor Record Update (API Token)
requires authentication
See regular Update Endpoint for details
Example request:
curl --request POST \
"http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_update" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"api_token\": \"your_visitor_api_token\",
\"_sn_record_json\": \"{\\\"title\\\":\\\"My title\\\", \\\"_sn_table\\\":\\\"posts\\\"}\"
}"
const url = new URL(
"http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_update"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
};
let body = {
"api_token": "your_visitor_api_token",
"_sn_record_json": "{\"title\":\"My title\", \"_sn_table\":\"posts\"}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());import requests
import json
url = 'http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_update'
payload = {
"api_token": "your_visitor_api_token",
"_sn_record_json": "{\"title\":\"My title\", \"_sn_table\":\"posts\"}"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()$client = new \GuzzleHttp\Client();
$url = 'http://site_id.snet.localhost:15080/site_api/v1/api_token_visitor_record_update';
$response = $client->post(
$url,
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'api_token' => 'your_visitor_api_token',
'_sn_record_json' => '{"title":"My title", "_sn_table":"posts"}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"success": true,
"data": [
{
"_sn_entity_id": "2026...",
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.