Integrations and APIs for Service

Get Involved. Join the Conversation.


    Chethana KM
    How to access attributes of an article using REST API
    Topic posted August 16, 2019 by Chethana KMRed Ribbon: 250+ Points, tagged REST 
    48 Views, 3 Comments
    How to access attributes of an article using REST API
    How to access attributes of an article using REST API


    We have some attributes defined inside answer in Agent Desktop. Some of the attributes are <Title>, <Regulations>, <Change_Type> etc.. So, when we create an article in Authoring, we can set the values for these attributes and save the article.

    For some business requirement, we need to fetch all the articles having a specific value, say "N/A" inside <Regulations> attribute using REST API
    We tried the following Content REST API call with <title> attribute in the query parameter. It worked. likeAny ('*Request*')

    But, when we try to query for a custom attribute like <Regulations> as below, we are getting an error: likeAny ('*N/A*')

    Error is as follows:
    "An application error has occurred. Root Cause: One or more fieldNames used in the criteria are unknown and hence the query cannot be evaluated!"
    I have attached the error snapshot from Postman (Postman_Error_CustomAttribute.PNG)

    Could you please let us know how to query for attributes inside an article using REST API?

    I have attached the sample response of below Content API call for an answer-1002441
    Please note that the attributes like Regualtions,title etc are inside "xml" field in the Content API response.
    "xml": "<PROCEDURES><TITLE><![CDATA[Requesting a copy of an overdraft/insufficient available funds notice ]]></TITLE><LAST_REVIEW_DATE><![CDATA[2019-04-30 05:00:00 Etc/GMT]]></LAST_REVIEW_DATE><REGULATIONS SECURITY=\"RN_ACCESS_LEVEL_13\"><VALUE><![CDATA[N/A]]></VALUE><DISPLAY><![CDATA[N/A]]></DISPLAY><GUID><![CDATA[6402216618fb1201656f1f09790065eb]]></GUID></REGULATIONS></PROCEDURES>"

    Response file attached: Content_API_Response1.txt





    • Robert Surujbhan

      Hi Chethana, at this time, when querying the /content API via GET calls like you are doing, it is not possible to filter articles with the “q” parameter using Attribute values (aka Schema Nodes, for a Content Type).  For now, the only way to do that is using the Search API which is the other REST API service with Knowledge Advanced (

      With the Content API, one possible workaround is to configure your preferred content type Attributes to be part of the Master Identifier.  The full master identifier then becomes the Title of the record, and as you know, the ‘title’ field is queryable using the “q” parameter when you call GET on /content.  In summary, using the Master Identifier/Title is one way to query on article attribute values using the Content API.  Just be aware that all attributes designated as part of the master identifier are concatenated to form the complete title of the document/article - if you are OK with that for display purposes, you will be fine.


      • Chethana KM
        Hi Robert, Thank you for the suggestions! I have the following queries: 1. I am not able to figure out how to query for attribute using search Rest API. From the documentation, I see that we can search for some keyword/text or filter further based on facets. Could you please advise how to configure search Rest Api to query for article attributes? 2. As you say, if we set an attribute as master identifier, it will be displayed along with title of the article on UI. This is fine if it doesn't impact the regular search functionality on Customer portal. Also, the attribute which we want to query through rest api is a data list in the schema. It can have values "abc", "xyz" and so on.. My another doubt is that, suppose for an article art1, if the value of attribute is "abc" and the title (another attribute) of the article is "xyz general text". Now, if we want to retrieve articles having regulations as "xyz" and use content api to query for "xyz" in the title, then the article art1 will be fetched in the content api results,even though it doesn't have "xyz" as regulations. If regulations value is present in title as well, then this will lead to wrong results and we cannot go with this approach of using content api. Please suggest. Thanks, Chethana
    • Chethana KM


      The business requirement is as follows:
      We have to display all the Regulation attribute values as a dropdown on Customer portal.
      User selects one of the Regulation, say - "abc" and clicks on "Download Report" button.
      This should download all the articles with Regulations attribute set to "abc"

      To achieve the above requirement, we are following the below steps in the code, making more than one API call inside loop:
      1. Firstly, we are hitting the Content REST API to get all the docIds existing in the Service cloud database
      2. For each DocId (obtained from Step#1), we are again hitting the Content API to search for the specific Regulatory attribute value inside the xml field of the article (in the REST API response). When we looped through the docIds, it was taking more time to process fetching of data. Then, to improve the performace, we are calling a function to implement multi curl to make more than one REST API call at a time. Still, the requests are getting executed sequentially only and the performance is not getting improved. Hence, we have thought of implementing parallel execution of multi-curl, for which we need the multi-threading concept/technique in Service Cloud.

      Request you to provide us some direction/suggestions on how to improve the performance on execution of REST API's parallely on Service cloud?