Questions tagged [rest-api]

Questions about the core RESTful HTTP API for accessing WP content and data.

404 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
296 views

How to filter wp-json/wp/v2/users response on custom metas?

I need to filter the WP-JSON of users on custom meta stored with user, I have tried filter[] parameter but not working, Here is a sample link of API https://themographics.com/wordpress/service-...
0
votes
0answers
619 views

Multisite and the JSON REST API: How to?

I have a simple scenario where I have to fetch posts including their metadata from the WordPress REST API: https://developer.wordpress.org/rest-api/ Within a normal WordPress website this is really ...
0
votes
0answers
205 views

REST_query_vars for users

I'm wondering if it's possible to make that code work for users function my_rest_query_vars($valid_vars) { $valid_vars = array_merge($valid_vars, array('meta_key', 'meta_value', 'meta_compare'));...
0
votes
0answers
20 views

WordPress api returns distinct data

I am developing a restful api for wordpress blog. In a url I'm returning the details of categories of that blog. The same api returns array in one blog and object in another. The code is- function ...
0
votes
2answers
3k views

Ways to load admin-ajax faster without initializing all plugins?

I'm facing a problem with wp ajax performance. I'm initializing an ajax call from my javascript side but the response takes 3-5 secs to come back. I understand that admin ajax call has to load the ...
0
votes
0answers
352 views

Rest API hook 'rest_insert_post' not returning request object

Rest API hook 'rest_insert_post' not returning request object function wp_api_add_tax($post, $request, $update = true){ wp_mail('abc@gmail.com','test','data'.json_encode($request). json_encode($...
0
votes
0answers
23 views

React in plugins: REST endpoints vs. regular functions

I'm building a plugin that uses React for the front-end management. Is it correct that I should use regular functions for that vs creating REST endpoints, since I can access them directly from my ...
0
votes
1answer
141 views

Adding Images into API

I'm trying to add featured images to my API but it's a different type of post. http://example.com/wp-json/wp/v2/directory I have been using WP REST API Controller but it doesn't show image option. ...
0
votes
0answers
42 views

Can I get programmatic access to wp-admin?

I need to script configuration for an existing Wordpress site. Does wp-admin provide any kind of API for programmatic access? (Installing a local wrapper for access would be fine.) For example, to ...
0
votes
1answer
1k views

How to display parent category with first level child in REST API

I want help on WP REST API I want to display Categories with a first level child with some attributes. Here how it should look like: { Parent "id": 3, "name": "Football", "slug": "football" ...
0
votes
2answers
1k views

Return all custom taxonomy terms for post in REST API v2? Currently limited to 10 terms

I'm trying to use the REST API v2 to populate a modal window when clicking on a project custom post type item. Projects have a custom taxonomy, Skills. I'm using ?_embed on the JSON URL and it is ...
0
votes
0answers
886 views

Custom Rest API namespace and endpoints are responding with 404 & 503 errors

I am new to WordPress plugin development. I was developing a plugin for WordPress that would be used to create mobile apps for WordPress Bloggers. The whole source code of the plugin is at:- https://...
0
votes
0answers
597 views

custom REST endpoint not passing body of POST request to callback

I'm writing a plugin which includes a custom endpoint for the WordPress REST API, the goal of this is to supply an importer function for an existing content type. For some reason, I'm not getting the ...
0
votes
1answer
196 views

Wordpress REST API Endpoint (Authors and Categories latest posts)

I need to query for all authors that posted in the last 24 Hours and their latest post that are not older than 24 Hours via the REST Api. Is this possible? How I'll create a custom endpoint or ...
0
votes
1answer
514 views

Using the WordPress and WooCommerce REST APIs in the same Node app

I am writing a small utility app that connects a 3rd party API to a WooCommerce store (actually, it's multisite, but that's not really relevant) in order to update customer records. The WooCommerce ...
0
votes
1answer
584 views

Single page applications with Wordpress: routes and templates

(Read carefully, this is a question about Wordpress and not about AngularJS) I'm trying to make a single page application with AngularJS and the Wordpress rest API. Many things that are usual when ...
0
votes
0answers
2k views

How to trigger lost password email using REST API?

I have looked all over and can't seem to find the answer to this. Is it even possible? Or does anyone have an alternative? Basically, my front end app needs to send the user a lost password email or ...
0
votes
1answer
256 views

Loading posts outside wordpress

I am trying to load posts outside WordPress on a static html page. So far I have a working example using React, http://v2.wp-api.org/ and https://github.com/mzabriskie/axios. This working example ...
0
votes
1answer
343 views

Bypass wp_safe_remote_get()?

I have a PHP(Laravel) application that pushes data to WooCommerce through the WooCommerce REST API, everything works except for images. I was able to pin this down to wp_safe_remote_get() and $args['...
0
votes
1answer
86 views

Fetching WP.me shortlinks for posts using WP Rest API

I have recently installed Jetpack for my self-hosted blog. I have already installed the WordPress REST API plugin to fetch blog contents. After installing the Jetpack, the default WordPress short ...
0
votes
1answer
2k views

Make Custom Fields Public in JSON - API

How do i make the custom fields public in rest API? I have added a custom field to the rest api. the challenge is - The metadata is returned when i am signed in my browser. if i try as public using ...
0
votes
1answer
1k views

Custom Post Type API doesn't show taxonomy or category array

Using this url http://www.my_site.it/wp-json/wp/v2/portfolio/ this is a object custom type on that json: where are taxonomy or category array?
0
votes
1answer
495 views

Upload image to wordpress using ionic/cordova with WP REST API V2

i am building mobile application with ionic and wordpress rest api v2, how to create post with image or upload image with wp rest api? i just can create post without image. Thanks
0
votes
1answer
294 views

Trouble Commenting via the WP REST API using nonces

I'm trying to post a comment via the WP REST API. Here is my request: axios({ method: 'post', url: `${WP_API_ENDPOINT}/comments`, headers: {'X-WP-Nonce': wpRestSettings.nonce}, data: {...
0
votes
1answer
39 views

Best way to make a JSON API from Wordpress?

How would you explain this to a newbie? eg.: I have two websites, I want one to display the posts of the other through JSON API?
0
votes
1answer
90 views

custom php file inside my custom folder of plugins directory is not caching

I am using W3-Total-Cache plugin, here is my plugin configurations : I am trying to implement caching on my custom php file. I have created a folder (api) inside plugins directory. i.e /wp-content/...
0
votes
2answers
44 views

Can we use website data which is having wp rest api plugin?

Suppose I have created an app that uses WordPress REST API plugin and displays the posts from the WordPress site. Now, if I find the WordPress site which is having the WP REST API plugin and I am ...
0
votes
1answer
557 views

Handling _embed for custom REST API endpoints

I am preparing a plugin for REST API integration (the WP 4.7 core version) by providing custom endpoints for data from the plugin. One of the things I am trying to do is to set a _links property in ...
0
votes
2answers
747 views

Sending post data over REST API, how to parse shortcodes in post_content?

I am using the REST API to publish posts outside of WordPress, and have run into a problem where not all of my shortcodes are getting processed. Specifically, most of my plugins' shortcodes are ...
0
votes
1answer
983 views

How to get results of subcategories also?(WP Rest Api v2)

We can get posts from a category using below request `/wp/v2/posts?categories=1&search=somequery` It only gives results from category(1) only. How can we get results from category(1) and ...
0
votes
1answer
1k views

Right hook to redirect frontend visitors while respecting rest api plugins to run first?

I don't need a frontend on the WP site. All visitors will be redirected to an external url where my frontend app lives. I now have the following code in the root of my theme functions.php: if ( ! ...
0
votes
0answers
369 views

Rest API User Levels

I've got a a mobile angularjs app that's using https://github.com/Tmeister/wp-api-jwt-auth jwt auth to add to WP_Rest API www.wp-api.org which works fine, when a user is an Administrator. However, ...
0
votes
2answers
101 views

How to do rest APi with wordpress

I want to use rest Api with my website i have WP REST API plugin installed but i don't want to get just posts my website is a listing website all my listings are done with this plugin Listing Builder ...
0
votes
1answer
1k views

Check authentication credentials using WP REST API

I'm using the WP REST API in combination with the Application Passwords plugin. What I would like to do is simply check to make sure a username and password combination (encoded as a base64 string) is ...
0
votes
1answer
234 views

WP Rest API V2 OR Operator in URL

Does anybody know if I can do an OR search in the URL like: http://www.example.com/api/wp-json/wp/v2/books/?(filter[category_name]=anthropology&filter[category_name]=africa)|(filter[category_name]...
0
votes
1answer
277 views

WP API users per page

I've been testing around the v2 of the Wordpress plugin WP REST API in a web app. My goal is to develop an Ionic app. I've found a problem, though. I've managed to list 100 posts of a custom post ...
0
votes
1answer
413 views

how to filter the data's comparison operators (>= & <=) & range between values using the WP REST API

I'm quit new for wordpress development. Working with property management website with mobile API Development. Here need to filter the data's for based on conditions like greater than and less than &...
0
votes
0answers
1k views

REST API And Error Codes - No Message

I'm writing some code which inserts a new post and some postmeta using AngularJs and the REST API. I'm filtering the rest_pre_insert{postype} hook which is allowing me to throw an error when the ...
0
votes
2answers
208 views

Restructure Objects coming from Rest-Api

I am working with wp-rest api and i have this json structure to work with: [ { "id": 11, "title": { "rendered": "Test-Font" }, "acf": { "schrift": [ { "...
0
votes
1answer
187 views

Best Way to detect unique posts in wp rest api

I am developing an android app for my WordPress blog. I have some bad trouble to detect and get post. So first I give u a vision from what I am into: I want to get post from past, so I do this: Get ...
0
votes
1answer
72 views

Connecting a wordpress site to an AngularJS APP

Currently I have a application that needs a blogging system added. The application is built with an AngularJS front-end and a python/Django back end. I wanted to use wordpress as the blogging system ...
0
votes
0answers
860 views

GET request for media files in WP REST API 2 results in an empty array

EDIT: I have reported the issue to the development team of the plugin and they have resolved it in BETA10 version of the plugin. I have been trying to fetch all the media files from the REST API ...
0
votes
1answer
31 views

Upload User Avatar from android to Wordpress using Rest API

I am developing an android app that give users ability to browse , register, login, post and comment to my wordpress blog using Rest Api . I am trying now to add a way for users to update their ...
0
votes
1answer
52 views

how can I add an URL parameter to a rest route using register_rest_route()?

I would like to add a REST route that would looks like .../v1/import/?url=XXX where XXX is an URL. I had a try with register_rest_route('.../v1','import/?url=(?:/(?P<url>\w+))?', array( ...
0
votes
1answer
108 views

PHP: authenticate for a REST request?

I did create some custom endpoints for a plugin i'm working on, with the REST api. It works quite well, but now I would like to secure those requests : I don't want external users (EDIT: I mean remote ...
0
votes
2answers
365 views

Detect if REST API is running

Many times I have code and I want to make sure it only runs in a rest api context, or it never runs in a rest context. I know there are some hooks, but is there a function similar to wp_is_doing_cron?...
0
votes
1answer
812 views

Fatal error: Call to undefined function register_rest_route()

I get the error Fatal error: Call to undefined function register_rest_route() when I try to go to example.com/wp-json. What is wrong? This is how my code looks like: add_action('rest_api_init', ...
0
votes
2answers
208 views

Is it possible to bulk update a table using WP Rest API?

I am new to web services, so kindly bear with me. I am building a WordPress website for a client where they require some data to be stored in a custom table. They have an application which fetches the ...
0
votes
2answers
4k views

How to login via wordpress api and get user details?

I want to login via wordpresss api. I tried with "/wp-json/wp/v2/users" . but it just returns user 1 details. My goal is login via api and fetch all profile information.
-1
votes
0answers
30 views

WordPress.com REST endpoint for /wp-json/wp/v2

The REST endpoint /wp-json/wp/v2 is available for self-hosted WP blogs. Where do I find this endpoint for blogs that run on WordPress.com? I tried https://public-api.wordpress.com/wp/v2/sites/example....