User Tools

Site Tools


using_open_api_example

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
using_open_api_example [2020/06/09 13:42] hkimscilusing_open_api_example [2024/05/23 10:25] (current) hkimscil
Line 32: Line 32:
     * [[https://developer.amazon.com/public/apis|Amazon APIs]]     * [[https://developer.amazon.com/public/apis|Amazon APIs]]
     * [[https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html|Product Advertising API]]     * [[https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html|Product Advertising API]]
 +
 +
 +http://data.go.kr
 +http://data.seoul.go.kr
 +
 +<code>
 +install.packages("XML")
 +library(XML)
 +
 +# https://data.seoul.go.kr/
 +
 +mykey <- "6c7a765a55627a6a33366e48767266"
 +
 +
 +url = "http://openapi.seoul.go.kr:8088"
 +auth_key = mykey
 +type = 'xml'
 +service = 'culturalEventInfo'
 +startindex = '1'
 +endindex = '50'
 +api_url = paste(url, auth_key, type, service, startindex, endindex, sep = '/')
 +
 +api_url
 +
 +parsedXml <-xmlParse(api_url)
 +
 +rowXml <- getNodeSet(parsedXml, "//row")
 +
 +api_data <-xmlToDataFrame(rowXml, stringsAsFactors = F)
 +
 +#구조 확인
 +str(api_data)
 +
 +#테이블 확인
 +View(api_data)
 +api_data
 +
 +write.table(api_data,
 +            file = "SeoulCulturalEventInfo.csv",
 +            append = FALSE, quote = TRUE, sep = ",",
 +            eol = "\n", na = "NA", col.names = T, 
 +            row.names = F)
 +
 +</code>
 +
  
 ---- ----
using_open_api_example.1591677757.txt.gz · Last modified: 2020/06/09 13:42 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki