Description Usage Arguments Value Examples
Tremendous only supports DELETE requests for one endpoint – deleting an invoice. Per their documentation, this request "removes an invoice. This has no further consequences but is a rather cosmetic operation." See the examples for a walk-through.
1 2 3 4 5 6 7 8 9 10 |
client |
A Tremendous API Client object, created with
|
path |
The URL path, appended to the base URL, for GET requests such as listing available payment types, funding sources, account members, and more. See the Tremendous API Documentation for examples. |
query |
Query terms as a named list. See crul::HttpClient for more details. |
body |
Request body for Tremendous API, as an R List. |
disk |
A path to write to. |
stream |
An R function to determine how to stream data. |
encode |
"json" by default based on Tremendous API Request format. See crul::HttpClient for more options. |
parse |
Logical: Should the API Response results be parsed into a data frame? |
If parse = TRUE
(default), a list containing the response from the
API request. Otherwise, the R6 HttpResponse object containing API request
data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Not run:
# Create a new Tremendous API Client
test_client <- trem_client_new(api_key = "TEST_YOUR-API-KEY-HERE",
sandbox = TRUE)
# Perform a POST request for an invoice.
# `po_number` is Reference to the purchase order number within your organization
# `amount` is in USD
trem_post(test_client,
path = "invoices",
body = list(po_number = "unique-invoice-id",
amount = 50)
)
# Perform a GET request for listing all current (non-deleted) invoices.
current_invoices <- trem_get(test_client, "invoices")
# Get index for the correct ID
unique_id_index <- which(current_invoices$invoices$po_number == "unique-invoice-id")
# Get the invoice ID for 'unique-invoice-id' to delete
my_invoice_id <- current_invoices$invoices[unique_id_index, "id"]
# Perform a DELETE request for the specific invoice.
trem_delete(test_client, paste0("invoices/", my_invoice_id))
# Perform a GET request for listing all current (non-deleted) invoices.
# The one with id po_number 'unique-invoice-id' should no longer be here.
trem_get(test_client, "invoices")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.