GET /stories

Returns paginated JSON data about stories.

URL:
/stories

Method:
GET

URL Parameters:

  • none

Data Parameters:

  • page=[integer]
  • lang=[string] filters stories on given language code
  • source=[boolean]: if set, only articles that are originals (not translations of other articles) will be returned
  • status=[string]: possible values published, draft, scheduled (defaults to published)

Success Response:
Code: 200 OK
Content: 

{
    "data": [
        {
            "id": 735022272,
            "title": "Story example",
            "language": "en",
            "published_at": "2017-04-14T08:39:26+02:00"
        },
        ...
    ],
    "meta": {
        "pagination": {
            "total": 50,
            "count": 10,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 5,
            "links": {
                "next": "https://api.storychief.io/1.0/stories?page=2"
            }
        }
    }
}

Error Response:
Code: 401 UNAUTHORIZED
Content: 

{ error : "You are unauthorized to make this request." }

GET /stories/{id}

Returns JSON data about a story.

URL:
/stories/{id}

Method:
GET

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Success Response:
Code: 200 OK
Content: 

{  
   "data":{  
      "id":1310471909,
      "title":"Test 2",
      "slug":"test-2",
      "excerpt":null,
      "featured_image":{  
         "data":{  
            "url":"https://d2wvyaiai4v4wx.cloudfront.net/../image.jpg",
            "name":"image.jpg",
            "sizes":{  
               "regular":"https://d3hryyoxn74gk4.cloudfront.net/../image_800.jpg",
               "large":"https://d3hryyoxn74gk4.cloudfront.net/../image_1000.jpg",
               "full":"https://d3hryyoxn74gk4.cloudfront.net/../image_2000.jpg"
            }
         }
      },
      "tags":{  
         "data":[  
            {  
               "id":958403743,
               "name":"Awesome",
               "slug":"awesome"
            }
         ]
      },
      "primaryCategory":{  
         "data":{  
            "id":937203467,
            "name":"Marketing",
            "slug":"marketing"
         }
      },
      "categories":{  
         "data":[  
            {  
               "id":937203467,
               "name":"Marketing",
               "slug":"marketing"
            }
         ]
      },
      "author":{  
         "data":{  
            "first_name":"Gregory",
            "last_name":"Claeyssens",
            "bio":null,
            "email":"gregory@test.com",
            "profile_picture":{  
               "data":{  
                  "url":"https://d2wvyaiai4v4wx.cloudfront.net/../image.jpg",
                  "name":"profile-1501858473.jpg",
                  "sizes":{  
                     "regular":"https://d3hryyoxn74gk4.cloudfront.net/../image_800.jpg",
                     "large":"https://d3hryyoxn74gk4.cloudfront.net/../image_1000.jpg",
                     "full":"https://d3hryyoxn74gk4.cloudfront.net/../image_2000.jpg"
                  }
               }
            }
         }
      },
      "language":"en",
      "translations": {
      "data": [
         {
            "id": 111111111,
            "title": "Ceci nest pas une pipe",
            "language": "fr",
            "published_at": "2017-06-10T14:36:40+02:00"
         }
      ]},
      "published_at":"2017-06-08T14:36:16+02:00",
      "content":"<p>Full Article content</p>"
   }
}


Error Response:
Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated",
      "status":401
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}

POST /stories

Create a new story.

URL:
/stories

Method:
POST

URL Parameters:

  • none

Data Parameters:

  • none

Body (json):
Only the title is a required input field.

{  
   "title": "Lorem ipsum dolor",
   "slug": "lorem-ipsum",
   "author_id": 937203467,
   "featured_image": "https://example.com/my-image.jpg",
   "categories": [234567891,345678912],
   "tags": [123456789],
   "language": "en",
   "body": "<p>Hi there<\/p>"
}

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 123456789,
        "title": "Lorem ipsum dolor",
        "language": "en",
        "published_at": null
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}

PUT /stories/{id}

Updates an existing story.

URL:
/stories/{id}

Method:
POST

URL Parameters:

  • none

Data Parameters:

  • none

Body (json): 

{  
   "body": "<p>Hi there<\/p>"
}

Available attributes for update are: 

  • title 
  • body 
  • excerpt 
  • featured_image 
  • categories
  • tags

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 123456789,
        "title": "Lorem ipsum dolor",
        "language": "en",
        "published_at": null
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}
Did this answer your question?