Api documentation

We provide public api at the host of https://www.goodfeat.com

Authentication

Endpoint: [POST] /wp-json/jwt-auth/v1/token

Request Params:

{ username: '<username>', password: '<password>'}

Responseļ¼š

class TokenResponse {
  token: string;
  user_display_name: string;
  user_email: string;
  user_nicename: string;
}

Example Code:

const baseUrl = 'https://www.goodfeat.com'
fetch(`${baseUrl}/wp-json/jwt-auth/v1/token`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ username: '<username>', password: '<password>'}), // replace <username>, <password> with your account info,
})
.then((res) => res.json())
.then((data) => {
  console.log(data);
})

Resources

Categories

Category schema info:

class Category {
  count: integer; // post count
  description: string;
  id: integer;
  link: urlString;
  meta: []
  name: string;
  parent: integer;
  slug: string;
  taxonomy: "category"
}

Get Categories

Endponit: [GET] /wp-json/wp/v2/categories

Response:

class CategoriesResponse {
  Array<Category>
}

Example Code:

const baseUrl = 'https://www.goodfeat.com'
fetch(`${baseUrl}/wp-json/wp/v2/categories`)
  .then(res => res.json())
  .then((data) => {
    console.log(data);
  })

Posts

Post data schema info:

class Post {
  id: integer;
  date: dateString;
  date_gmt: dateString;
  guid: {
    rendered: urlString;
  },
  modified: dateString;
  modified_gmt: dateString;
  slug: string;
  type: "post";
  link: urlString;
  title: {
    rendered: string;
  };
  content: {
    rendered: htmlString;
    protected: boolean;
  };
  author: integer;
  featured_media: integer;
  comment_status: CommetStatusOption;
  ping_status: PingStatusOption;
  sticky: boolean;
  template: string;
  format: FormatOption;
  meta: Array;
  categories: Array<categoryId>;
  tags: Array<tagId>;
  _links: Array<ResourceReferenceLink>;

}

enum CommetStatusOption {
  open: 'open';
  close: 'close';
}

enum FormatOption {
  standard: 'standard';
}

Get Posts

Endpoint: [GET] /wp/v2/posts

Response:

class PostsResponse {
  Array<Post>
}
Basic Example
const baseUrl = 'https://www.goodfeat.com'
fetch(`${baseUrl}/wp/v2/posts`)
.then((res) => res.json())
.then((data) => {
  console.log(data);
})
Get Posts of category
const baseUrl = 'https://www.goodfeat.com'
const categoryId = 1;
fetch(`${baseUrl}/wp/v2/posts?filter[cat]=${categoryId}`)
.then((res) => res.json())
.then((data) => {
  console.log(data);
})