Title: Simple Posts API
Author: mr_speer
Published: <strong>2014년 11월 18일</strong>
Last modified: 2014년 11월 18일

---

플러그인 검색

![](https://ps.w.org/simple-posts-api/assets/banner-772x250.png?rev=1027658)

이 플러그인은 **최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다**. 워드프레스의
좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 
있을 수 있습니다.

![](https://ps.w.org/simple-posts-api/assets/icon-128x128.png?rev=1027665)

# Simple Posts API

 작성자: [mr_speer](https://profiles.wordpress.org/mr_speer/)

[다운로드](https://downloads.wordpress.org/plugin/simple-posts-api.zip)

 * [세부사항](https://ko.wordpress.org/plugins/simple-posts-api/#description)
 * [평가](https://ko.wordpress.org/plugins/simple-posts-api/#reviews)
 *  [설치](https://ko.wordpress.org/plugins/simple-posts-api/#installation)
 * [개발](https://ko.wordpress.org/plugins/simple-posts-api/#developers)

 [지원](https://wordpress.org/support/plugin/simple-posts-api/)

## 설명

As more and more developers turn towards front-end apps and data solutions, a solid
AJAX API is key to developing
 a responsive, usable system of querying and modifying
posts. While many solutions and plugins exist to help set up endpoints, often times
they are cumbersome or overly opinionated. Simple Posts API provides your site with
an easy-to-use, structure RESTful API with which to query, update, and delete posts.
It is relatively unopinionated, so you can store and retrieve post metadata at will
without worrying about setting up fields beforehand. Additionally, it employs native
WordPress Nonces to provide a secure structure for updating your post data.

### API Endpoints

#### Usage

There are four main operations you can use with this plugin:

 * Get
 * Put
 * Delete
 * Post

Each operation can be accessed by visiting `http://yoururl.com/postsapi/OPERATION/
POST_TYPE||ID` You may pass a Post Type or ID as the second URL parameter depending
on the operation you’re performing.

Each call must have a POST body containing a variable (nonce) containing a nonce
value which WordPress will verify. There is a localized JS variable provided named`
secure` which should be used. Some calls also allow other POST fields to be sent
along with the call.

For calls which include Field data, the plugin will automatically determine which
are Custom Fields and which are not.

See below for specifics on each operation.

#### GET

_Retrieve a list of posts based on a provided Post Type or Post ID._

**URL Path**

    ```
    http://yoururl.com/postsapi/get/POST_TYPE
    ```

**OR**

    ```
    http://yoururl.com/postapi/get/ID
    ```

**POST Body**

**Required**:

 * nonce (nonce value for security)

**Optional**:

 * arguments (an array of get_post arguments to use in the call)

**Example POST body**:

    ```
    jQuery.post( '/postsapi/get/post', { nonce: secure, arguments : {'posts_per_page': '-1'} })
      .done(function( data ) {
        console.log(data);
    });
    ```

**Additional Notes**:

The GET function returns author information for each post. If a user is logged in
and has admin capabilities, the author information is extensive. If the user is 
not an admin, then any private information is stripped from the returned object 
for security purposes.

#### PUT

_Update a post based on the provided ID and POSTed fields_

**URL Path**

    ```
    http://yoururl.com/postapi/put/ID
    ```

**POST Body**

**Required**:

 * nonce (nonce value for security)
 * fields (an array of key:value pairs to determine which fields to update)

**Optional**:

 * force (boolean; if set to `false`, the call will return an error if any invalid
   field names are passed, otherwise it will update all valid fields regardless.
   Default is ‘false’)

**Example POST body**:

    ```
    jQuery.post( '/postsapi/put/1', { nonce: secure, force: false, fields: { 'post_title': 'Updated Title', 'custom_text': 'Updated custom text' } } )
    .done(function( data ) {
      console.log( data );
    });
    ```

#### DELETE

_Delete a post based on the provided ID_

**URL Path**

    ```
    http://yoururl.com/postapi/delete/ID
    ```

**POST Body**

**Required**:

 * nonce (nonce value for security)

**Optional**:

 * force (boolean; if set to `false`, the post will be sent to the trash, otherwise
   it will skip the trash and be permanently deleted. Default is ‘false’)

**Example POST body**:

    ```
    jQuery.post( '/postsapi/delete/7', { nonce: secure, force: false } )
    .done(function( data ) {
      console.log( data );
    });
    ```

#### POST

_Create a post of the given post type, including the provided fields_

**URL Path**

    ```
    http://yoururl.com/postapi/post/POST_TYPE
    ```

**POST Body**

**Required**:

 * nonce (nonce value for security)
 * fields (an array of key:value pairs to determine which fields to include when
   creating the post)

**Optional**:

 * none

**Example POST body**:

    ```
    jQuery.post( '/postsapi/post/post', { nonce: secure, fields: { 'post_title': 'New Title', 'custom_text': 'New custom text', 'post_status': 'publish' } } )
    .done(function( data ) {
      console.log( data );
    });
    ```

#### Errors and Status Messages

Each call will return a JSON object. Within the JSON object is a key named `status`.
This contains a status code and status message. You can check against this in your
scripts in order to see if the call was successful or not. Any status code other
than 200 is an error.

#### Status Codes

 * **200**: Success
 * **400**: No posts found
 * **401**: Permission Denied (either failed the nonce verification or user not 
   logged in)
 * **410**: Invalid Post ID or Post Type provided
 * **420**: Post ID not found
 * **430**: Fields not found (status message lists fields)
 * **450**: Post delete failed (WordPress could not delete the post, see the status
   message for details)
 * **460**: Post type does not exist
 * **470**: Could not create new post; see status message for error details

#### Actions

Each operation has its own unique `_before` and `_after` actions that can be hooked
into. See below for a complete list.

**GET**

 * `postsapi_before_get`
 * `postsapi_after_get`

**PUT**

 * `postsapi_before_put`
 * `postsapi_after_put`

**DELETE**

 * `postsapi_before_delete`
 * `postsapi_after_delete`

**POST**

 * `postsapi_before_post`
 * `postsapi_after_post`

## 설치

#### Using The WordPress Dashboard

 1. Navigate to the \’Add New\’ in the plugins dashboard
 2. Search for ‘Simple Posts API’
 3. Click \’Install Now\’
 4. Activate the plugin on the Plugin dashboard

#### Uploading in WordPress Dashboard

 1. Navigate to the \’Add New\’ in the plugins dashboard
 2. Navigate to the \’Upload\’ area
 3. Select `simple-posts-api.zip` from your computer
 4. Click \’Install Now\’
 5. Activate the plugin in the Plugin dashboard

#### Using FTP

 1. Download `simple-posts-api.zip`
 2. Extract the `simple-posts-api` directory to your computer
 3. Upload the `simple-posts-api` directory to the `/wp-content/plugins/` directory
 4. Activate the plugin in the Plugin dashboard

## FAQ

 * I’m getting a 404 Error, what’s the deal? –

Your permalinks may need to be refreshed. Go to Settings->Permalinks and choose 
a non-default setting, or just click save if you’re already
 using a non-default
setting. This will flush your permalink settings and correct the 404 error.

## 후기

이 플러그인에 대한 평가가 없습니다.

## 기여자 & 개발자

“Simple Posts API”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에
기여하였습니다.

기여자

 *   [ mr_speer ](https://profiles.wordpress.org/mr_speer/)
 *   [ WerkPress ](https://profiles.wordpress.org/werkpress/)

[자국어로 “Simple Posts API”(을)를 번역하세요.](https://translate.wordpress.org/projects/wp-plugins/simple-posts-api)

### 개발에 관심이 있으십니까?

[코드 탐색하기](https://plugins.trac.wordpress.org/browser/simple-posts-api/)는,
[SVN 저장소](https://plugins.svn.wordpress.org/simple-posts-api/)를 확인하시거나,
[개발 기록](https://plugins.trac.wordpress.org/log/simple-posts-api/)을 [RSS](https://plugins.trac.wordpress.org/log/simple-posts-api/?limit=100&mode=stop_on_copy&format=rss)
로 구독하세요.

## 변경이력

#### 1.0

 * Initial Version

## 기초

 *  버전 **1.0**
 *  최근 업데이트: **12년 전**
 *  활성화된 설치 **10+**
 *  워드프레스 버전 ** 3.5 또는 그 이상 **
 *  다음까지 시험됨: **4.0.38**
 *  언어
 * [English (US)](https://wordpress.org/plugins/simple-posts-api/)
 * 태그:
 * [ajax](https://ko.wordpress.org/plugins/tags/ajax/)[api](https://ko.wordpress.org/plugins/tags/api/)
   [posts](https://ko.wordpress.org/plugins/tags/posts/)[rest](https://ko.wordpress.org/plugins/tags/rest/)
   [RESTful](https://ko.wordpress.org/plugins/tags/restful/)
 *  [고급 보기](https://ko.wordpress.org/plugins/simple-posts-api/advanced/)

## 평점

아직 제출된 리뷰가 없습니다.

[Your review](https://wordpress.org/support/plugin/simple-posts-api/reviews/#new-post)

[모든  리뷰 보기](https://wordpress.org/support/plugin/simple-posts-api/reviews/)

## 기여자

 *   [ mr_speer ](https://profiles.wordpress.org/mr_speer/)
 *   [ WerkPress ](https://profiles.wordpress.org/werkpress/)

## 지원

할 말 있으신가요? 도움이 필요하신가요?

 [지원 포럼 보기](https://wordpress.org/support/plugin/simple-posts-api/)