MyNixOS website logo
Description

R Interface to Qiita API.

Qiita is a technical knowledge sharing and collaboration platform for programmers. See <https://qiita.com/api/v2/docs> for more information.

qiitr - R Binding for Qiita API

R build status CRAN_Status_Badge

About Qiita

Qiita is a technical knowledge sharing and collaboration platform for programmers. API Document is here http://qiita.com/api/v2/docs.

Installation

qiitr is now on CRAN.

install.packages("qiitr")

If you need the development version, try:

devtools::install_github("yutannihilation/qiitr")

Preperation

Most of Qiita APIs need authorization by an access token. You can issue access tokens on application settings with the proper priviledge scope.

qiitr package uses QIITA_ACCESSTOKEN environmental variable for authoriation. Add the following to your .Renviron file. If you are not familiar with .Renviron, please read ?Startup. The file is usually placed in the directory of Sys.getenv("R_USER").

QIITA_ACCESSTOKEN='(your access token)'

Or, you can temporarily set QIITA_ACCESSTOKEN by qiita_set_accesstoken().

qiita_set_accesstoken()

Usage

Get item information

Items means articles on Qiita. qiita_get_items() can get items by item IDs, tag IDs or user IDs.

# get items by item ID
qiita_get_items(item_id = "7a78d897810446dd6a3b")

# get items by tag ID
qiita_get_items(tag_id = c("dplyr", "tidyr"), per_pages = 10L, page_limit = 1L)

# get items by user ID
qiita_get_items(user_id = "yutannihilation")

Get user information

qiita_get_authenticated_user() returns the current user's information. qiita_get_users() returns the information about the specified user.

# get the current user
qiita_get_authenticated_user()

# get a user by id
qiita_get_users("yutannihilation")

Follow/Unfollow tags and users

You can also follow/unfollow tags and users by qiitr functions. Note that thsese APIs requires write priviledge.

# follow a user
qiita_follow_user("user1")

# unfollow a user
qiita_unfollow_user("user1")

# follow a tag
qiita_follow_tag("RStudio")

# unfollow a tag
qiita_unfollow_tag("RStudio")

Post and edit items

qiita_post_item() posts an item. Note that the item is private by default. You should manually check if the post is valid before make it public. qiita_update_item() updates it and qiita_delete_item() deletes it.

# post an item
item <- qiita_post_item(title = "test", body = "This is an example.")

browseURL(item$url)

# update the item
qiita_update_item(item$id, title = "test", body = "**This is a strong example!**")

# delete the item
qiita_delete_item(item$id)

Note

Qiita:Team

Though this package doesn't provide full support for Qiita:Team-related APIs, you can set QIITA_URL environmental variable to change API endpoints. Please add the following to your .Renviron.

QIITA_URL='(your Qiita:Team's URL)'
Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows