Module in WordPress REST API with custom wp-json and Post Types. Includes WP theme and docker that provides a develop environment.
Used Restsplain to document and test.
http://localhost:8081/api-docs/
Send a POST
request to http://localhost:8081/jwt-auth/v1/token
.
curl -XGET http://localhost:8081/jwt-auth/v1/token
Use wp-graphql plugin that provide a GraphQL endpoint at http://localhost:8081/graphql
. The plugin must be installed and pretty permalinks enabled.
List all events from WordPress dashboard
Parameter | Type | Required | Description |
---|---|---|---|
status |
string | ❌ | GET filtered by any WP status type. (Default is future ) |
slug |
string | ❌ | GET filtered by slug |
per-page |
int | ❌ | GET filtered by limit informed. If not informed returns all records |
category |
string | ❌ | GET filtered by category slug |
today |
int | ❌ | GET filtered events by current date |
city |
string | ❌ | GET filtered by city slug |
featured |
int | ❌ | GET filtered by featured events. (1: Yes, 0: No) |
trending |
int | ❌ | GET filtered by trending events. (1: Yes, 0: No) |
[
{
"id": 1,
"status": "future",
"featured": "0",
"trending": "0",
"title": "Sample Event",
"image": "http://localhost:8081/wp-content/uploads/2019/01/image.jpeg",
"about": "Sample event description",
"price": "U$100,00",
"date": "01/01/2019 at 08:00pm",
"contact": "Get in touch on (877) 412–7753",
"address": "Cupertino, CA 95014",
"where": "Apple Campus",
"city": {
"slug": "cupertino",
"title": "Cupertino"
},
"category": {
"slug": "concerts",
"title": "Concerts"
},
"where_to_buy": {
"slug": "buy-your-ticket",
"title": "Buy Your Ticket",
"url": "http://www.buyyourticket.com"
}
}
]
List event by event slug
{
"id": 1,
"status": "future",
"featured": "0",
"trending": "0",
"title": "Sample Event",
"image": "http://localhost:8081/wp-content/uploads/2019/01/image.jpeg",
"about": "Sample event description",
"price": "U$100,00",
"date": "01/01/2019 at 08:00pm",
"contact": "Get in touch on (877) 412–7753",
"address": "Cupertino, CA 95014",
"where": "Apple Campus",
"city": {
"slug": "cupertino",
"title": "Cupertino"
},
"category": {
"slug": "concerts",
"title": "Concerts"
},
"where_to_buy": {
"slug": "buy-your-ticket",
"title": "Buy Your Ticket",
"url": "http://www.buyyourticket.com"
}
}
List all categories
[
{
"slug": "concerts",
"title": "Concerts",
"about": "Sample text description",
"count": 3
},
{
"slug": "meetup",
"title": "Meetup",
"about": "Sample text description",
"count": 2
}
]
List all cities
[
{
"slug": "cupertino",
"title": "Cupertino",
"events": [
{
"id": 1,
"status": "future",
"featured": "0",
"trending": "0",
"title": "Sample Event",
"image": "http://localhost:8081/wp-content/uploads/2019/01/image.jpeg",
"about": "Sample event description",
"price": "U$100,00",
"date": "01/01/2019 at 08:00pm",
"contact": "Get in touch on (877) 412–7753",
"address": "Cupertino, CA 95014",
"where": "Apple Campus",
"category": {
"slug": "concerts",
"title": "Concerts"
},
"where_to_buy": {
"slug": "buy-your-ticket",
"title": "Buy Your Ticket",
"url": "http://www.buyyourticket.com"
}
}
]
}
]
Clone this repo:
$ git clone https://github.com/purai/wp_api.git
Add theme folder theme/server
into any WordPress directory, like .../wp-content/themes/
.
Clone this repo:
$ git clone https://github.com/purai/wp_api.git
Start out development environment from docker-composer.yml file:
$ docker-compose up
The above command will run docker-compose in the foreground. If you would rather run it as a background process, you use the -d flag.
$ docker-compose up -d
And the application will start at http://localhost:8081
.
$ docker-compose stop
$ docker-compose rm
$ docker-compose ps
This project is licensed under the GNU GPLv3 License - see the LICENSE file for details
Made with ❤️ by Felipe Mendes.