Utilizzo delle API
Riseact offre due interfacce API: GraphQL per query e mutazioni flessibili, e REST per operazioni CRUD standard. Entrambe accettano lo stesso token di autenticazione. Consulta la pagina precedente per come ottenere il token.
GraphQL
Endpoint: POST https://core.riseact.org/admin/graphql/
curl -X POST https://core.riseact.org/admin/graphql/ \
-H "Authorization: Bearer IL_TUO_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query { supporters(pagination: { first: 10 }) { edges { node { id firstName lastName email } } pageInfo { hasNextPage endCursor total } } }"
}'
Per la paginazione delle query GraphQL, consulta la Guida alla paginazione GraphQL.
Per la gestione degli errori, consulta la Guida agli errori GraphQL.
REST
Endpoint base: https://core.riseact.org/api/v1/
# Lista sostenitori
curl https://core.riseact.org/api/v1/supporters/?limit=20&offset=0 \
-H "Authorization: Bearer IL_TUO_TOKEN"
# Singolo sostenitore
curl https://core.riseact.org/api/v1/supporters/123/ \
-H "Authorization: Bearer IL_TUO_TOKEN"
# Crea un sostenitore
curl -X POST https://core.riseact.org/api/v1/supporters/ \
-H "Authorization: Bearer IL_TUO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"first_name": "Mario", "last_name": "Rossi", "email": "mario@example.com"}'
Per la paginazione delle liste REST, consulta la Guida alla paginazione REST.
Endpoint REST disponibili
| Endpoint | GET (lista) | GET (singolo) | POST | PUT | DELETE |
|---|---|---|---|---|---|
/api/v1/supporters/ | ✓ | ✓ | ✓ | ✓ | ✓ |
/api/v1/donations/ | ✓ | ✓ | — | — | — |
/api/v1/payments/ | ✓ | ✓ | — | — | — |
/api/v1/campaigns/ | ✓ | ✓ | — | — | — |
/api/v1/checkouts/ | ✓ | ✓ | ✓ | — | — |
/api/v1/webhooks/ | ✓ | ✓ | ✓ | ✓ | ✓ |