Skip to main content
Skip table of contents

Integration API

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.

For this example

  • 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.

Operational 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.

  3. Verify the existence of the result to retrieve the processing outcome.

Sample API Calls

  1. 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
  2. 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
  3. Check the result existence:

    CODE
    curl -X GET -H "Authorization: Bearer $access_token" \
    "http://localhost:18300/get-xml-result/${processId}"
  4. Poll the process status:

    CODE
    curl -X GET -H "Authorization: Bearer $access_token" \
    http://localhost:18300/get-status?processId="${processId}"
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.