get_tickets {zdeskR} | R Documentation |
Get Zendesk Tickets
Description
This function takes your Email Id, authentication token, sub-domain and start time as parameters and gets all the tickets which have been updated on or after the start time parameter. By default each page returns 1000 unique tickets and an "after_cursor" value which stores a pointer to the next page. After getting the first page it uses the pointer to fetch the subsequent pages.
Usage
get_tickets(email_id, token, subdomain, start_time, remove_cols = NULL)
Arguments
email_id |
Zendesk Email Id (username). |
token |
Zendesk API token. |
subdomain |
Your organization's Zendesk sub-domain. |
start_time |
String with a date or datetime to get all tickets modified after that date. |
remove_cols |
Vector of column names to remove from the results. |
Details
The start time parameter should be in 'UTC' format as Zendesk uses the 'UTC' time zone when retrieving tickets after the start time. For example, the US Eastern Time Zone is currently four hours being UTC. If one wanted to get tickets starting on August 1 at 12 am, you would need to enter "2020-08-01 04:00:00". The user must do proper adjustment to accommodate the time zone difference, if desired. A date can be provided, it will retrieve results as of 12 am in the UTC time zone.
Start and end times can be entered with or without the time component. End time cannot be in the future, but should work for values up to one minute prior to the current time.
It's not a good practice to write down these authentication parameters in your code. There are various methods and packages available that are more secure; this package doesn't require you to use any one in particular.
The remove_cols parameter allows the removal of custom fields causing errors. Errors occurred when a field was sometimes blank and assigned a logical type and then appended to non-blank, non-logical inside of purrr::map_dfr. See issue #1 on GH.
Value
a Data Frame containing all tickets after the start time.
References
https://developer.zendesk.com/rest_api/docs/support/incremental_export#start_time
Examples
## Not run:
all_tickets <- get_tickets(email_id, token, subdomain,
start_time = "2021-01-31 00:00:00", end_time = "2021-01-31 23:59:59"
)
## End(Not run)