Coder Social home page Coder Social logo

imranhsayed / rest-api-endpoints Goto Github PK

View Code? Open in Web Editor NEW
40.0 4.0 12.0 1.25 MB

:ear_of_rice: WordPress REST API endpoints

PHP 100.00%
wordpress wordpress-plugin rest-api wordpress-rest-api wordpress-development wordpress-api user-authentication user-auth create-post post

rest-api-endpoints's Introduction

REST API ENDPOINT

This plugin provides you different endpoints using WordPress REST API.

  • ๐Ÿ‘ค Login End Point
  • ๐Ÿ“ƒ Create Post End Point

Login Endpoint Demo ๐Ÿ“น

When we access the end point on URI: http://your-domain/wp-json/wp/v2/rae/user/login, and we pass our username and password in the body using postman, we get the following with a status code:

  • User Object on success
  • Error when fields are empty or incorrect credentials
  • Any other error.

Create a new post Endpoint Demo ๐Ÿ“น

When we access the end point on URI: http://your-domain/wp-json/wp/v2/rae/post/create, and we pass our 'user_id', 'title' and 'content' in the body using postman, we get the following with a status code:

  • New post id if the post is created.
  • Error when fields are empty or if the user with the given id does not have capability to publish posts.
  • Any other error.

Getting Started ๐Ÿ“‹

These instructions will get you a copy of the project up and running on your local machine for development purposes.

Prerequisites ๐Ÿšช

You need to have any WordPress theme activated on your WordPress project, which has REST API enabled.

Installation ๐Ÿ”ง

  1. Clone the plugin directory in the /wp-content/plugins/ directory, or install a zipped directory of this plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress

Use ๐ŸŽฟ

There are different end points that are available. Some are public while others are protected.

  • ๐Ÿ‘ค Login End Point http://your-domain/wp-json/wp/v2/rae/user/login

Params to be sent in the body username(String) and password(String) Return Value: User Object or Error (Object)

  • ๐Ÿ“ƒ Create Post End Point http://your-domain/wp-json/wp/v2/rae/post/create

Params to be sent in the body user_id(Int), title(String) and content(String) Return Value: Object with post ID and status or Error (Object)

Features

  • Adds option to add social links in customizer
  • Registers two custom menus for header ( menu location = rwt-menu-header ) and for footer ( menu location = rwt-menu-footer )
  • Registers the following sidebars
  1. RWT Footer #1 with sidebar id 'rwt-sidebar-1'
  2. RWT Footer #2 with sidebar id 'rwt-sidebar-2'
  • Registers custom end points

Available Endpoints:

Get single post ( GET request )

  • http://example.com/wp-json/rae/v1/post?post_id=1

Get posts by page no: ( GET Request )

  • http://example.com/wp-json/rae/v1/posts?page_no=1

Get header and footer date: ( GET Request )

  • Get the header data ( site title, site description , site logo URL, menu items ) and footer data ( footer menu items, social icons )
  • http://example.com/wp-json/rae/v1/header-footer?header_location_id=primary&footer_location_id=secondary

Create new post: ( POST Request )

Contributing ๐Ÿ‘ฅ

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

I use Git for versioning.

Author ๐Ÿ“

License ๐Ÿ“„

License

rest-api-endpoints's People

Contributors

imranhsayed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rest-api-endpoints's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.