Not geeting sys_tags field value through Rest API Explorer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Not geeting sys_tags field value through Rest API Explorer, I have a incident record and sys_tags field have some value but when getting through Rest API explorer on "
instancename/api/now/table/label/7dc355982b6cb610ea3af1d4b891bff2"
7dc355982b6cb610ea3af1d4b891bff2":- sys_id of the record
{
"result": {
"sys_id": "7dc355982b6cb610ea3af1d4b891bff2",
"name": "Shashank Test",
"type": "standard",
"sys_tags": "",
"sys_class_name": "label"
}
}
sys_tags = blank is coming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
This happens because:
-
sys_tags
is a non-persistent (derived) field. -
The REST API serializer doesn’t include calculated fields unless explicitly added.
-
So the REST API only returns physical fields stored in the DB.
If you want to retrieve the tags associated with a record (like an Incident), you need to query the label_entry
table, which holds that relationship.
You can Query /api/now/table/label_entry?table=<table_name>^table_key=<sys_id>
since, tags actually stored In the label_entry
table, linked to the record via table
+ table_key
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
/api/now/table/label_entry?table=<table_name>^table_key=<sys_id> -- what will be the table_name?
/api/now/table/label_entry?table=incident^table_key=e003d518fbe43a504e88f26165efdcb5 --Like this? sys_id is incident record sys_id?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
@shashanksha yes, let's verify it carefully
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Actually User is Adding the tag on incident form and than hitting the API from Post man to fetch the sys_tags field value, so i think it is not posible it will come like this directly. How can user fetch the sys_tag field which they enter on incident form to add.?