Newer Version Available

This content describes an older version of this product. View Latest

Articles Details

Get all online article fields, accessible to the user.

Syntax

Available since release
38.0
Method
GET
Formats
JSON, XML
Authentication
OAuth access token
Endpoint
[prefix]/support/knowledgeArticles/{articleId}
[prefix]/support/knowledgeArticles/{articleUrlName} Available in API v44.0 and later
HTTP headers
Accept: Optional. Can be either application/json or application/xml.
Accept-language: Required. The article must be an active language in the user’s organization
  • If the language code isn’t valid, an error message is returned: “The language code is not valid or not supported by Knowledge.”
  • If the language code is valid, but not supported by Knowledge, then an error message is returned: “Invalid language code. Check that the language is included in your Knowledge language settings."
Input:
string channel: Optional, defaults to user’s context. For information on channel values, see Valid channel Values.
  • App: Visible in the internal Salesforce Knowledge application
  • Pkb: Visible in the public knowledge base
  • Csp: Visible in the Customer Portal
  • Prm: Visible in the Partner Portal

boolean updateViewStat: Optional, defaults to true. If true, API updates the view count in the given channel as well as the total view count.

boolean isUrlName: Optional, defaults to false. If true, indicates that the last portion of the endpoint is a URL name instead of an article ID. Available in API v44.0 and later
Output:
The detailed fields of the article, if the article is online and visible to the current user.
  • Article Detail

    Full detail of an article, with complete metadata and layout-driven fields used for display of an article. It includes all the same properties as an Article Summary representation.

    1{
    2         "id":  Id,    // articleId,
    3         "articleNumber": String,
    4         "articleType": String,  // apiName of the article type, available in API v44.0 and later
    5         "title":  String,
    6         "urlName": String,   // available in API v44.0 and later
    7         "summary":  String,
    8         "url":  URL,
    9         "versionNumber": Int,
    10         "createdDate": Date,  // in ISO8601 format
    11         "createdBy": User Summary,
    12         "lastModifiedDate": Date,   // in ISO8601 format
    13         "lastModifiedBy": User Summary,
    14         "lastPublishedDate": Date, // in ISO8601 format
    15         "layoutItems": [ Article Field, ... ],  // standard and custom fields visible to the user, sorted based on the layouts of the article type.
    16         "categories": [ Data Category Groups, ... ], 
    17         "appUpVoteCount": Int,
    18         "cspUpVoteCount": Int,
    19         "prmUpVoteCount": Int,
    20         "pkbUpVoteCount": Int,
    21         "appDownVoteCount": Int,
    22         "cspDownVoteCount": Int,
    23         "prmDownVoteCount": Int,
    24         "pkbDownVoteCount": Int,
    25         "allViewCount": Int,
    26         "appViewCount": Int,
    27         "cspViewCount": Int,
    28         "prmViewCount": Int,
    29         "pkbViewCount": Int,
    30         "allViewScore": Double,
    31         "appViewScore": Double,
    32         "cspViewScore": Double,
    33         "prmViewScore": Double,
    34         "pkbViewScore": Double
    35         }
  • User Summary
    1{
    2         "id": String
    3         "isActive": boolean   // true/false
    4         "userName": String   // login name
    5         "firstName": String
    6         "lastName": String
    7         "email": String
    8         "url": String              // to the chatter user detail url: /services/data/xx.x/chatter/users/{userId}, for guest user, it will return null.
    9         }
  • Article Field

    An individual field of article information, which is listed in an Article Detail in the order required by the administrator’s layout.

    1{
    2         "type":  Enum,         // see the Notes
    3         "name": String,        // In API v43.0 and earlier, the developer name. In API v44.0 and later, the API name.
    4         "label": String,         // label
    5         "value": String,  
    6         }

Example

