Skip to content

Supplying Vector, Data Limitation on Get Trade Data #7

Answered by dzulfiqarfr
satria-aji asked this question in Q&A
Discussion options

You must be logged in to vote

It seems that the API has a limit on the amount of data we can get on a single request. The workaround, at least for now, is bps_request_multiple() (read more in the function's documentation). With this function, we can get the data in all chapters across all available years, as follows. (You may want to read the API documentation to use the original name-value pairs of the query parameters.)

library(bpsr)

hsCode <- bps_hs_code()

hsChapter <- unique(hsCode$hs_chapter)

bps_request_multiple(
  "dataexim",
  list(
    jenishs = "1", # Chapter
    kodehs = hsChapter,
    sumber = "1", # Export
    periode = "2", # Monthly
    tahun = paste0(seq(2014, 2023), collapse = ";")
  )
)
#> <bpsr_m…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@dzulfiqarfr
Comment options

Answer selected by dzulfiqarfr
@satria-aji
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants