Statement Search
The /layar/statement/search
endpoint allows you to search for and parse data at the statement level. In this guide, we will go over some of the values you can use to filter your statement search using the
Setting Up
Make sure you have already followed the instructions for importing dependencies and authentication from the Getting Started Guide. You can use your token
variable to authenticate your requests.
Check Your Imported Modules
Make sure you have imported the
requests
andjson
module before proceeding with this guide.
Configuring Your Header
We will be using the same header that we used in the previous section Document Search Pre-Reqs.
header = {'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': f"Bearer {token}",
'X-Vyasa-Client': 'layar',
'X-Vyasa-Data-Providers' : 'sandbox.certara.ai'}
Searching for Statements
As with document search there is going to be values, we can forward in the body
of the request. There are various values you can use. These values can be found at https://YOUR_LAYAR_ENVIRONMENT/layar/swagger-ui.html
.
Search By Query String
The most generic search would require the q
value to determine what you are looking for in the statement.
body = {
'q' :'QUERY TEXT HERE'
}
Search By Document ID
You can then filter this even further by focusing on specific set of documents using the documentIds
value.
body = {
'q' :'QUERY TEXT HERE',
'documentIds' : ['docId1' , 'docId2'
]
}
Perform the Search
As with all API calls in Python we will be using requests
to do a POST. Our header
authenticating and dictating which data providers we want to look at. While the body
holds the query and relevant filters.
stateSearchUri = f'{envUrl}/layar/statement/search'
response = requests.post(stateSearchUri,
headers = header,
json = body
)
pprint(response) #optional
Pro Tip
You will notice that all these searches share similar values that need to be part of the
body
. This allows you to easily swap bodies between different endpoints.
Updated 8 months ago