Input
1/services/data/v38.0/support/knowledgeArticles/kA0xx000000000LCAQ
2       HTTP Headers:  
3       Content-Type: application/json; charset=UTF-8
4       Accept: application/json
5       Accept-Language: en-US
Output
1{
2       "allViewCount" : 17,
3       "allViewScore" : 100.0,
4       "appDownVoteCount" : 0,
5       "appUpVoteCount" : 0,
6       "appViewCount" : 17,
7       "appViewScore" : 100.0,
8       "articleNumber" : "000001004",
9       "categoryGroups" : [ ],
10       "createdBy" : {
11       "email" : "user@company.com",
12       "firstName" : "Test",
13       "id" : "005xx000001SvoMAAS",
14       "isActive" : true,
15       "lastName" : "User",
16       "url" : "/services/data/v38.0/chatter/users/005xx000001SvoMAAS",
17       "userName" : "admin@salesforce.org"
18       },
19       "createdDate" : "2016-06-21T21:10:54Z",
20       "cspDownVoteCount" : 0,
21       "cspUpVoteCount" : 0,
22       "cspViewCount" : 0,
23       "cspViewScore" : 0.0,
24       "id" : "kA0xx000000000LCAQ",
25       "lastModifiedBy" : {
26       "email" : "user@company.com",
27       "firstName" : "Test",
28       "id" : "005xx000001SvoMAAS",
29       "isActive" : true,
30       "lastName" : "User",
31       "url" : "/services/data/v38.0/chatter/users/005xx000001SvoMAAS",
32       "userName" : "admin@salesforce.org"
33       },
34       "lastModifiedDate" : "2016-06-21T21:11:02Z",
35       "lastPublishedDate" : "2016-06-21T21:11:02Z",
36       "layoutItems" : [ {
37       "label" : "Out of Date",
38       "name" : "IsOutOfDate",
39       "type" : "CHECKBOX",
40       "value" : "false"
41       }, {
42       "label" : "sample",
43       "name" : "sample",
44       "type" : "PICK_LIST",
45       "value" : null
46       }, {
47       "label" : "Language",
48       "name" : "Language",
49       "type" : "PICK_LIST",
50       "value" : "en_US"
51       }, {
52       "label" : "MyNumber",
53       "name" : "MyNumber",
54       "type" : "NUMBER",
55       "value" : null
56       }, {
57       "label" : "My File",
58       "name" : "My_File",
59       "type" : "FILE",
60       "value" : null
61       } ],
62       "pkbDownVoteCount" : 0,
63       "pkbUpVoteCount" : 0,
64       "pkbViewCount" : 0,
65       "pkbViewScore" : 0.0,
66       "prmDownVoteCount" : 0,
67       "prmUpVoteCount" : 0,
68       "prmViewCount" : 0,
69       "prmViewScore" : 0.0,
70       "summary" : "The number of characters required for complete coverage of all these languages' needs cannot fit in the 256-character code space of 8-bit character encodings, requiring at least a 16-bit fixed width encoding or multi-byte variable-length encodings. \r\n\r\nAlthough CJK encodings have common character sets, the encodings often used to represent them have been developed separately by different East Asian governments and software companies, and are mutually incompatible. Unicode has attempted, with some controversy, to unify the character sets in a process known as Han unification.\r\n\r\nCJK character encodings should consist minimally of Han characters p",
71       "title" : "Test Images",
72       "url" : "/services/data/v38.0/support/knowledgeArticles/kA0xx000000000LCAQ",
73       "versionNumber" : 7
74       }

Usage

Salesforce Knowledge must be enabled in your organization. This resource can be used in API version 38.0 and later. The Custom File Field is not supported because it returns a link to a binary stream. Use the language code format used in Which Languages Does Salesforce Support?.

A lookup custom field is visible to guest users depending on the lookup entity type. For example, User is visible, but Case and Account are not visible. Following standard fields are not visible to a guest user, even if they are in the layout:
  • archivedBy
  • isLatestVersion
  • translationCompletedDate
  • translationImportedDate
  • translationExportedDate
  • versionNumber
  • visibleInInternalApp
  • visibleInPKB
  • visibleToCustomer
  • visbileToPartner

Valid channel Values

  • When using the options string channel, where the matching articles are visible, the following values are valid.
    • App–Visible in the internal Salesforce Knowledge application
    • Pkb–Visible in the public knowledge base
    • Csp–Visible in the Customer Portal
    • Prm–Visible in the Partner Portal
  • If channel isn’t specified, the default value is determined by the type of user.
    • Pkb for a guest user
    • Csp for a Customer Portal user
    • Prm for a Partner Portal user
    • App for any other type of user
  • If channel is specified, the specified value may be used to retrieve articles.
    • For guest, Customer Portal, and Partner Portal users, if the specified channel is other than the channel accessible to the user, an error is returned.
    • For all users other than guest, Customer Portal, and Partner Portal users, the specified channel value is used.