Example calls
You'll receive a service account assigned to a specific customer code within the IDP system. Each service account includes a client-id and a client-secret.
Example data
- client-id:
c1-service-account
- client-secret:
Ri3vRcwyaFVZ3Vv4hP6WgbyKiBtpLHNy
First, use this information to obtain an access token. Then, use the access token as a bearer token to access the three available endpoints.
Workflow
- Call the ingestion endpoint.
- Continuously poll the status endpoint until the process is either EXPORTED or REJECTED.
- If the status is REJECTED, stop polling.
- If the status is EXPORTED, proceed to the next step.
- Verify that the result exists so you can retrieve the processing outcome.
Sample API calls
- Obtain an access token:
export customer_realm_access_token=$(curl --request POST \
--url "https://sso.idp.de.retarus.com/auth/realms/c-${CUSTOMER_REALM}/protocol/openid-connect/token" \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=${CLIENT_ID} \
--data client_secret=${CLIENT_SECRET} \
--data scope=openid | jq '.access_token' | tr -d '"') && echo $customer_realm_access_token
export access_token=$(curl --location 'https://sso.idp.de.retarus.com/auth/realms/idp/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:token-exchange' \
--data-urlencode 'requested_token_type=urn:ietf:params:oauth:token-type:access_token' \
--data-urlencode 'client_id=idp-token-issuer-client' \
--data-urlencode "subject_token=$customer_realm_access_token" \
--data-urlencode "subject_issuer=c-${CUSTOMER_REALM}" \
--data-urlencode 'audience=idp-token-issuer-client' | jq '.access_token' | tr -d '"') && echo $access_token
curl -v -O -H "Authorization: Bearer $access_token" https://integration.idp.de2.retarus.com/v3/api-docs
- Initiate the ingestion process:
processId=$(curl -X POST -H "ai-pipeline-code: INVOICE" \
-H "Content-Type: multipart/form-data" \
-F "file=@etc/Rechnung_400021891618.pdf" \
-H "Authorization: Bearer $access_token" \
https://integration.idp.de2.retarus.com/upload-pdf | jq '.processId'|tr -d '"') && echo $processId
- Chec that the result exists:
curl -X GET -H "Authorization: Bearer $access_token" \
"https://integration.idp.de2.retarus.com/get-xml-result/${processId}"
- Poll the process status:
curl -X GET -H "Authorization: Bearer $access_token" \
https://integration.idp.de2.retarus.com/get-status?processId="${processId}"