| GET | /posts/{category} |
|---|
import java.math.*;
import java.util.*;
import net.servicestack.client.*;
import com.google.gson.annotations.*;
import com.google.gson.reflect.*;
public class dtos
{
public static class GetPostByCategoryRequest extends PagingRequest
{
public String category = null;
public String getCategory() { return category; }
public GetPostByCategoryRequest setCategory(String value) { this.category = value; return this; }
}
public static class PagingRequest
{
public Integer page = null;
public Integer limit = null;
public Integer offSet = null;
public Integer getPage() { return page; }
public PagingRequest setPage(Integer value) { this.page = value; return this; }
public Integer getLimit() { return limit; }
public PagingRequest setLimit(Integer value) { this.limit = value; return this; }
public Integer getOffSet() { return offSet; }
public PagingRequest setOffSet(Integer value) { this.offSet = value; return this; }
}
public static class PageResponse<PostResponse> implements IResponseRequest
{
public Integer code = null;
public String message = null;
public ArrayList<PostResponse> data = null;
public Pagination pagination = null;
public Integer getCode() { return code; }
public PageResponse<PostResponse> setCode(Integer value) { this.code = value; return this; }
public String getMessage() { return message; }
public PageResponse<PostResponse> setMessage(String value) { this.message = value; return this; }
public ArrayList<PostResponse> getData() { return data; }
public PageResponse<PostResponse> setData(ArrayList<PostResponse> value) { this.data = value; return this; }
public Pagination getPagination() { return pagination; }
public PageResponse<PostResponse> setPagination(Pagination value) { this.pagination = value; return this; }
}
public static class PostResponse
{
public Integer id = null;
public String title = null;
public String slug = null;
public String description = null;
public String body = null;
public Integer categoryId = null;
public CategoryResponse category = null;
public String imageUrl = null;
public Integer viewCount = null;
public Boolean isPublished = null;
public Date publishedDate = null;
public Date createdDate = null;
public Date updatedDate = null;
public Integer getId() { return id; }
public PostResponse setId(Integer value) { this.id = value; return this; }
public String getTitle() { return title; }
public PostResponse setTitle(String value) { this.title = value; return this; }
public String getSlug() { return slug; }
public PostResponse setSlug(String value) { this.slug = value; return this; }
public String getDescription() { return description; }
public PostResponse setDescription(String value) { this.description = value; return this; }
public String getBody() { return body; }
public PostResponse setBody(String value) { this.body = value; return this; }
public Integer getCategoryId() { return categoryId; }
public PostResponse setCategoryId(Integer value) { this.categoryId = value; return this; }
public CategoryResponse getCategory() { return category; }
public PostResponse setCategory(CategoryResponse value) { this.category = value; return this; }
public String getImageUrl() { return imageUrl; }
public PostResponse setImageUrl(String value) { this.imageUrl = value; return this; }
public Integer getViewCount() { return viewCount; }
public PostResponse setViewCount(Integer value) { this.viewCount = value; return this; }
public Boolean getIsPublished() { return isPublished; }
public PostResponse setIsPublished(Boolean value) { this.isPublished = value; return this; }
public Date getPublishedDate() { return publishedDate; }
public PostResponse setPublishedDate(Date value) { this.publishedDate = value; return this; }
public Date getCreatedDate() { return createdDate; }
public PostResponse setCreatedDate(Date value) { this.createdDate = value; return this; }
public Date getUpdatedDate() { return updatedDate; }
public PostResponse setUpdatedDate(Date value) { this.updatedDate = value; return this; }
}
public static class CategoryResponse
{
public Integer id = null;
public String name = null;
public String slug = null;
public Integer getId() { return id; }
public CategoryResponse setId(Integer value) { this.id = value; return this; }
public String getName() { return name; }
public CategoryResponse setName(String value) { this.name = value; return this; }
public String getSlug() { return slug; }
public CategoryResponse setSlug(String value) { this.slug = value; return this; }
}
public static class Pagination
{
public Long total = null;
public Integer pages = null;
public Long offset = null;
public Integer limit = null;
public Integer currentPage = null;
public Long getTotal() { return total; }
public Pagination setTotal(Long value) { this.total = value; return this; }
public Integer getPages() { return pages; }
public Pagination setPages(Integer value) { this.pages = value; return this; }
public Long getOffset() { return offset; }
public Pagination setOffset(Long value) { this.offset = value; return this; }
public Integer getLimit() { return limit; }
public Pagination setLimit(Integer value) { this.limit = value; return this; }
public Integer getCurrentPage() { return currentPage; }
public Pagination setCurrentPage(Integer value) { this.currentPage = value; return this; }
}
}
Java GetPostByCategoryRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=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
}
]
}