In SAS Viya 3.4, you can use tags to add extra information beyond simple metadata to tables, columns, and other objects. In the user interface, these tags can be added to columns automatically when profiling the data or manually added. At this time in the user interface, you can add a new tag name, but there is not currently a way to perform the following actions:
However, these actions are available using the Annotations REST API service.
I will demonstrate how the three actions listed above can be performed using the Annotations REST API service in a 3-part series. My previous posts covered the first two items:
This article will focus on how you can delete an existing tag name.
Before using the Annotations REST API service, you must first obtain and OAuth token. For more information on this, you can read the following the following articles:
Note: Make sure the username you use to retrieve the OAuth token has the necessary permissions to run any of the REST APIs you want to execute.
Once you have your OAuth token, you can then use the Annotation REST API service. In my case, I want to delete the tag with the name of Demo2_Update. First, I need to make a call to search for the annotation (tag) with the name of Demo2_Update to get its ID information by using this call:
GET http://sasviya01.race.sas.com/annotations/annotations/?filter=eq(name,'Demo2_Update')
Header: Content-Type=application/vnd.sas.annotation+json
Header: Accept=application/vnd.sas.collection+json
Header: Authorization= Bearer <ReplaceWithOAuthToken>
Select any image to see a larger version.
Note: You can use many different tools to perform REST API calls. For my demonstration, I am using a tool called Postman.
This returns the following results:
Note: c2a28476-d82a-4ec9-af55-de063cc4d720
is the Annotation ID for the Demo2 tag name.
Now that I have the ID for the tag with name of Demo2_Update, I can submit the request to delete it:
DELETE http://sasviya01.race.sas.com/annotations/annotations/c2a28476-d82a-4ec9-af55-de063cc4d720
Header: Content-Type=application/vnd.sas.annotation+json
Header: Accept=*/*
Header: Authorization= Bearer <ReplaceWithOAuthToken>
Note: No content is returned from the DELETE request.
The tag with the name of Demo2_Update has now been deleted. I submit the following request to return all tag names that contain the word "Demo":
GET http://sasviya01.race.sas.com/annotations/annotations/?filter=contains(name,'Demo')
Header: Content-Type=application/vnd.sas.annotation+json
Header: Accept=application/vnd.sas.collection+json
Header: Authorization= Bearer <ReplaceWithOAuthToken>
The results returned now show that there is only one tag with a name containing the word "Demo" – Demo1.
This concludes the demonstration on how to delete an existing tag name using the Annotations REST API. For more information on working with tags (annotations) using REST API, you can refer to the documentation.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.