GET/api/clients/{clientId}/transactions/{transactionId}
Node.js · native fetch
1
2const baseUrl = process.env.CRASSULA_BASE_URL;
3const apiKey = process.env.CRASSULA_API_KEY;
4const clientId = process.env.CRASSULA_CLIENT_ID;
5const transactionId = process.env.CRASSULA_TRANSACTION_ID;
6
7const path = `/api/clients/${encodeURIComponent(clientId)}/transactions/${encodeURIComponent(transactionId)}`;
8const response = await fetch(`${baseUrl}${path}`, {
9 method: 'GET',
10 headers: {
11 Authorization: apiKey,
12 },
13});
14
15if (!response.ok) throw new Error(`HTTP ${response.status}`);
16const data = await response.json();
Python · requests
1
2import os
3from urllib.parse import quote
4import requests
5
6base_url = os.environ["CRASSULA_BASE_URL"]
7api_key = os.environ["CRASSULA_API_KEY"]
8client_id = os.environ["CRASSULA_CLIENT_ID"]
9transaction_id = os.environ["CRASSULA_TRANSACTION_ID"]
10
11path = f'/api/clients/{quote(client_id, safe="")}/transactions/{quote(transaction_id, safe="")}'
12response = requests.get(
13 f"{base_url}{path}",
14 headers={"Authorization": api_key},
15 timeout=30,
16)
17response.raise_for_status()
18data = response.json()
Shell · cURL
1
2curl --request GET \
3 "${CRASSULA_BASE_URL}/api/clients/${CRASSULA_CLIENT_ID}/transactions/${CRASSULA_TRANSACTION_ID}" \
4 --header "Authorization: ${CRASSULA_API_KEY}"