Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "status": "ok",
- "count": 1,
- "pages": 1,
- "category": {
- "id": 44,
- "slug": "flex-print",
- "title": "Flex Print",
- "description": "Flex Print",
- "parent": 7,
- "post_count": 1
- },
- "posts": [
- {
- "id": 343,
- "type": "post",
- "slug": "nk-advertising",
- "url": "https://btownmedia.com/2018/10/10/nk-advertising/",
- "status": "publish",
- "title": "NK Advertising",
- "title_plain": "NK Advertising",
- "content": "<p style="color: #7a6666; font-family: roboto-regular-webfont; font-size: 14px; line-height: 24px; margin: 0px; padding: 0px 0px 19px; width: 370px;"><strong>Online advertisement:</strong> <em>Online advertisement on our website</em> means our basic service. Your business card or a visiting card sized advertisement is displayed on our website for pre-mentioned time frame.</p>n<p style="color: #7a6666; font-family: roboto-regular-webfont; font-size: 14px; line-height: 24px; margin: 0px; padding: 0px 0px 19px; width: 370px;"><strong>Personalized page:</strong> We offer you a personalized page, designed for your business with all the details of your business- linked with your advertisement that opens when clicked.</p>n",
- "excerpt": "<p>Online advertisement on our website means our basic service. Your business card or a visiting card sized advertisement is displayed on our website for pre-mentioned time frame.</p>n",
- "date": "2018-10-10 08:08:29",
- "modified": "2018-10-10 08:08:29",
- "categories": [
- {
- "id": 44,
- "slug": "flex-print",
- "title": "Flex Print",
- "description": "Flex Print",
- "parent": 7,
- "post_count": 1
- }
- ],
- "tags": [],
- "author": {
- "id": 1,
- "slug": "admin",
- "name": "admin",
- "first_name": "",
- "last_name": "",
- "nickname": "admin",
- "url": "",
- "description": ""
- },
- "comments": [],
- "attachments": [
- {
- "id": 342,
- "url": "https://btownmedia.com/nk/",
- "slug": "nk",
- "title": "nk",
- "description": "",
- "caption": "",
- "parent": 343,
- "mime_type": "image/png",
- "images": {
- "full": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "thumbnail": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "medium": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "medium_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpg_gallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "rpg_gallery_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "estore-featured-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-product-grid": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-75x75.png",
- "width": 75,
- "height": 75
- },
- "estore-square": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-slider": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-medium-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- }
- }
- }
- ],
- "comment_count": 0,
- "comment_status": "open",
- "thumbnail": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "custom_fields": {},
- "thumbnail_size": "thumbnail",
- "thumbnail_images": {
- "full": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "thumbnail": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "medium": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "medium_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpg_gallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "rpg_gallery_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "estore-featured-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-product-grid": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-75x75.png",
- "width": 75,
- "height": 75
- },
- "estore-square": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-slider": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-medium-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- }
- }
- }
- ]
- private Integer id;
- private String type;
- private String slug;
- private String url;
- private String status;
- private String title;
- private String titlePlain;
- private String content;
- private String excerpt;
- private String date;
- private String modified;
- private List<Object> tags = null;
- private List<Object> comments = null;
- private Integer commentCount;
- private String commentStatus;
- private String thumbnail;
- private String thumbnailSize;
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- public String getType() {
- return type;
- }
- public void setType(String type) {
- this.type = type;
- }
- public String getSlug() {
- return slug;
- }
- public void setSlug(String slug) {
- this.slug = slug;
- }
- public String getUrl() {
- return url;
- }
- public void setUrl(String url) {
- this.url = url;
- }
- public String getStatus() {
- return status;
- }
- public void setStatus(String status) {
- this.status = status;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public String getTitlePlain() {
- return titlePlain;
- }
- public void setTitlePlain(String titlePlain) {
- this.titlePlain = titlePlain;
- }
- public String getContent() {
- return content;
- }
- public void setContent(String content) {
- this.content = content;
- }
- public String getExcerpt() {
- return excerpt;
- }
- public void setExcerpt(String excerpt) {
- this.excerpt = excerpt;
- }
- public String getDate() {
- return date;
- }
- public void setDate(String date) {
- this.date = date;
- }
- public String getModified() {
- return modified;
- }
- public void setModified(String modified) {
- this.modified = modified;
- }
- public List<Object> getTags() {
- return tags;
- }
- public void setTags(List<Object> tags) {
- this.tags = tags;
- }
- public List<Object> getComments() {
- return comments;
- }
- public void setComments(List<Object> comments) {
- this.comments = comments;
- }
- public Integer getCommentCount() {
- return commentCount;
- }
- public void setCommentCount(Integer commentCount) {
- this.commentCount = commentCount;
- }
- public String getCommentStatus() {
- return commentStatus;
- }
- public void setCommentStatus(String commentStatus) {
- this.commentStatus = commentStatus;
- }
- public String getThumbnail() {
- return thumbnail;
- }
- public void setThumbnail(String thumbnail) {
- this.thumbnail = thumbnail;
- }
- public String getThumbnailSize() {
- return thumbnailSize;
- }
- public void setThumbnailSize(String thumbnailSize) {
- this.thumbnailSize = thumbnailSize;
- }
- @GET("json=get_category_posts&slug=flex-print&status=publish")
- Call<Post> getListPost();
- void getListPosts() {
- Retrofit retrofit = new Retrofit.Builder()
- .baseUrl(url1)
- .addConverterFactory(GsonConverterFactory.create())
- .build();
- RetrofitArrayAPI service = retrofit.create(RetrofitArrayAPI.class);
- Log.d("service", String.valueOf(""));
- Call<Post> call = service.getListPost();
- call.enqueue(new Callback<Post>() {
- @Override
- public void onResponse(Response<Post> response, Retrofit retrofit) {
- try {
- Log.d("Title", String.valueOf(response.body()));
- } catch (Exception e) {
- Log.d("onResponse", "There is an error");
- e.printStackTrace();
- }
- }
- @Override
- public void onFailure(Throwable t) {
- Log.d("onFailure", t.toString());
- }
- });
- }
- "posts": [
- {
- "id": 343,
- "type": "post",
- "slug": "nk-advertising",
- "url": "https://btownmedia.com/2018/10/10/nk-advertising/",
- "status": "publish",
- "title": "NK Advertising",
- "title_plain": "NK Advertising",
- "content": "<p style="color: #7a6666; font-family: roboto-regular-webfont; font-size: 14px; line-height: 24px; margin: 0px; padding: 0px 0px 19px; width: 370px;"><strong>Online advertisement:</strong> <em>Online advertisement on our website</em> means our basic service. Your business card or a visiting card sized advertisement is displayed on our website for pre-mentioned time frame.</p>n<p style="color: #7a6666; font-family: roboto-regular-webfont; font-size: 14px; line-height: 24px; margin: 0px; padding: 0px 0px 19px; width: 370px;"><strong>Personalized page:</strong> We offer you a personalized page, designed for your business with all the details of your business- linked with your advertisement that opens when clicked.</p>n",
- "excerpt": "<p>Online advertisement on our website means our basic service. Your business card or a visiting card sized advertisement is displayed on our website for pre-mentioned time frame.</p>n",
- "date": "2018-10-10 08:08:29",
- "modified": "2018-10-10 08:08:29",
- "categories": [
- {
- "id": 44,
- "slug": "flex-print",
- "title": "Flex Print",
- "description": "Flex Print",
- "parent": 7,
- "post_count": 1
- }
- ],
- "tags": [],
- "author": {
- "id": 1,
- "slug": "admin",
- "name": "admin",
- "first_name": "",
- "last_name": "",
- "nickname": "admin",
- "url": "",
- "description": ""
- },
- "comments": [],
- "attachments": [
- {
- "id": 342,
- "url": "https://btownmedia.com/nk/",
- "slug": "nk",
- "title": "nk",
- "description": "",
- "caption": "",
- "parent": 343,
- "mime_type": "image/png",
- "images": {
- "full": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "thumbnail": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "medium": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "medium_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpg_gallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "rpg_gallery_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "estore-featured-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-product-grid": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-75x75.png",
- "width": 75,
- "height": 75
- },
- "estore-square": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-slider": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-medium-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- }
- }
- }
- ],
- "comment_count": 0,
- "comment_status": "open",
- "thumbnail": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "custom_fields": {},
- "thumbnail_size": "thumbnail",
- "thumbnail_images": {
- "full": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "thumbnail": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "medium": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "medium_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpggallery_admin_large": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "rpg_gallery_admin_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "rpg_gallery_thumb": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-150x142.png",
- "width": 150,
- "height": 142
- },
- "estore-featured-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-product-grid": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk-75x75.png",
- "width": 75,
- "height": 75
- },
- "estore-square": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-slider": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- },
- "estore-medium-image": {
- "url": "https://btownmedia.com/wp-content/uploads/2018/10/nk.png",
- "width": 230,
- "height": 142
- }
- }
- }
- class APIResponse {
- public List<Post> posts;
- // add the other fields from your response if you need them
- }
- @GET("json=get_category_posts&slug=flex-print&status=publish")
- Call<APIResponse> getListPost();
- public static class PostAdapter implements JsonDeserializer<List<Post>> {
- public List<Post> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext ctx) {
- List<Post> vals = new ArrayList<>();
- if (json.has("posts") && .json.get("posts").isJsonArray()) {
- for (JsonElement e : json.get("posts").getAsJsonArray()) {
- vals.add((Post) ctx.deserialize(e, Post.class));
- }
- }
- return vals;
- }
- }
- Type postListType = new TypeToken<List<Post>>() {}.getType();
- Gson gson = new GsonBuilder()
- .registerTypeAdapter(postListType, new PostAdapter())
- .create();
- Retrofit retrofit = new Retrofit.Builder()
- .baseUrl(url1)
- .addConverterFactory(GsonConverterFactory.create(gson))
- .build();
- @GET("json=get_category_posts&slug=flex-print&status=publish")
- Call<List<Post>> getListPost();
Add Comment
Please, Sign In to add comment