BookmarkSubscribeRSS Feed

SAS Viya 3.4: Delete a Tag Name (Annotations REST API)

Started ‎02-22-2019 by
Modified ‎03-04-2021 by
Views 2,916

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>

 

1_API_Search_Demo2_Update.png

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:

 

2_API_Search_Demo2_Update_Results.png

 

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>

 

3_API_Delete_Tag.png

 

Note: No content is returned from the DELETE request.

 

4_API_Delete_Tag_Results.png

 

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>

 

5_API_Search_Demo.png

 

The results returned now show that there is only one tag with a name containing the word "Demo" – Demo1.

 

6_API_Search_Demo_Results.png

 

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.

Version history
Last update:
‎03-04-2021 08:24 AM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags