Aller au contenu principal

Premier appel API

Effectuez votre premier appel à l'API MOCOSAG en 5 minutes.

1. Obtenir un token d'accès

curl -X POST https://sandbox.api.mocosag.com/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$MOCOSAG_CLIENT_ID" \
-d "client_secret=$MOCOSAG_CLIENT_SECRET" \
-d "scope=directory:read"

Réponse attendue :

{
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "directory:read"
}

2. Appeler un endpoint

curl "https://sandbox.api.mocosag.com/directory/v0/policyholders?limit=20&offset=0" \
-H "Authorization: Bearer $ACCESS_TOKEN"

3. Prochaines étapes