๊ฒฝ๊ธฐ์ฌ์ด๋ฒ๋์๊ด ๋ก๊ทธ์ธ API
- URI : /api/api
- Method : POST
- Parameter Type : body (json to string)
- Product Env Request URL : https://www.library.kr/cyber/api/login
Bruno Parameter E.G.

๐ฎ Request
-
loginId : ์์ด๋
-
loginPw : ํจ์ค์๋ (ํ๋ฌธ)
-
example code - javascript fetch
const url = 'http://localhost:7001/cyber/api/login';
const options =
{
method: 'POST',
body: '{"loginId":"ecouser2","loginPw":"1234"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
- example code - javascript fetch
const url = 'http://localhost:7001/cyber/api/login';
const options =
{
method: 'POST',
body: '{"loginId":"ecouser2","loginPw":"1234"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
- example code - javascript axios
import axios from 'axios';
const options = {
method: 'POST',
url: 'http://localhost:7001/cyber/api/login',
data: {loginId: 'ecouser2', loginPw: '1234'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
๐ Response
์ฑ๊ณต์
- 200 OK
{
"httpStatus": "OK",
"message": "OK",
"data": null
}
์คํจ์ - ๊ณ์ ์ ๋ณด ๋ถ์ผ์น or ์ฐพ์ ์ ์์
- 404 Not Found
{
"httpStatus": "NOT_FOUND",
"errorCode": null,
"errorResult": null,
"message": "์์ด๋ ํน์ ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค.",
"errors": null
}
์คํจ์ - n/2 ํ ์ด์ ๋น๋ฐ๋ฒํธ ์ค๋ฅ์ > ๋๋ฌํ๊ธฐ์ ์๋ฆผ
- 409 CONFLICT
{
"httpStatus": "CONFLICT",
"errorCode": null,
"errorResult": null,
"message": "์์ด๋ ํน์ ๋น๋ฐ๋ฒํธ ์
๋ ฅ ์ค๋ฅ 5ํ ์ด์ ์ด๊ณผ๋์์ต๋๋ค. <br/>10ํ ์ค๋ฅ์ 15๋ถ๊ฐ ๋ก๊ทธ์ธ์ด ๋ถ๊ฐ๋ฅํฉ๋๋ค.",
"errors": null
}
์คํจ์ - nํ ์ด์ ๋น๋ฐ๋ฒํธ ์ค๋ฅ์
- 409 CONFLICT
{
"httpStatus": "CONFLICT",
"errorCode": null,
"errorResult": null,
"message": "์์ด๋ ํน์ ๋น๋ฐ๋ฒํธ ์
๋ ฅ ์ค๋ฅ 10ํ๋ก <br/>15๋ถ๊ฐ ๋ก๊ทธ์ธ์ด ๋ถ๊ฐ๋ฅํฉ๋๋ค.",
"errors": null
}