Sending a target event/goal completion
Last updated
[
{
"target_id": 1,
"user_id": 5842703839,
"date": "2023-12-31T20:00:00+01:00",
"value": 10,
"unit": "usd"
},
{
"target_id": 1,
"user_id": 5842703839,
"date": "2023-12-31T20:00:00+01:00",
"value": 10,
"unit": "usd"
}
]$url = "https://api.graspil.com/v1/send-target";
$api_key = ""; // your API key
$data = json_encode([
"target_id": 1,
"user_id": 5842703839,
"date": "2023-12-31T20:00:00+01:00",
"value": 10,
"unit": "usd"
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Api-Key: ' . $api_key,
'Content-Type: application/json;'
)];
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);import requests
import json
url = "https://api.graspil.com/v1/send-target"
api_key = "" # your API key
payload = json.dumps({
"target_id": 1,
"user_id": 5842703839,
"date": "2023-12-31T20:00:00+01:00",
"value": 10,
"unit": "usd"
})
headers = {
"Api-Key": api_key,
"Content-Type": "application/json"
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text){
"ok": true
}{
"ok": false,
"error": {
"target_id": [
"Unknown target_id"
],
"user_id": [
"The user with this id was not found"
]
}
}