2-2 JavaScript API Reference
Calling Web Services

playground.restaurant์์ ์ฌ์ฉ๋ REST ๊ธฐ๋ฐ์ ์น์๋น์ค๋ฅผ ์ํ APIํธ์ถ์ ๋ํด ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. ์ค๋ช ์ ๋ฐ๋ผ๊ฐ๋ฉด์ API๋ฅผ ํธ์ถํ์ฌ data ๋ณ์์ ๊ฐ์ ์ ์ฅํ๋ ์ฝ๋๋ฅผ ์ฑ์๋ณด์ธ์.
์ง๊ธ๋ถํฐ Developer Center์ ์์ ๋ฅผ ํตํด์ ์ ๋ต์ ์ฐพ์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค!
REST
REST ๊ธฐ๋ฐ์ ์น์๋น์ค๋ฅผ ์ด์ฉํ๋ APIํธ์ถ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
http.getUrl(url, options)
http.postUrl(url, params, options)
http.putUrl(url, params, options)
http.deleteUrl(url, params, options)
์ฌ๊ธฐ์์ url
์ ์ ๊ณตํ๋ ์น ์๋ฒ์ ๋ํ ์ ๋ณด์
๋๋ค.
options
๋ JSON๊ธฐ๋ฐ์ ๊ฐ์ฒด์ด๊ณ ๋ค์๊ณผ ๊ฐ์ parameter๋ค์ ๊ฐ์ง๊ณ ์์ต๋๋ค.
format
: This specifies how the response will be processed. It may be one of 'text', 'json', 'xmljs', or 'csv'.query
: An object with attribute/value pairs to pass as arguments to the REST service.basicAuth
: HTTP Basic Authentication. The value must be an object with "username" and "password".cacheTime
: Cache time in milliseconds. By default, all GET requests are cached in memory. An alternate cache time may be provided.headers
: An object with key/value pairs for additional HTTP headers. This may be used for customContent-Type
settings (such as XML).passAsJson
(POST call only): If set totrue
, passes the request parameters in the body in JSON format and sets the content type appropriately.returnHeaders
: If set totrue
, returns HTTP headers and status code. This also suppresses exceptions on HTTP error status codes, leaving this to the developer to handle.
var response = http.getUrl('https://api.example.com', {
format: 'json',
query: {
booleanAttribute: booleanAttribute,
name: name,
restaurantStyle: restaurantStyle,
address: address,
menuItem: menuItem
}
})
Last updated
Was this helpful?