https://completion.amazon.com/api/2017/suggestions?session-id=133-4736477-7395454&customer-id=&request-id=4YM3EXKRH1QJB16MSJGT&page-type=Gateway&lop=en_US&site-variant=desktop&client-info=amazon-search-ui&mid=ATVPDKIKX0DER&alias=aps&b2b=0&fresh=0&ks=8&prefix=iph&event=onKeyPress&limit=11&fb=1&suggestion-type=KEYWORD&suggestion-type=WIDGET&_=1615209935015
https://completion.amazon.com/api/2017/suggestions?session-id=133-4736477-7395454&customer-id=&request-id=4YM3EXKRH1QJB16MSJGT&page-type=Gateway&lop=en_US&site-variant=desktop&client-info=amazon-search-ui&mid=ATVPDKIKX0DER&alias=aps&b2b=0&fresh=0&ks=8&prefix=ipho&event=onKeyPress&limit=11&fb=1&suggestion-type=KEYWORD&suggestion-type=WIDGET&_=1615209934872
Foo://example.com:8402/over/there?name=ferret#nose
https://www.google.com/seatch?q=hello&hl=ko
Scheme (https://) (Scheme://)
userinfo ([userinfo@])
host (www.google.com) (host)
Port (443) (:port)
Path (search)
Query (?q=hello&hl=ko) (?query)
Fragment (#fragment)
https://completion.amazon.com/api/2017/suggestions
?session-id=133-4736477-7395454&
customer-id=&
request-id=VQVA4AYCTWCV6E4E7V43&
page-type=Gateway&
lop=en_US&
site-variant=desktop&
client-info=amazon-search-ui&
mid=ATVPDKIKX0DER&
alias=aps&
b2b=0&
fresh=0&
ks=undefined&
prefix=codesqaud&
event=onFocusWithSearchTerm&
limit=11&
fb=1&
suggestion-type=KEYWORD&
suggestion-type=WIDGET&
_=1615532810376'
그 외의 모든 것은 쿼리 !!
fetch(
"https://completion.amazon.com/api/2017/suggestions?session-id=133-4736477-7395454&customer-id=&request-id=4YM3EXKRH1QJB16MSJGT&page-type=Gateway&lop=en_US&site-variant=desktop&client-info=amazon-search-ui&mid=ATVPDKIKX0DER&alias=aps&b2b=0&fresh=0&ks=8&prefix=iph&event=onKeyPress&limit=11&fb=1&suggestion-type=KEYWORD&suggestion-type=WIDGET&_=1615209935015"
)
.then((res) => res.json())
.then(console.log);
[alias : "aps"]
: "alias"는 "별명"이란 뜻을 가진다. 즉 이 데이터는 "aps"란 별명을 가진 놈인가 보다.
[prefix : "i"]
: "prefix"는 "접두사"라는 뜻이다. 즉 "i"를 접두사로 가지는 데이터를 의미하는 것같다.
[suggestions : Array(12)]
: suggestions은 12개의 배열을 가진 녀석인데, 여기가 바로 데이터들의 집합소인듯 하다.
https://completion.amazon.com/api/2017/suggestions?session-id=133-4736477-7395454&customer-id=&request-id=4YM3EXKRH1QJB16MSJGT&page-type=Gateway&lop=en_US&site-variant=desktop&client-info=amazon-search-ui&mid=ATVPDKIKX0DER&👏alias=aps&b2b=0&fresh=0&ks=8&❗️prefix=iph❗️&event=onKeyPress&limit=11&fb=1&suggestion-type=KEYWORD&suggestion-type=❗️WIDGET&_=1615209935015❗️👏
https://completion.amazon.com/api/2017/suggestions?session-id=133-4736477-7395454&customer-id=&request-id=4YM3EXKRH1QJB16MSJGT&page-type=Gateway&lop=en_US&site-variant=desktop&client-info=amazon-search-ui&mid=ATVPDKIKX0DER&👏alias=aps&b2b=0&fresh=0&ks=8&❗️prefix=ipho❗️&event=onKeyPress&limit=11&fb=1&suggestion-type=KEYWORD&suggestion-type=❗️WIDGET&_=1615209934872❗️👏
// swing을 입력한 데이터를 받아와보자
const inputValue = "swing";
//suggestion-type=WIDGET은 필요없어서 지웠다.
fetch(
`https://completion.amazon.com/api/2017/suggestions?session-id=133-4736477-7395454&customer-id=&request-id=4YM3EXKRH1QJB16MSJGT&page-type=Gateway&lop=en_US&site-variant=desktop&client-info=amazon-search-ui&mid=ATVPDKIKX0DER&alias=aps&b2b=0&fresh=0&ks=71&prefix=${inputValue}&event=onKeyPress&limit=11&fb=1&suggestion-type=KEYWORD`
)
.then((res) => res.json())
// sugestions의 value만 mapping
.then((data) => data.suggestions.map((v) => v.value))
.then(console.log);
덕분에 데이터 금방 불러왔네요!! 덕분에 미션 해결이 수월해졌습니다~~~!