knitr::opts_chunk$set( warning = FALSE, message = FALSE, collapse = TRUE, comment = "#>" )
An R client for consuming APIs that follow the JSONAPI spec. This library does not do server side JSONAPI things.
git clone git@github.com:endpoints/endpoints-example.git
(or via hub
: hub clone endpoints/endpoints-example
)cd endpoints-example
npm install
PORT=8088 npm start
(start with port 8088 instead of 8080, can use a different port) - OR, npm install forever
, then PORT=8088 forever start -c "npm start" '.'
Which starts a server. Then point your browser to e.g.:
Stabler version
install.packages("rjsonapi")
Dev version
devtools::install_github("ropensci/rjsonapi")
library("rjsonapi")
(conn <- jsonapi_connect("http://localhost:8088", "v1"))
Get version
conn$version
Get base URL
conn$base_url()
Get server status
conn$status()
Get routes (not available in a standard JSONAPI i think)
conn$routes()
books route
conn$route("authors")
First authors document
conn$route("authors/1")
Sub-part under that document: books
conn$route("authors/1/books")
A different sub-part under that document: photos
conn$route("authors/1/photos")
In one R session:
jsonapi_server() #> Starting server to listen on port 8000
Then in another R session:
Connect to the server:
(conn <- jsonapi_connect("http://localhost:8000"))
Get routes
conn$routes()
Get chapters
conn$route("chapters")
Note: This server stuff is still in infancy. Working on getting a more complete set of routes and data.
Right now, jsonapi_server()
only loads data that comes with this package - in the
future it will support your own data.
rjsonapi
in R doing citation(package = 'rjsonapi')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.