For developers
Code samples
Every sample sends one invitation and prints the response. Replace YOUR_API_KEY with your key. Start with the test key: you will get 202 and "test": true, and no email is sent.
The language you choose stays chosen on all the pages.
curl -X POST https://api.reviewit.gr/v1/invitations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"email":"customer@example.gr","firstName":"Maria","orderRef":"1001"}'<?php$ch = curl_init('https://api.reviewit.gr/v1/invitations');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'email' => 'customer@example.gr', 'firstName' => 'Maria', 'orderRef' => '1001', ]),]);$body = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $status . ' ' . $body;// Node.js 18 or newer(async () => { const res = await fetch('https://api.reviewit.gr/v1/invitations', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ email: 'customer@example.gr', firstName: 'Maria', orderRef: '1001', }), signal: AbortSignal.timeout(10_000), });
console.log(res.status, await res.json());})();import requests
res = requests.post( "https://api.reviewit.gr/v1/invitations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "email": "customer@example.gr", "firstName": "Maria", "orderRef": "1001", }, timeout=10,)
print(res.status_code, res.json())// Java 11 or newerimport java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.time.Duration;
public class Invite { public static void main(String[] args) throws Exception { String json = "{\"email\":\"customer@example.gr\",\"firstName\":\"Maria\",\"orderRef\":\"1001\"}";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.reviewit.gr/v1/invitations")) .timeout(Duration.ofSeconds(10)) .header("Authorization", "Bearer YOUR_API_KEY") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build();
HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body()); }}package main
import ( "fmt" "io" "net/http" "strings" "time")
func main() { body := `{"email":"customer@example.gr","firstName":"Maria","orderRef":"1001"}`
req, err := http.NewRequest("POST", "https://api.reviewit.gr/v1/invitations", strings.NewReader(body)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 10 * time.Second} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close()
out, _ := io.ReadAll(res.Body) fmt.Println(res.StatusCode, string(out))}The details (customer@example.gr, Maria, 1001) are made up. Send your own.
Things to note
Section titled “Things to note”- Call it after the order is completed, and do not let an error or a slow answer stop the customer’s order. All the samples have a time limit of 10 seconds.
- The key stays on the server. Never in code that runs in the customer’s browser.
- Retrying is safe: the same order is not sent twice.
- For the response codes, see responses and errors.