Returns json data about articles.
-
URL
/articles/
-
Method:
GET
-
URL Params
Required:
None
Optional
title = [String]
-
Data Params
None
-
Success Response:
- Code: 200
Content:{"_id":"1","title":"REST","content":"REST is short for representational State Transfer"}
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "No articles matching that title was found." }
- Code: 404 NOT FOUND
-
Sample Call:
$.ajax({ url: "/articles/REST", dataType: "json", type : "GET", success : function(r) { console.log(r); } });
Creates a new article.
-
URL
/articles/
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
title = [String]
content = [String]
-
Success Response:
- Code: 200
Content:Successfully added a new article.
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:Cannot POST /articles/Daniyal
- Code: 400 BAD REQUEST
-
Sample Call:
$.ajax({ url: "/articles/", dataType: "json", type : "POST", data : { title: "JQuery", content: "jQuery is a fast, small, and feature-rich JavaScript library." }, success : function(r) { console.log(r); } });