Overview
SAP BTP Document extraction how to use the trail version UI and how we can leverage the service with the Postman.
The Prerequisites
1.SAP BTP Trail Account
2. Document extraction Service and UI set up in the Trial Account
3.Postman for testing the API Call
4.Python for using the API call
SAP BTP Trail Account
Please go through some of the below blogs of setting up the BTP Trial Account
https://developers.sap.com/tutorials/hcp-create-trial-account
Document extraction Service and UI set up in the Trial Account
Use the Booster available in the trail account and select the Document Extraction Booster.
Once the booster set up is complete we will be able to access the document extraction service and also the UI in our service and instances.
We can directly access the UI of the document Extraction from here.
Once we access the UI service we can see the below screen where we will be logging in with the default Client.
We can click on the Upload icon (+) to upload the document to extract the information.
Here we will have to select what type of underlying document is whether it is Invoice or Payment Advice etc.
The selection of document type holds the schema of the data.
For example Invoice document will have header and line items and Other information's.
We can also find the predefined extraction fields already provided by SAP for the Particular Document type.
Lets test the service with the provided UI.
We will upload an Invoice Document and use the service to extract the fields out of it.
Now the UI Testing is done lets use this service in our Postman App
Get the service key from the BTP Cockpit
From service key we will use clientid clientsecret backend url and swagger for the postman connect
Lets use this Extraction service from the postman
Set up the postman with the authorization first
Copy url value inside uaa JSON node from service key and append query oauth/token?grant_type=client_credentials and pass client_id and client_secret_code into basic auth of postman to get bearer token
Now we are ready with bearer token to use the service
Get API call with backend url + Swagger = Overall Link(From service key)
Initial Call to get the client for the Document Extraction Service to get the client
Lets call the Service to post a document
We will be using the Post call with /document/jobs with File and options as mandatory Body Parameters
Here file will be the actual file that we want to extract the data.
Options will be the Fields that we need to extract from the file
Example:
Lets write one small python code to play around document extraction service
We will use python request library to make the API calls
we are doing a Get call on the document extraction service with header as Bearer token to get the list of jobs that are available.
Hence we can see all the jobs that are available for the Document Extraction service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
4 | |
1 | |
1 | |
1 |