HomeGuidesRecipesAPI EndpointsRelease NotesCommunity
Log In
Guides

Adding Annotations to a Document

Pre-Reqs

In order to add annotations to a document we require a documentId. We will be using the documentId from Upload a Document.

We will be using the same header from Define Your Header.

👍

Check Your Imported Modules

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

Create Your Request Body

In order to create annotations, we will need to create a request body. Our sourceId will be "master-pubmed.vyasa.com" and the key will be "Review"

body = {
  "sourceId": "master-pubmed.vyasa.com",
  "key": "Review",
}

Request Annotation Creation

Now that we have the body created, we can send our request to have the annotation added to the document. We will need to fill out the documentId variable with our desired ID.

documentId = 'AYXGsE6FbZ95yV31x8iZ'
createAnnotationUrl = f'{envUrl}/layar/sourceDocument/{documentId}/addAnnotations'

response = requests.post(createAnnotationUrl,
                         headers = header,
                         json = body)

print(response.text) #optional

The printed response will be "200" which indicates the annotation was created.