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.
For this example
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.
Operational workflow
Call the ingestion endpoint.
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.
Verify the existence of the result to retrieve the processing outcome.
Sample API Calls
Obtain an access token:
CODE
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
Initiate the ingestion process:
CODE
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
Check the result existence:
CODE
curl -X GET -H "Authorization: Bearer $access_token" \
"http://localhost:18300/get-xml-result/${processId}"
Poll the process status:
CODE
curl -X GET -H "Authorization: Bearer $access_token" \
http://localhost:18300/get-status?processId="${processId}"