adnx.tanchinhdo.api

<back to all web services

GetPostByCategoryRequest

The following routes are available for this service:
GET/posts/{category}
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports adnx.tanchinhdo.api.ServiceModel
Imports adnx.tanchinhdo.data.Models

Namespace Global

    Namespace adnx.tanchinhdo.api.ServiceModel

        Public Partial Class GetPostByCategoryRequest
            Inherits PagingRequest
            Public Overridable Property Category As String
        End Class

        Public Partial Class PageResponse(Of PostResponse)
            Implements IResponseRequest
            Public Sub New()
                Data = New List(Of PostResponse)
            End Sub

            Public Overridable Property Code As Integer
            Public Overridable Property Message As String
            Public Overridable Property Data As List(Of PostResponse)
            Public Overridable Property Pagination As Pagination
        End Class

        Public Partial Class Pagination
            Public Overridable Property Total As Long
            Public Overridable Property Pages As Integer
            Public Overridable Property Offset As Long
            Public Overridable Property Limit As Integer
            Public Overridable Property CurrentPage As Integer
        End Class

        Public Partial Class PagingRequest
            Public Overridable Property Page As Integer
            Public Overridable Property Limit As Integer
            Public Overridable Property OffSet As Integer
        End Class
    End Namespace

    Namespace adnx.tanchinhdo.data.Models

        Public Partial Class CategoryResponse
            Public Overridable Property Id As Integer
            Public Overridable Property Name As String
            Public Overridable Property Slug As String
        End Class

        Public Partial Class PostResponse
            Public Overridable Property Id As Integer
            Public Overridable Property Title As String
            Public Overridable Property Slug As String
            Public Overridable Property Description As String
            Public Overridable Property Body As String
            Public Overridable Property CategoryId As Integer
            Public Overridable Property Category As CategoryResponse
            Public Overridable Property ImageUrl As String
            Public Overridable Property ViewCount As Integer
            Public Overridable Property IsPublished As Boolean
            Public Overridable Property PublishedDate As Date
            Public Overridable Property CreatedDate As Date
            Public Overridable Property UpdatedDate As Date
        End Class
    End Namespace
End Namespace

VB.NET GetPostByCategoryRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /posts/{category} HTTP/1.1 
Host: tanchinhdo-api-sandbox.adnx.vn 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	code: 0,
	message: String,
	data: 
	[
		{
			id: 0,
			title: String,
			slug: String,
			description: String,
			body: String,
			categoryId: 0,
			category: 
			{
				id: 0,
				name: String,
				slug: String
			},
			imageUrl: String,
			viewCount: 0,
			isPublished: False
		}
	]
}