Example calls

End users will be provided with a service account that is assigned to a specific customer code within the IDP system. Each service account consists of a client-id and a client-secret.

Example data

  • client-id: c1-service-account
  • client-secret: Ri3vRcwyaFVZ3Vv4hP6WgbyKiBtpLHNy

With this information, the end user should first obtain an access token and subsequently use this token as a bearer token to access three other endpoints.

Workflow

  1. Call the ingestion endpoint.
  2. Continuously poll the status endpoint until the process is either EXPORTED or REJECTED.
  • If the status is REJECTED, cease polling.
  • If it is EXPORTED, proceed to the next step.
  1. Verify the existence of the result to retrieve the processing outcome.

Sample API calls

  1. Obtain an access token:
access_token=$(curl --request POST \
  --url 'http://localhost:18100/realms/idp/protocol/openid-connect/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=client_credentials \
  -u "c1-service-account:Ri3vRcwyaFVZ3Vv4hP6WgbyKiBtpLHNy" | jq '.access_token'|tr -d '"') \
&& echo $access_token
  1. 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" \
http://localhost:18300/upload-pdf | jq '.processId'|tr -d '"') && echo $processId
  1. Check the result existence:
curl -X GET -H "Authorization: Bearer $access_token" \
"http://localhost:18300/get-xml-result/${processId}"
  1. Poll the process status:
curl -X GET -H "Authorization: Bearer $access_token" \
http://localhost:18300/get-status?processId="${processId}"