Questions tagged [rest-api]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

Wordpress Rest Api and get data/settings from a Plugin

I am new in Wordpress Is there a way to get the Settings or Openingtimes (like in the Admin Page) of a Plugin (plugin name is 'wppizza') in the Rest Api. I already get the custom post type and the ...
0
votes
0answers
20 views

How can I add a permissions callback to the REST API index pages?

I'd like to block unauthenticated users from accessing the index JSON pages, such as /wp-json and /wp-json/myplugin/v1. Is there a way for me to do this? I currently just have everything except the ...
0
votes
1answer
68 views

Need to get user data via API

I apologise for what must be a very noob question but I'm brand new to WP and not a pro developer so a lot of this stuff is difficult for me. I simply want to get API access to my user's data. I ...
0
votes
1answer
23 views

Set logged in user based on API response

I have an external application that I want to redirect to a page on a wordpress site. The page needs to be different based on who is logged in. The application has an API endpoint which I can call ...
0
votes
1answer
26 views

How to add a rest field to post tags?

I'm doing a headless wordpress, so using wordpress API. Using Yoast, I've added yoast SEO data to my post types API endpoints like this: function wp_api_encode_yoast($data, $post, $context) { $...
1
vote
0answers
58 views

Wordpress REST API “rest_authentication_errors” doesn't work external queries?

Wordpress REST API "rest_authentication_errors" doesn't work external queries? I was using following experimental codes for experimental purposes. add_filter('rest_authentication_errors', 'auth'); ...
0
votes
0answers
13 views

Commas in meta fields when saving or updating posts via the API

I'm saving and updating posts via the API and running in to an issue where any post meta that has a comma in it is getting split up in to multiple meta items. An example would be a post with a meta ...
0
votes
0answers
21 views

JWT Authorization Exposing Login Credentials?

I want to start using JWT to access an API endpoint that needs to be protected. There will be no logged in user, as this will be an HTTP call coming from a Vue frontend running on the same server. ...
0
votes
1answer
106 views

Return 'X-WP-Total' from headers in response

I'm wondering if it's yet possible to get the value of 'X-WP-Total' in the api response. Here is my request - axios.get(${url}/wp-json/wp/v2/media?per_page=100&mime_type=image/jpeg).then(...
2
votes
2answers
165 views

WordPress Rest API: How do we validate with our custom API key?

How we can verify "Cancel the header auth" the "endpoint" functions of WordPress with an API key that we produce. (Note: not a different endpoint, original endpoints) I have my own "Crypto" class/...
0
votes
0answers
22 views

PaidMembershipsPro plugin's query filter not working for REST API calls

I have a custom REST API in WordPress that returns a list of posts using the get_posts function. I am using the PaidMembershipPro plugin, which typically filters the get_posts results according to ...
0
votes
1answer
13 views

REST API retrieving posts from www.sitename.com/category/news/ instead of just just from www.sitename.com

I look a bit thorough some of the previously asked questions and stumbled upon /wp-json/wp/v2/pages/?slug=news (and other permutations) but it doesn't turn anything up. I'm kind of stuck on how to get ...
0
votes
1answer
54 views

rest api endpoint - accept diacritic characters

I am trying to register a custom endpoint, which will accept diacritic (accent) characters, so that I may search it in french. This is what I have tried: register_rest_route('events/v1', '...
0
votes
0answers
10 views

WP REST: How I can bypass get_items_permissions_check for orderby = registered_date

I'm trying to order my users using orderby=registered_date but seems it's blocked for non-admin users. This is the endpoint I'm using for: /wp-json/wp/v2/users/?slug=admin,user,author&orderby=...
0
votes
0answers
12 views

rerender gutenberg facebook embed widget after API content loaded

Is there a helper function for rerender gutenberg embeds after SPA's content is loaded, pls? I got embed block from post's content, but is not rendered as facebook post widget, just wrapped url. For ...
1
vote
1answer
19 views

What's the “?P<tag>” register rest api construct, what is for and where to find official docs?

I noticed that often in register_rest_routes, are used regexp like ?P<lang>, ?P<category_id>\d+ and so on, but I guess it's not standard regexp syntax. What exactly does it do?
0
votes
0answers
28 views

Custom WordPress Rest API for CPT

I am currently building a headless Wordpress site using the WP Rest API. With Custom Post Types I am currently using the following endpoint: localhost/wp-json/wp/v2/cpt_operator Can I modify / ...
0
votes
0answers
25 views

How to improve WP-Rest atrocious response time?

I'm going to be very straight forward here. I have a headless WP install and made my front-end in Vue.JS Since I've started this project, the load times for the API requests were high but I think we ...
0
votes
2answers
82 views

Images are displaying as blank images

I am trying to upload base 64 encoded images to my website media library via API. API returns with image ID but these images are displaying as blank images in my media library. Here is my code ...
1
vote
2answers
60 views

Send request to WordPress REST API

I have a server (server 1) which send requests to another server (server 2) where WordPress is installed and I am using their (server 2) WP REST API. The problem is that I can't create/send wp-nonce ...
0
votes
0answers
25 views

Make authorization mandatory on custom routes

I'm setting up multiple custom api routes in my wordpress theme and I would like that to require a JWT token to access. So I have followed the steps in order to get the JWT Authentication for WP Rest ...
0
votes
0answers
32 views

How to get all the terms from a custom hierarchical taxonomy via REST api?

This post can be a solution, but I guess there could be something more linear or native: https://stackoverflow.com/questions/42462187/wordpress-rest-api-v2-how-to-list-taxonomy-terms The official ...
0
votes
0answers
21 views

Communicate Wordpress Custom Plugin from my site to a Job Board Site

Need some help with WPFusion since I am pretty new to it. Currently, I am transitioning from using iMember360 as a CRM to Infusionsoft. As a middle man between Wordpress and Infusionsoft, I am using ...
1
vote
1answer
74 views

How to add WP API and JS featured image attachment

I would like to fetch the image from the wordpress rest api - I have the following code: HTML: <div class="post-item"> <div id="posts">Loading posts... </div> Ajax script: <...
0
votes
1answer
23 views

WordPress single page website redirect to index.html

I have developer angular app from WordPress rest API. I my WordPress baseURL and Angular app both are in same director (this is because WordPress and Angular URL are matched). But in this setup issue ...
0
votes
0answers
58 views

How can I update custom fields via REST?

Is there a way to update a value of an existing custom filed on a custom post type in WordPress? By a request URL, or webhook or somethings like this? My case: I have a custom post type named ...
0
votes
0answers
17 views

How to get the most recently updated orders via the REST API?

I have a script which exports WooCommerce orders (which sometimes change) and synchronizes them with an external database. I run this script frequently, and it uses the legacy v3 REST API. I'm about ...
0
votes
1answer
134 views

Updating Custom WordPress User Meta Field via REST API

I have created an empty user meta field for a user called phone_number via the add_user_meta() function. When I use the get_user_meta function, I can see an empty string for the meta field which is ...
0
votes
1answer
66 views

REST API GET users

when I do http://dayroomstay.com/wp-json/wp/v2/users I get: "code": "rest_user_cannot_view", "message": "Sorry, you are not allowed to list users.", "data": { "status": 401 } I ...
2
votes
1answer
46 views

How can I set status='publish' for all featured images?

Background: I've come accross this WP issue: https://core.trac.wordpress.org/ticket/41445 In short: when you make a request to a post over the REST API, if the featured image was originally uploaded ...
1
vote
0answers
84 views

Not all featured image sizes available in Rest API

I'm using Vue.js to consume the Rest API for both posts and a custom post type. I'm using the _embed query on the URL for the endpoint to get sizes for the each featured image. The issue that I'm ...
0
votes
0answers
20 views

need help with a user-specific custom page template

I created a custom page template that will show sales from a hotel. I have 3 users and I want each user to only see their hotel sales on a user profile specific page. The template calls data using the ...
0
votes
0answers
12 views

404 not found if user, email already exists [Plugin: JSON API User]

-I am using the JSON API User Plugin for WordPress Rest API data. -When i used this API to register a new user, if the user already exists, it retrieves a 404 not found. Thanks in advance Response :...
0
votes
1answer
31 views

How to order WordPress Rest API data

I am pulling in some data via the Rest API: https://legalsecurityforum.com/wp-json/wp/v2/speaker?include[]=3116&include[]=3249&include[]=3170&include[]=3416&include[]=3181&include[...
1
vote
1answer
57 views

WP Rest API - How to get an empty response if query has no posts

I am using rest_{post_type}_query for some custom query params. It works fine, however, I would like to get an empty response or a "no posts found" message when the query doesn't have the posts ids to ...
0
votes
0answers
59 views

Custom REST API Endpoint not working

I tried to create new custom rest API endpoint inside my theme function.php file. I also tried inside the plugins folder but it's not worked for me. This is how I write the function on function.php ...
0
votes
0answers
40 views

Fetching all users that didn't post with rest api (current version 2)

By default, wordpress only shows you the users who have posted on the site through the /wp-json/wp/v2/users I want to fetch all users whether they have posted or not (using wordpress as a headless ...
0
votes
0answers
25 views

How to connect zapier and wordpress?

I have a site, where users can create accounts and store some data. What I try to reach is to allow users to connect their accounts to zapier, and pass data. In other words, allow a user to specify ...
0
votes
0answers
33 views

404: WordPress Rest API

I have a laravel 5.5 site which is up and running. Further, I have to develop WordPress inside a laravel site. Hence I have setup a WordPress site inside laravel's public folder as follows: ...
0
votes
0answers
25 views

AJAX call recieving a 400 bad request when array lenght is to long

I have a select dropdown where users can choose multiple options that get's sent to a custom Rest-API endpoint and returns values based on their selection(s). The dropdown is dynamically populated ...
0
votes
0answers
53 views

WP REST API Problem Bad Request In PHP curl code

When I run this curl code. It gives me a Bad Request Error from Apache Serve. I give a screenshot of this. Also, Give my code. Please Give me solution Of this. Screenshot : My Code is : $wprest = ...
0
votes
1answer
44 views

How to require files in a custom endpoint

I am working on a custom endpoint to handle ajax media uploads with media_handle_upload(). I have created a custom endpoint with a route that is tested and works, however when I try require the ...
0
votes
1answer
121 views

How can I capture Memberpress user info after signup

I'm currently working on a website where users can purchase subscriptions using memberpress, I want to capture the user data after the signup process is completed and the payment transaction is also ...
0
votes
0answers
58 views

Tax are not showing on order while placing order with REST API

I'm trying to placing order with REST API which will use for android app. I've used wc_create_order() for placing order but I didn't getting tax values as I got in web view. What I want - I need to ...
0
votes
1answer
47 views

Calling a python script from custom wordpress rest api returns null

So, I have a python script that uses machine learning models to predict and print a string. Running the script alone gives desired output and takes around 12 seconds to complete. Now calling the ...
0
votes
1answer
154 views

“error_message”: “Sorry, you cannot list resources.” using WooCommerce API

When requesting the test API, getting the following response: { "errors": [ { "error_code": "", "error_message": "Sorry, you cannot list resources." } ]...
0
votes
0answers
63 views

How to prevent post update using transition_post_status

I am building an application using WP REST API. Ideally, users are able to post only if they have a subscription. Here is how I plan to make things work: Set expire_by user meta when they sign up. ...
0
votes
0answers
24 views

Remove comma in wp-json results

I am using the Wp REST API to filter posts using AJAX. The problem is that when the posts are filtered, a comma is added between them but I am not sure where is it comming from. Here is the code I am ...
0
votes
1answer
20 views

How to get data from a private API and add it to wordpress pages

I got a private API (Cliniko) I want for example the full list of clients to be listed where I want on a page. I know how APIs work, what I don't know is how to implement them in Wordpress. Is there ...
1
vote
1answer
174 views

Add Products to user's ID Woocommerce

I have made an REST API for synchronize user's cart item to web view to android view. I have used CoCart WP plugin Here are some scenarios: If I adding product from website I can get user's cart ...