Skip to content

API Documentation

Ramesh syangtan edited this page Dec 12, 2017 · 2 revisions

Codestories

API allowing consumers to view users, articles.

Stories endpoint [/stories]

List All Stories [GET]

  • Response 200 (application/json)

      [
          {
              "_id": "12334ertt",
              "author": "userid"
              "published_at": "2015-08-05T08:40:51.620Z",
              "title": "Coding tips and tricks",
              "story": "The Story"
          },
          {
              "_id": "34rf566",
              "author": "userid"
              "published_at": "2015-08-05T08:40:51.620Z",
              "title": "Coding ",
              "story": "Story bla bla bla"
          }
      ]
    

Single story endpoint [/story/:id]

List a story by id [GET]

  • Response 200 (application/json)

          {
              "_id": "12334ertt",
              "author": "userid",
              "published_at": "2015-08-05T08:40:51.620Z",
              "title": "Coding tips and tricks",
              "story": "The Story"
          }
    

Create a New Story [POST]

It takes a JSON object containing a title and the content of the story. Returns an object containing id, title, story, time of creation, author

  • Request (application/json)

          {
              "title": "Coding tips and tricks",
              "story": "The Story"
          }
    
  • Response 201 (application/json)

    • Headers

        Location: /story/2
      
    • Body

        {
            "_id": "12334ertt",
            "author": "userid",
            "published_at": "2015-08-05T08:40:51.620Z",
            "title": "Coding tips and tricks",
            "story": "The Story"
        }