diff --git a/markdownpages/profit/en/authentication.md b/markdownpages/profit/en/authentication.md index a279a98..4fc56f3 100644 --- a/markdownpages/profit/en/authentication.md +++ b/markdownpages/profit/en/authentication.md @@ -1,6 +1,6 @@ --- author: CLN -date: 2026-07-31 +date: 2026-08-26 tags: GetConnector, AppConnector, Integration, Configuration, Authentication, Authorization title: Authentication --- @@ -82,8 +82,8 @@ To access the API, follow these steps: 1. Obtain an access token 1. Call the [token endpoint](#token-endpoint) (POST) with the following information in the body: 1. grant_type: client_credentials - 2. client_id: `` - 3. client_secret: `` + 2. client_id: `` + 3. client_secret: `` 2. In the response of this call you will find the following fields: 1. access_token: the access token you must add to the Authorization header. 2. refresh_token: for the client credentials flow this is always "null". @@ -92,6 +92,53 @@ To access the API, follow these steps: 3. Use the access token 1. Copy the access token, prefix it with 'Bearer', and add it to your Authorization header. +#### cURL examples + +**Retrieve token:** +```bash +curl -X POST https://.rest.afas.online/ProfitRestServices/oauth/token \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=client_credentials" \ + -d "client_id=" \ + -d "client_secret=" +``` + +**Response example:** +```json +{ + "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "token_type": "Bearer", + "expires_in": 3600, + "refresh_token": null +} +``` + +**API call with token:** +```bash +curl -X GET "https://.rest.afas.online/ProfitRestServices/connectors/Profit_Address?skip=0&take=100" \ + -H "Accept: application/json" \ + -H "Authorization: Bearer " +``` + +**Response example:** +```json +{ + "skip": 0, + "take": 100, + "rows": [ + { + "AddressId": 1, + "AddressLine": "Stadsring 69, 3811 HN AMERSFOORT", + "PoBox": false, + "Address": "Stadsring", + "Number": 69, + "ZipCode": "3811 HN", + "Recidence": "Amersfoort", + "Country": "NL" + } + ] +} +``` ### Authorization code flow with PKCE @@ -104,9 +151,9 @@ To access the API via the Authorization Code Flow, follow these steps: 1. Obtain an authorization code 1. Redirect the user to the [authorization endpoint](#authorization-endpoint) (GET) with the following parameters: 1. response_type: code - 2. client_id: `` - 3. redirect_uri: `` - 4. scope: `` + 2. client_id: `` + 3. redirect_uri: `` + 4. scope: `` 5. state: `` 6. code_challenge: `` 7. code_challenge_method: `` @@ -114,10 +161,10 @@ To access the API via the Authorization Code Flow, follow these steps: 2. Exchange the authorization code for an access token 1. Call the [token endpoint](#token-endpoint) (POST) with the following information in the body: 1. grant_type: authorization_code - 2. code: `` - 3. redirect_uri: `` - 4. client_id: `` - 5. client_secret: `` + 2. code: `` + 3. redirect_uri: `` + 4. client_id: `` + 5. client_secret: `` 6. code_verifier: `` 3. In the response of this call you will find the following fields: 1. access_token: the access token you must add to the Authorization header. @@ -127,22 +174,83 @@ To access the API via the Authorization Code Flow, follow these steps: 3. Use the access token 1. Copy the access token, prefix it with 'Bearer', and add it to your Authorization header. +#### cURL examples + +**Step 1: Redirect user to authorization endpoint:** +```bash +# Open this URL in a browser: +https://.rest.afas.online/ProfitRestServices/oauth/authorize?response_type=code&client_id=&redirect_uri=&scope=&state=&code_challenge=&code_challenge_method=S256 +``` + +**Step 2: Retrieve token with authorization code:** +```bash +curl -X POST https://.rest.afas.online/ProfitRestServices/oauth/token \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=authorization_code" \ + -d "code=" \ + -d "redirect_uri=" \ + -d "client_id=" \ + -d "client_secret=" \ + -d "code_verifier=" +``` + +**Response example:** +```json +{ + "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "token_type": "Bearer", + "expires_in": 3600, + "refresh_token": "50c90d85-a7aa-4e8a-a9b8-..." +} +``` + +**Step 3: API call with token:** +```bash +curl -X GET "https://.rest.afas.online/ProfitRestServices/connectors/Profit_Address?skip=0&take=100" \ + -H "Accept: application/json" \ + -H "Authorization: Bearer " +``` + +**Response example:** +```json +{ + "skip": 0, + "take": 100, + "rows": [ + { + "AddressId": 1, + "AddressLine": "Stadsring 69, 3811 HN AMERSFOORT", + "PoBox": false, + "Address": "Stadsring", + "Number": 69, + "ZipCode": "3811 HN", + "Recidence": "Amersfoort", + "Country": "NL" + } + ] +} +``` + ### OAuth & SOAP API The description above for both flows also applies when using the SOAP API. It is important to include the Bearer token in the header and not in the body. ### Token endpoint -Production: https://``.rest.afas.online/ProfitRestServices/oauth/token +These endpoints apply to both REST and SOAP. -Accept: : https://``.restaccept.afas.online/ProfitRestServices/oauth/token +**Production**: https://``.rest.afas.online/ProfitRestServices/oauth/token -Test: https://``.resttest.afas.online/ProfitRestServices/oauth/token +**Accept**: https://``.restaccept.afas.online/ProfitRestServices/oauth/token + +**Test**: https://``.resttest.afas.online/ProfitRestServices/oauth/token ### Authorization endpoint -Production: https://``.rest.afas.online/ProfitRestServices/oauth/authorize +These endpoints apply to both REST and SOAP. + +**Production**: https://``.rest.afas.online/ProfitRestServices/oauth/authorize -Accept: https://``.restaccept.afas.online/ProfitRestServices/oauth/authorize +**Accept**: https://``.restaccept.afas.online/ProfitRestServices/oauth/authorize -Test: https://``.resttest.afas.online/ProfitRestServices/oauth/authorize +**Test**: https://``.resttest.afas.online/ProfitRestServices/oauth/authorize ### Read more diff --git a/markdownpages/profit/nl/authentication.md b/markdownpages/profit/nl/authentication.md index 849d7b3..e6f1498 100644 --- a/markdownpages/profit/nl/authentication.md +++ b/markdownpages/profit/nl/authentication.md @@ -1,6 +1,6 @@ --- author: CLN -date: 2026-07-31 +date: 2026-08-26 tags: GetConnector, AppConnector, Integration, Configuration, Authentication, Authorization title: Authenticatie --- @@ -81,8 +81,8 @@ Om toegang te krijgen tot de API, volg je de volgende stappen: 1. Access token ophalen 1. Roep het [token endpoint](#token-endpoint) (POST) aan met de volgende informatie in de body: 1. grant_type: client_credentials - 2. client_id: `` - 3. client_secret: `` + 2. client_id: `` + 3. client_secret: `` 2. In de response van deze aanroep vind je de volgende velden: 1. access_token: de access token die je in de Authorization header moet toevoegen. 2. refresh_token: is bij de client credentials flow altijd "null". @@ -91,6 +91,53 @@ Om toegang te krijgen tot de API, volg je de volgende stappen: 3. Access token gebruiken 1. Kopieer de access token, zet er 'Bearer' voor, en voeg hem toe in je Authorization header. +#### cURL voorbeelden + +**Token ophalen:** +```bash +curl -X POST https://.rest.afas.online/ProfitRestServices/oauth/token \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=client_credentials" \ + -d "client_id=" \ + -d "client_secret=" +``` + +**Response voorbeeld:** +```json +{ + "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "token_type": "Bearer", + "expires_in": 3600, + "refresh_token": null +} +``` + +**API aanroep met token:** +```bash +curl -X GET "https://.rest.afas.online/ProfitRestServices/connectors/Profit_Address?skip=0&take=100" \ + -H "Accept: application/json" \ + -H "Authorization: Bearer " +``` + +**Response voorbeeld:** +```json +{ + "skip": 0, + "take": 100, + "rows": [ + { + "AddressId": 1, + "AddressLine": "Stadsring 69, 3811 HN AMERSFOORT", + "PoBox": false, + "Address": "Stadsring", + "Number": 69, + "ZipCode": "3811 HN", + "Recidence": "Amersfoort", + "Country": "NL" + } + ] +} +``` ### Authorization code flow with PKCE @@ -103,9 +150,9 @@ Om toegang te krijgen tot de API via de Authorization Code Flow, volg je de volg 1. Verkrijg een Autorisatiecode 1. Leid de gebruiker naar het [autorisatie endpoint](#authorization-endpoint) (GET) met de volgende parameters: 1. response_type: code - 2. client_id: `` - 3. redirect_uri: `` - 4. scope: `` + 2. client_id: `` + 3. redirect_uri: `` + 4. scope: `` 5. state: `` 6. code_challenge: `` 7. code_challenge_method: `` @@ -113,10 +160,10 @@ Om toegang te krijgen tot de API via de Authorization Code Flow, volg je de volg 2. Wissel de Autorisatiecode in voor een Access Token 1. Roep het [token endpoint](#token-endpoint) (POST) aan met de volgende informatie in de body: 1. grant_type: authorization_code - 2. code: `` - 3. redirect_uri: `` - 4. client_id: `` - 5. client_secret: `` + 2. code: `` + 3. redirect_uri: `` + 4. client_id: `` + 5. client_secret: `` 6. code_verifier: `` 3. In de response van deze aanroep vind je de volgende velden: 1. access_token: de access token die je in de Authorization header moet toevoegen. @@ -126,23 +173,84 @@ Om toegang te krijgen tot de API via de Authorization Code Flow, volg je de volg 3. Access Token Gebruiken 1. Kopieer de access token, zet er 'Bearer' voor, en voeg hem toe in je Authorization header. +#### cURL voorbeelden + +**Stap 1: Gebruiker redirecten naar autorisatie endpoint:** +```bash +# Open deze URL in een browser: +https://.rest.afas.online/ProfitRestServices/oauth/authorize?response_type=code&client_id=&redirect_uri=&scope=&state=&code_challenge=&code_challenge_method=S256 +``` + +**Stap 2: Token ophalen met autorisatiecode:** +```bash +curl -X POST https://.rest.afas.online/ProfitRestServices/oauth/token \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=authorization_code" \ + -d "code=" \ + -d "redirect_uri=" \ + -d "client_id=" \ + -d "client_secret=" \ + -d "code_verifier=" +``` + +**Response voorbeeld:** +```json +{ + "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "token_type": "Bearer", + "expires_in": 3600, + "refresh_token": "50c90d85-a7aa-4e8a-a9b8-..." +} +``` + +**Stap 3: API aanroep met token:** +```bash +curl -X GET "https://.rest.afas.online/ProfitRestServices/connectors/Profit_Address?skip=0&take=100" \ + -H "Accept: application/json" \ + -H "Authorization: Bearer " +``` + +**Response voorbeeld:** +```json +{ + "skip": 0, + "take": 100, + "rows": [ + { + "AddressId": 1, + "AddressLine": "Stadsring 69, 3811 HN AMERSFOORT", + "PoBox": false, + "Address": "Stadsring", + "Number": 69, + "ZipCode": "3811 HN", + "Recidence": "Amersfoort", + "Country": "NL" + } + ] +} +``` + ### OAuth & SOAP API Bovenstaande beschrijving voor beide flows geldt ook wanneer je gebruikmaakt van de SOAP API. Het is belangrijk dat je het Bearer-token meegeeft in de header en niet in de body. ### Token endpoint -Productie: https://``.rest.afas.online/ProfitRestServices/oauth/token +Deze endpoints gelden zowel voor REST als voor SOAP. -Accept: : https://``.restaccept.afas.online/ProfitRestServices/oauth/token +**Productie**: https://``.rest.afas.online/ProfitRestServices/oauth/token -Test: https://``.resttest.afas.online/ProfitRestServices/oauth/token +**Accept**: https://``.restaccept.afas.online/ProfitRestServices/oauth/token + +**Test**: https://``.resttest.afas.online/ProfitRestServices/oauth/token ### Authorization endpoint -Productie: https://``.rest.afas.online/ProfitRestServices/oauth/authorize +Deze endpoints gelden zowel voor REST als voor SOAP. + +**Productie**: https://``.rest.afas.online/ProfitRestServices/oauth/authorize -Accept: https://``.restaccept.afas.online/ProfitRestServices/oauth/authorize +**Accept**: https://``.restaccept.afas.online/ProfitRestServices/oauth/authorize -Test: https://``.resttest.afas.online/ProfitRestServices/oauth/authorize +**Test**: https://``.resttest.afas.online/ProfitRestServices/oauth/authorize