API providers reference
API providers reference
The Support SDK has the following API providers:
Each provider has a number of methods that give you access to tickets or help center resources.
Sample apps
We have some sample apps on Github which demonstrate how to use the Zendesk mobile SDKs in different ways. These can serve as useful references when integrating with the API providers.
Request provider
The request provider gives you access to support requests, which are also known as tickets in Zendesk. The provider has the following methods:
- createRequest
- getRequestById
- getAllRequestsWithCallback
- getRequestsByStatus
- getCommentsWithRequestId
- addComment
- getTicketFormWithIds}
To create the request provider, see ZDKRequestProvider below.
ZDKRequestProvider
Creates a request provider.
Swift
let requestProvider = ZDKRequestProvider()
Objective-C
[[ZDKRequestProvider alloc] init];
Use the request provider to invoke the methods documented in the rest of this section. Example:
Swift
provider.createRequest(request) {...}
Objective-C
provider.createRequest(request) {...}
getRequestById
Gets the request specified by the id.
Name | Type | Comment |
---|---|---|
requestId | The ID of a request in Zendesk Support | |
callback | Returns a ZDKRequest object on success |
getAllRequestsWithCallback
Gets all requests the user has opened. Also gets an access token if one hasn't been stored previously. If you're using anonymous identities, it checks to see if you have any stored request ids.
Name | Type | Comment |
---|---|---|
callback | Returns a list of ZDKRequest objects on success |
getRequestsByStatus
Filters requests the user has opened by ticket status. Also gets an access token if one hasn't been stored previously.
Name | Type | Comment |
---|---|---|
status | NSString | A comma-separated list of statuses to filter the results by |
callback | Returns a list of ZDKRequestsWithCommentingAgents objects on success. This contains a list of ZDKRequests and a list of ZDKUsers. These are agents who have commented on the requests. |
getCommentsWithRequestId
Gets all comments for a request. It also gets an access token if one hasn't been stored previously.
Name | Type | Comment |
---|---|---|
requestId | NSString | Id of a ticket |
callback | Returns a CommentsResponse model on success |
addComment
Adds a comment message to a request. Also gets an access token if one hasn't been stored previously.
Name | Type | Comment |
---|---|---|
comment | NSString | The comment to create |
requestId | NSString | Id of the ticket to receive this comment |
attachments | NSArray | List of ZDKUploadResponse objects. Can be nil |
callback | Returns a ZDKComment object on success |
getTicketFormWithIds
Gets the contents of specified ticket forms. Fetches only the first 5 ticket form ids.
Name | Type | Comment |
---|---|---|
ticketFormIds | NSArray<NSNumber> | An array of ticket form IDs |
callback | The callback is either successful or returns an error |
Help Center provider
The Help Center provider gives you access to help center resources in Zendesk Guide. The provider has the following methods:
- initWithLocale
- getCategoryById
- getSectionById
- getArticleById
- getFlatArticlesWithCallback
- getArticlesByLabels
- getSectionsWithCategoryId
- getArticlesWithSectionId
- searchForArticlesUsingQuery
- searchArticles
- getAttachmentWithArticleId
- submitRecordArticleView
- upvoteArticleWithId
- downvoteArticleWithId
- deleteVoteWithId
To create the Help Center provider, see ZDKHelpCenterProvider below.
ZDKHelpCenterProvider
Creates a Help Center provider.
Swift
let helpCenterProvider = ZDKHelpCenterProvider()
Objective-C
[[ZDKHelpCenterProvider alloc] init];
Use the request provider to invoke the methods documented in the rest of this section. Example:
Swift
provider.getCategoryById() {...}
Objective-C
provider.getCategoryById() {...}
initWithLocale
Creates a Help Center provider with a specified locale.
Name | Type | Comment |
---|---|---|
locale | NSString | A help center locale such as "de", "es", or "ja" |
getCategoryById
Gets a category.
Name | Type | Comment |
---|---|---|
categoryId | NSString | The id of a help center category |
callback | Returns a category object on success |
getSectionById
Gets a section.
Name | Type | Comment |
---|---|---|
sectionId | NSString | The id of a help center section |
callback | The callback that is invoked when a request is either successful or has an error |
getArticleById
Gets an article.
Name | Type | Comment |
---|---|---|
articleId | NSString | The id of a help center article |
callback | Returns an article object on success |
getFlatArticlesWithCallback
Gets a list of FlatArticle objects.
Name | Type | Comment |
---|---|---|
callback | Returns a list of FlatArticle objects on success |
getArticlesByLabels
Gets a list of articles that have a given list of labels. The article must have all the labels to be included.
Name | Type | Comment |
---|---|---|
labels | NSArray | An array of article labels |
callback | Returns a list of articles on success |
getSectionsWithCategoryId
Gets the sections in a given help center category.
Name | Type | Comment |
---|---|---|
categoryId | NSString | The id of a help center category |
callback | Returns a list of sections on success |
getArticlesWithSectionId
Gets the articles in a given help center section.
Name | Type | Comment |
---|---|---|
sectionId | NSString | The id of a help center section |
callback | Returns a list of articles on success |
searchForArticlesUsingQuery
Searches articles. You can filter the results by label. The method sideloads categories, sections, and users.
Name | Type | Comment |
---|---|---|
query | NSString | The query text used to perform the search |
andLabels | NSArray | An array of labels to filter the query |
callback | Returns a list of articles on success |
searchArticles
Searches articles filtered by the parameters in a given ZDKHelpCenterSearch model. See Searching Help Center in the Help Center API docs.
Name | Type | Comment |
---|---|---|
search | ZDKHelpCenterSearch | The search to perform |
callback | Returns a list of articles on success |
getAttachmentWithArticleId
Gets a list of attachments of a given article.
Name | Type | Comment |
---|---|---|
articleId | NSString | The id of a help center article |
callback | Returns a list of articles on success |
submitRecordArticleView
Records in Zendesk Support that a specific article as being viewed by the client. Used for the purpose of reporting in Zendesk Support.
Name | Type | Comment |
---|---|---|
articleId | NSString | The id of a help center article that's been viewed |
callback | A completion callback. Can be nil |
upvoteArticleWithId
Posts an upvote for a given article. If a vote already exists, it's updated.
Name | Type | Comment |
---|---|---|
articleId | NSString | The id of a help center article |
callback | Returns the vote object on success |
downvoteArticleWithId
Posts a downvote for a given article. If a vote already exists, it's updated.
Name | Type | Comment |
---|---|---|
articleId | NSString | The id of a help center article |
callback | Returns the vote object on success |
deleteVoteWithId
Deletes a vote.
Name | Type | Comment |
---|---|---|
voteId | NSString | The id of the vote to delete |
callback | Returns a status code |