You're viewing old version number 49. - Current version

4 min

Grebe API

Grebe blogging API description. It's currently being used at http://maketoledo.soupmode.com.

It uses REST and JSON.

Each function below is preceded with /api/v1 in the URI. So for Soupmode, it would be http://soupmode.com/api/v1.

Example of activating a new user account:
http://soupmode.com/api/v1/users/activate/ru8wkn0ol2ql3bm9

At the moment, I don't have SSL enabled at Soupmode.com, and OAuth is not used. Strengthening authentication is on the to-do list.

Users

Except for activating a user account, URIs for GETs and PUTs end with the query string:
/?user_name=[user_name]&user_id=[user_id]&session_id=[session_id]

  • Retrieve profile page info for user name JR.
    GET request.
    /users/JR

  • Create a new user account.
    POST request.
    /users
    Client sends JSON to the API:
    { "user_name" : "userA", "email" : "usera@usera.com" }

  • Activate user account.
    GET request.
    /users/activate/[user_digest]

  • Logout user JR.
    GET request.
    /users/JR/logout

  • Login user.
    Post request.
    /users/login
    Client sends JSON to the API:
    { "email" : "usera@usera.com", "password" : "plaintextpwd" }

  • Retrieve new password for existing account. User would not be logged in. This would be executed for someone who forgot or lost a password.
    POST request.
    /users/password
    Client sends JSON to the API:
    { "user_name" : "userA", "email" : "usera@usera.com" }

  • Change password for existing account. User must be logged-in.
    PUT request.
    /users/password

  • Update e-mail and/or profile description for the user.
    PUT request.
    /users

Articles

When Deleting and un-deleting articles by the logged-in author, the URI for GET requests ends with the query string:
/?user_name=[user_name]&user_id=[user_id]&session_id=[session_id]

POST and PUT requests will also need the above name=value pairs encoded and sent to the API.

Example displaying article number 5:
GET request.
http://soupmode.com/api/v1/articles/5/?user_name=JR&user_id=23&session_id=ru8er03jjg3k40vjl09

  • Show all articles.
    GET request.
    /articles

  • Show page three of the stream of articles.
    GET request.
    /articles/page/3

  • Show all articles for user JR.
    GET request.
    /articles/user/JR

  • Show page three of the stream of articles for user JR.
    GET request.
    /articles/user/JR/page/3

  • Retrieve article for ID number 5.
    GET request.
    /articles/5
    If logged-in user is author, then additional information is returned, such as markup_text, article_digest, etc., which is good for editing the article.

  • Retrieve article for URI title this-is-a-test.
    GET request.
    /articles/this-is-a-test
    If logged-in user is author, then additional information is returned, such as markup_text, article_digest, etc., which is good for editing the article.

  • Retrieves only the markup text for ID number 5, which is good for viewing the source markup for the article. The URI title could be used in place of article ID.
    GET request.
    /articles/markup/5
    /articles/markup/this-is-a-test

  • Retrieves only the HTML text for ID number 5, which is good for displaying an article.The URI title could be used in place of article ID.
    GET request.
    /articles/html/5
    /articles/html/this-is-a-test

  • Retrieves list of related articles based upon a single article's hash tags.
    GET request
    /articles/related/5
    /articles/related/this-is-a-test

  • Create a new article.
    POST request.
    /articles
    In addition to the name=value logged-in credentials listed above, the client sends the following JSON to the API:
    { "article_text" : "this is the article text." }
    Sample returned JSON:
    {"article_id":"9","status":201,"description":"Created"}

  • Update article with ID number 5.
    PUT request
    /articles
    In addition to the name=value logged-in credentials listed above, the client sends the following JSON to the API:
    { "article_id": "5", "article_digest": "ru48f9re39jf023jf", "article_text":"updated text"}

  • Delete an article with ID number 5.
    GET request.
    /articles/delete/5

  • Undelete an article with ID number 5.
    GET request.
    /articles/undelete/5

Notes

  • Show all notes for user JR.
    GET request.
    /notes/user/JR

  • Show page three of the stream of notes for user JR.
    GET request.
    /notes/user/JR/page/3

Drafts

  • Show all drafts for user JR.
    GET request.
    /drafts/user/JR

  • Show page three of the stream of drafts for user JR.
    GET request.
    /drafts/user/JR/page/3

Tags

  • Show list of tags, sorted by name
    GET request
    /tags/name

  • Show list of tags, sorted by count
    GET request
    /tags/count

Versions

  • Show version list for article ID or article URL/URI title
    GET request
    /versions/5
    /versions/this-is-a-test

  • Compare two article versions based upon their numeric article IDs. This example compares article article ID 1 and article ID 2
    GET request
    /versions/1/2

Searches

GET requests

/searches/string/text+string /searches/string/text+string/3 - page 3 of stream

prob like /searches/string/text%2Bstring

/searches/tag/tagname
/searches/tag/tagname/3 - page 3 of stream

Returned JSON

Get article for user who is not the author.


{
"status"                   :  200,
"description"              :  "OK",
"parent_id"                :  "0",
"article_id"               :  "9",
"title"                    :  "2014-05-02 15:13:57 this will be the title",
"uri_title"                :  "20140502-15-13-57-this-will-be-the-title",
"formatted_text"           :  "<p>here is the start of the body text</p>\n\n<p>here is some more text.</p>\n\n<p>testin <strong>markdown bolding</strong></p>\n\n<p>hashtag <a href=\"/tag/test\">#test</a> <a href=\"/tag/perl\">#perl</a></p>\n",
"author_name"              :  "testuser1398830044",
"created_date"             :  "2014-05-02 15:13:58",
"modified_date"            :  "2014-05-02 15:13:58",
"formatted_created_date"   :  "May 02, 2014"
"formatted_modified_date"  :  "May 02, 2014",
"reader_is_author"         :  0,
"article_status"           :  "o",
"article_type"             :  "a",
"related_articles_count"   :  2,
"version"                  :  "1",
"tags"                     :  "|test|perl|",
}

May 5, 2014 Proposed Changes

Show all articles. GET request. /articles
/articles/?sortby=modifi /articles/?page=3
/articles/?author=jr
/articles/?year=2014&month=05&day=02

Retrieve article for ID number 5. GET request. /articles/5 /articles/5?/text=markup
/articles/5/?text=formatted

Retrieve list of related articles.
/articles/5/?related=yes

Streams of Posts

  • /articles/2014/05/02
  • /articles/2014/05
  • /articles/2014
  • /articles

-

  • /articles/2014/05/02/?page=2&type=drafts
  • /articles/2014/05/?page=12&type=notes
  • /articles/2014/?page=34
  • /articles/?page=123

-

  • /drafts/2014/05/02
  • /drafts/2014/05
  • /drafts/2014
  • /drafts

-

  • /notes/2014/05/02
  • /notes/2014/05
  • /notes/2014
  • /notes

-

  • /tags/food
  • OR /searches/tag/tagname

-

  • /searches/string/search+string

  • /notes/2014/05/?author=jr&page=2

  • /articles/?sortby=changes

Lists

  • /users ???
  • /tags/?sortby=name
  • /tags/?sortby=count

Profile Page

From JR's : articles
830 words - 6958 chars - 4 min read
created on
updated on - #
source - versions

Related articles
Grebe API - Old Page - Jul 18, 2014
Web-based publishing platforms that I've created - Mar 03, 2015
Indieweb links aug 29, 2016 - Aug 29, 2016
Grebe API Returned JSON - Aug 19, 2014
Draftin.com WebHook URL info - Aug 09, 2013
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: May 3, 2024 - 1:20 p.m. EDT