Learn R Programming

⚠️There's a newer version (1.1.0) of this package.Take me there.

rt

An interface to the RequestTracker API.

Installation

install.packages("rt")

Usage

Setup

To start using the rt package, log in to your RT instance by setting the server URL in using Sys.setenv and use rt_login() to log in and store your session locally.

Below, we log into Best Practical's demo installation of RT:

library(rt)

Sys.setenv("RT_BASE_URL" = "https://demo.bestpractical.com")
rt_login() # Enter demo/demo

Once you are successfully logged in, you're all set to use the package. The rt package supports all of the RequestTracker REST API:

  • General
    • Login: rt_login()
    • Logout: rt_logout()
  • Tickets
    • Ticket Properties: rt_ticket_properties()
    • Ticket Links: rt_ticket_links()
    • Ticket Attachments: rt_ticket_attachments()
    • Ticket Attachment: rt_ticket_attachment()
    • Ticket Attachment Content: rt_ticket_attachment_content()
    • Ticket History: rt_ticket_history()
    • Ticket History Entry: rt_ticket_history_entry()
    • Ticket Search: rt_ticket_search()
    • Ticket Create: rt_ticket_create()
    • Ticket Edit: rt_ticket_edit()
    • Tickets History Reply: rt_ticket_history_reply()
    • Ticket History Comment: rt_ticket_history_comment()
    • Ticket Links Edit: rt_ticket_links_edit()
  • Users
    • User Properties: rt_user_properties()
    • User Create: rt_user_create()
    • User Edit: rt_user_edit()
  • Queues
    • Queue Properties: rt_queue_properties()

Note: Most of these functions support being chained together (for example, with the %>%).

See the included vignettes for more information about usage.

Logging out

To log out, use the rt_logout function (or restart your R session):

rt_logout()

Development & Testing

A test suite is provided that is comprised mostly of integration tests that are configured to run against a local installation of RT. By default, running devtools::test() will only run a small subset of the full test suite: those that do not depend on being able to call out to an RT installation (i.e., unit tests).

To run the full test suite locally,

  1. Start a local RT installation with Docker:

    docker run -d --name rt -p 80:80 netsandbox/request-tracker
  2. Turn on integration tests for your session

    Sys.setenv("RT_INTEGRATION" = TRUE)
  3. Run devtools::test() from the same session as (2)

rt_api objects

All API calls go through an intermediate state as an rt_api object, which is made up of three parts:

  1. the content, generally returned as a tibble/data frame
  2. the path or URL that was accessed
  3. the HTTP response from the API.

This is mainly to help normalize out some of the inconsistencies in the RT API itself and make implementing the API call wrappers easier.

Support / Issues / Feedback

Let us know about any issues or bugs.

Acknowledgements

Support was provided by the National Center for Ecological Analysis and Synthesis, a Center funded by the University of California, Santa Barbara, and the State of California.

Copy Link

Version

Install

install.packages('rt')

Monthly Downloads

271

Version

1.0.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Bryce Mecum

Last Published

December 17th, 2020

Functions in rt (1.0.1)

check_login

Check that the login request was successful or not
construct_newline_pairs

Construct a string for params suitable for passing into an RT request
rt_GET

Get an RT response
rt

The rt package
parse_ticket_create_body

Parse an RT ticket create response body and return the ticket ID
rt_POST

POST an RT request
parse_rt_properties

Parse typical RT properties as contained in an RT response body
print.rt_api

Print an rt_api object
compact

Compact list.
parse_user_create_body

rt_ticket_attachments

Get a ticket's attachments
rt_ticket_merge

Merge two tickets
rt_logout

Log out of RT
rt_login_interactive

Log in to RT interactively
rt_ticket_properties

Get a ticket's properties
rt_user_edit

Edit a user
rt_user_properties

Get a user's properties
rt_ticket_links

Get a ticket's links
rt_ticket_attachment_content

Get the content of an attachment
rt_ticket_attachment

Get a ticket's attachment
rt_ticket_links_edit

Edit the links on a ticket
stopforstatus

Throw an error if the RT status code is an error status
rt_version_string

Get the version of the currently installed version of this package as a character vector
rt_parse_response

Parse an RT response in its parts as a list
rt_user_agent

Get the user agent for the package.
rt_queue_properties

Get the properties of a queue
rt_do_login

Actually do the logging in part of logging in
rt_ticket_create

Create a ticket
rt_user_create

Create a user
rt_ticket_history

Get a ticket's history
rt_ticket_edit

Edit a ticket
warn_user_edit_warnings

Warn if a user edit response body contains warnings
rt_ticket_history_reply

Reply to a ticket
rt_ticket_history_comment

Comment on a ticket
rt_ticket_search

Search for tickets
rt_url

Generate an RT API URL
tidy_long_search_result

tidy_long_search_result
rt_login

Log in to RT
try_tibble

Try to make a tibble