API, OpenAPI
https://codebeautify.org/jsonviewer
Best JSON Viewer and JSON Beautifier Online
Online JSON Viewer, JSON Beautifier and Formatter to beautify and tree view of JSON data - It works as JSON Pretty Print to pretty print JSON data.
codebeautify.org
https://kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json?key=f5eef3421c602c6cb7ea224104795888&targetDt=20230503
제목만 추출
{
"boxOfficeResult": {
"boxofficeType": "일별 박스오피스",
"showRange": "20230503~20230503",
"dailyBoxOfficeList": [
{
"movieNm": "가디언즈 오브 갤럭시: Volume 3",
},
{
"movieNm": "슈퍼 마리오 브라더스",
},
{
"movieNm": "드림",
},
{
"movieNm": "존 윅 4",
},
{
"movieNm": "스즈메의 문단속",
},
{
"movieNm": "옥수역귀신",
},
{
"movieNm": "리바운드",
},
{
"movieNm": "더 퍼스트 슬램덩크",
},
{
"movieNm": "킬링 로맨스",
},
{
"movieNm": "치치핑핑의 쿵쿵따 탐험대",
}
]
}
}
키 4d5d8aaff18ee7542b218db4a2632b6b
jSON VS XML
xml이 트래픽이 더 많음
해당 사이트에서 swift 언어의 클래스, 구조체로 JSON 데이터를 파싱하기 위한 틀로 변환
Instantly parse JSON in any language | quicktype
app.quicktype.io
API 플랫폼(테스트와 협업) 사이트
Postman API Platform | Sign Up for Free
Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
www.postman.com
URL과 URI
우리나라는 명사형으로 사용 많이함
RESTful API 와 HTTP 전송방식
REST 방식은 URL만 던져주면 되는데 SOAP 방식은 추가적인 정보를 하나더 전달해야해서 잘 사용 하지 않음
즉 하나의 JSON 객체의 value로 JSON 배열이 들어 갈 수 있음
빨강: JSON 시작, 두번째 빨강 벨류 값으로 JSON 객체 사용
초록 첫번째 : 값으로 JSON 배열 그다음 { 초록색 하나의 JSON 객체의 시작과 끝
파싱 접근 방법
ex 내가짠 소프트웨어 printf (API) 컴파일러
https://data.seoul.go.kr/dataList/datasetTotalList.do
나중에 활용해볼 지하철 open API
열린데이터광장 메인
데이터분류,데이터검색,데이터활용
data.seoul.go.kr
//
// ViewController.swift
// MovieJJK
//
// Created by comsoft on 2023/05/04.
//
import UIKit
let name = ["1. 가디언즈 오브 갤럭시: Volume 3", "2. 슈퍼 마리오 브라더스", "3. 드림","4. 존 윅 4", "5. 스즈메의 문단속", "6. 옥수역귀신", "7. 리바운드", "8. 더 퍼스트 슬램덩크", "9. 킬링 로맨스", "10. 치치핑핑의 쿵쿵따 탐험대",]
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return name.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath) as! MyTableViewCell
cell.movieName.text = name[indexPath.row]
return cell
}
@IBOutlet weak var table: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
table.delegate = self
table.dataSource = self
}
}