-
git clone https://github.com/i-akash/Blog-Rest-Api-Cefalo-Project.git
-
go to the
BlogApi
folder in root folder -
dotnet restore
-
dotnet ef database update
(N.B. must need SQL Server and entity framework tools support
) -
dotnet run
- both
JSON
andXML
(based onaccept
headers)
Request Body Constraints
{
userId* string
maxLength: 100
minLength: 5
pattern: ^[a-zA-Z0-9]*$
nullable: true
firstName* string
maxLength: 100
minLength: 5
pattern: ^[a-zA-Z]*$
nullable: true
lastName string
maxLength: 100
pattern: ^[a-zA-Z]*$
nullable: true
password* string
min alphabet: 2
min numeric: 1
min length: 5
nullable: true
}
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
Request Body
{
"userId": "akaash",
"firstName": "uttom",
"lastName": "akash",
"password": "secret7"
}
Response Body (200 Ok)
{
"status": 0,
"message": "Added"
}
Request Body Constraints
{
userId* string
password* string
}
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
Request Body
{
"userId": "akaash",
"password": "secret7"
}
Response Body (200 Ok)
{
"jwtToken": "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiJha2FzaCIsIkRldiI6ImFrYXNoIiwiZXhwIjoxNTgzMjI5NDYwLCJpc3MiOiJjZWZhbG8uY29tIiwiYXVkIjoiY2VmYWxvIn0.daLH7Lwe4GeMBDRsZPTf7M5OH2Cbd0GUiPFPjbq88sk",
"userId": "akash",
"firstName": "string",
"lastName": "string"
}
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
404 | Not Found |
Response Body (200 Ok)
{
"userId": "stringakash",
"firstName": "string",
"lastName": "string"
}
- N.B. Here skip and top optional
- skip=0 (default value)
- top=50 (default value)
Response Status
Status Code | Message |
---|---|
200 | OK |
Response Body (200 Ok)
[
{
"userId": "strin11g",
"firstName": "string",
"lastName": "string"
},
{
"userId": "string",
"firstName": "string",
"lastName": "string"
}
]
Request Header
Authorization: Bearer <Token>
Request Body Constraints
{
oldPassword string
nullable: true
newPassword string
nullable: true
}
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
403 | Forbidden |
404 | Not Found |
Request Body
{
"oldPassword": "secret7",
"newPassword": "secret78"
}
Response Body (200 Ok)
{
"status": 4,
"message": "Modified"
}
Request Header
Authorization: Bearer <Token>
Request Body
{
storyId string($uuid)
title* string
maxLength: 250
minLength: 10
nullable: true
body* string
minLength: 100
nullable: true
publishedDate* string ($date) : "2020-02-28"
}
Request Status
Status Code | Message |
---|---|
201 | Created |
400 | Bad Request |
Request Body
{
"title": "Lorem Ipsum",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"publishedDate": "2020-02-28"
}
Response Header
Location : http://localhost:5000/v1/Stories/story/{storyId}
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
404 | Not Found |
Response Body (200 Ok)
{
"storyId": "3fa85f64-5717-4562-b3fc-2c963f66ac12",
"title": "Lorem Ipsum",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"publishedDate": "2020-02-28T00:00:00",
"author": {
"userId": "akash",
"firstName": "string",
"lastName": "string"
}
}
-
query
( type : string ) ( Optional ) ( Default : "" )
-
skip
(type : integer) ( Optional ) ( Default : 0 )
-
top
(type : integer) ( Optional ) ( Default : 50 )
Full Text Search
requireSql Server
is Configured withStories Title
andStories Body
Full text Search Indexing- Default Behavior
Like
operator will do search
Response Status
Status Code | Message |
---|---|
200 | OK |
Request
http://localhost:5000/v1/Stories/stories/0/1?query=lorem
Response Body
[
{
"storyId": "7e6b8dc2-e0a4-43a1-bc22-49e43e8b706b",
"title": "EF Core Tutorial",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"publishedDate": "2020-02-29T00:00:00",
"author": {
"userId": "akash",
"firstName": "uttom",
"lastName": "akash"
}
}
]
Request Header
Authorization: Bearer <Token>
Request Body Constraints
{
storyId* string($uuid)
title* string
maxLength: 250
minLength: 10
nullable: true
body* string
minLength: 100
nullable: true
publishedDate* string($date)
}
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
403 | Forbidden |
404 | Not Found |
Request Body
{
"storyId": "3fa85f64-5717-4562-b3fc-2c963f66ac12",
"title": "Lorem Ipsum",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"publishedDate": "2020-02-28T00:00:00"
}
Response Body (200 Ok)
{
"status": 4,
"message": "Modified"
}
Request Header
Authorization: Bearer <Token>
Response Status
Status Code | Message |
---|---|
200 | OK |
400 | Bad Request |
403 | Forbidden |
404 | Not Found |
Response Body* (200 Ok)
{
"status": 6,
"message": "Deleted"
}
{
"status": 500,
"message": "",
"source": "Core Microsoft SqlClient Data Provider"
}
{
"type": "",
"title": "",
"status": 400,
"traceId": "",
"errors": {
"field": [
"message"
]
}
}
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
"title": "Not Found",
"status": 404,
"traceId": "|d0d22e0c-4085cb953271417c."
}