Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

DataScraping Rsoftware API 11

The document discusses APIs and JSON. It begins by defining an API as a software intermediary that allows applications to communicate. It then introduces JSON as a data format commonly used with APIs and configurations. The document provides examples of JSON code representing company data and shows how to parse JSON strings in JavaScript. It instructs parsing JSON from a URL using R and provides a link for a web scraping tutorial using R.

Uploaded by

Haniel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

DataScraping Rsoftware API 11

The document discusses APIs and JSON. It begins by defining an API as a software intermediary that allows applications to communicate. It then introduces JSON as a data format commonly used with APIs and configurations. The document provides examples of JSON code representing company data and shows how to parse JSON strings in JavaScript. It instructs parsing JSON from a URL using R and provides a link for a web scraping tutorial using R.

Uploaded by

Haniel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Akses Data API (Application Programming Interface) dengan menggunakan R

Dosen Pengampu

The Jin Ai, Dr. Eng


Ririn Diar Astanti, Dr.Eng

Program Magister Studi Teknik Industri


Apa yang di maksud dengan API?

API is the acronym for Application Programming Interface, which is a software intermediary that allows two
applications to talk to each other. Each time you use an app like Facebook, send an instant message, or
check the weather on your phone, you’re using an API.

https://www.mulesoft.com/resources/api/what-is-an-api

https://www.youtube.com/watch?
time_continue=7&v=s7wmiS2mSXY&feature=emb_logo

Program Magister Studi Teknik Industri


Pengantar

Jika pada pertemuan sebelumnya kita sudah mempelajari web scrapping pada web static, dengan struktur
data XML

Selanjutnya akan dibahas mengenai JSON (Java Script Object Notation)


- JSON merupakan data representation format
- Umum digunakan pada API dan config

Program Magister Studi Teknik Industri


Program Magister Studi Teknik Industri
Program Magister Studi Teknik Industri
Pastikan ASP.NET and web development tools dicentang, kemudian klik close

Program Magister Studi Teknik Industri


Program Magister Studi Teknik Industri
Program Magister Studi Teknik Industri
[
{
"name": "Big Company",
"numberofEmployee": 10000,
"rating": 4.1
},
{
"name": "Small Company",
"numberofEmployee": 100,
"rating": 4.1
}
]

Program Magister Studi Teknik Industri


<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">


<head>
<meta charset="utf-8" />
<title>JSONLATIHAN</title>
</head>
<body>
<script type="text/javascript">
let companies =
[
{
"name":“Big Commpany",
"numberofEmployee": 10000,
"rating": 4.1
},
{
"name": "Small Company",
"numberofEmployee": 100,
"rating": 4.1
}
]

console.log(companies)
</script>
</body>
</html>

Program Magister Studi Teknik Industri


• Klik File  view in browser
• Kemudian klik ctrl+shift+ c
• Pilih console
<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">


<head>
<meta charset="utf-8" />
<title>JSONLATIHAN</title>
</head>
<body>
<script type="text/javascript">
let companies =
`[
{
"name":"Perusahaan besar",
"numberofEmployee": 10000,
"rating": 4.1
},
{
"name": "Small Company",
"numberofEmployee": 100,
"rating": 4.1
}
]`

console.log(JSON.parse(companies))
</script>
</body>
</html>

Program Magister Studi Teknik Industri


Program Magister Studi Teknik Industri
<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">


<head>
<meta charset="utf-8" />
<title>JSONLATIHAN</title>
</head>
<body>
<script type="text/javascript">
let companies =
`[
{
"name":"Perusahaan besar",
"numberofEmployee": 10000,
"rating": 4.1
},
{
"name": "Small Company",
"numberofEmployee": 100,
"rating": 4.1
}
]`

console.log(JSON.parse(companies)[1].name)
</script>
</body>
</html>

Program Magister Studi Teknik Industri


Latihan

https://www.analyticsvidhya.com/blog/2017/03/beginners-
guide-on-web-scraping-in-r-using-rvest-with-hands-on-
knowledge/

Program Magister Studi Teknik Industri


Terima Kasih

You might also like