"페이크 REST API 서버 JSONPlaceholder"의 두 판 사이의 차이

19번째 줄: 19번째 줄:
==예시==
==예시==
{| class='wikitable'
{| class='wikitable'
! 메소드 !! URL
! 동작 !! 메소드 !! 경로 !! 예시URL
|-
|-
| GET || http://jsonplaceholder.typicode.com/posts
| 글목록 조회 || GET || /posts || http://jsonplaceholder.typicode.com/posts
|-
|-
| GET || http://jsonplaceholder.typicode.com/posts/1
| 1번 글 조회 || GET || /posts/1 || http://jsonplaceholder.typicode.com/posts/1
|-
|-
| GET || http://jsonplaceholder.typicode.com/posts/1/comments
| 1번 글의 댓글목록 조회 || GET || /posts/1/comments || http://jsonplaceholder.typicode.com/posts/1/comments
|-
| 새글 입력 || POST || /posts || http://jsonplaceholder.typicode.com/posts
|-
| 1번 글 수정 || PUT || /posts/1 || http://jsonplaceholder.typicode.com/posts/1
|-
| 1번 글 수정 || PATCH || /posts/1 || http://jsonplaceholder.typicode.com/posts/1
|-
| 1번 글 삭제 || DELETE || /posts/1 || http://jsonplaceholder.typicode.com/posts/1
|}
|}



2017년 6월 4일 (일) 16:24 판

1 개요

JSONPlaceholder
  • 페이크 REST API 서버
<script src="//code.jquery.com/jquery.min.js"></script>
<script>
var root = 'https://jsonplaceholder.typicode.com';
$.ajax({
  url: root + '/posts/1',
  method: 'GET'
}).then(function(data) {
  console.log(data);
});
// Object {userId: 1, id: 1, title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", body: "quia et suscipit↵suscipit recusandae consequuntur …strum rerum est autem sunt rem eveniet architecto"}
</script>

2 예시

동작 메소드 경로 예시URL
글목록 조회 GET /posts http://jsonplaceholder.typicode.com/posts
1번 글 조회 GET /posts/1 http://jsonplaceholder.typicode.com/posts/1
1번 글의 댓글목록 조회 GET /posts/1/comments http://jsonplaceholder.typicode.com/posts/1/comments
새글 입력 POST /posts http://jsonplaceholder.typicode.com/posts
1번 글 수정 PUT /posts/1 http://jsonplaceholder.typicode.com/posts/1
1번 글 수정 PATCH /posts/1 http://jsonplaceholder.typicode.com/posts/1
1번 글 삭제 DELETE /posts/1 http://jsonplaceholder.typicode.com/posts/1

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}