HomeGuidesRecipesAPI EndpointsRelease NotesCommunity
Log In

Get Ontology Terms from Statements

You can query Ontology Tags by using the /layar/ontologyTerm/search endpoint.

Pre-Reqs

Before a document search can be done the API requests must be authenticated. Make sure you have already followed the instructions for importing dependencies and authentication from the Getting Started Guide.

👍

Check Your Imported Modules

Make sure you have imported the requests and json module before proceeding with this guide.

Parse Text for Ontology Terms

As with all our previous API calls, we will need to make a body variable to forward with our request. https://YOUR_LAYAR_ENVIRONMENT/layar/swagger-ui.html will allow you to look up values that can be used in the request. The q value, denotes the term you are looking for and rows determines how many results are returned.

body = {
       'q' = 'TERM TO SEARCH FOR',
       'rows' = 50
       }

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.

termSearchUri = f'{envUrl}/layar/ontologyTerm/search'

response = requests.post(termSearchUri,
                         headers = header,
                         json = body
                        )
pprint(response) #optional