Questions tagged [rest-api]

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

389 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
29 views

Is it possible to custom set query for a WordPress REST API response?

I have a custom post type that I am querying for through WordPress REST API, right now the response returns all the posts. I would like to set the tax_query argument based on the user who is sending ...
0
votes
0answers
9 views

Search box to filter large list of images

I have produced thousands of png images and organised them into two folders on my server as follows: 1901/ John.png Michael.png James.png Mary.png Jane.png 1911/ John.png Michael.png ...
0
votes
0answers
27 views

Update membership level via API request if using simple membership plugin

I plan to use simple membership plugin to handle the membership part. But I found no way to update membership level in mobile app via API request. May I know if it has any other ways from render ...
0
votes
0answers
266 views

Json api and Access-Control-Allow-Origin multiple value

I'm using this in the htaccess file to enable cross-domain requests: Header set Access-Control-Allow-Origin "*" The problem is when trying to use jQuery to load a request, I get the error: Access to ...
0
votes
0answers
14 views

Initializing rest endpoint issue

I'm setting up a plugin to list a series of WooCommerce products. Sketched all structure and I find that the endpoint isn't being created and can't figure out what's wrong here. Plugin file <?...
0
votes
0answers
43 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
23 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
151 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
24 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
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
23 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
187 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(...
0
votes
0answers
26 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
0answers
14 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
14 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 ...
0
votes
0answers
38 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
0answers
33 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
50 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
22 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 ...
0
votes
1answer
24 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
62 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
25 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
222 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
0answers
30 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
0answers
111 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
54 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
33 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
35 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
26 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
83 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
228 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
104 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
67 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
284 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
101 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
27 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
34 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 ...
0
votes
0answers
123 views

How to apply 'rest_post_query' filter only when fetching a single post?

I'm working with the Wordpress API. I have modified the default query using rest_post_query to exclude a certain category: add_filter( 'rest_post_query', 'get_posts', 10, 2 ); function get_posts( $...
0
votes
0answers
59 views

GETing data from a gzip compressed API?

I know WP can get JSON API data via a GET request, but does anyone know plugins/ways that I can get and decompress JSON data from a gzip compressed API? I would then output the JSON response to a ...
0
votes
0answers
31 views

Using Wordpress solely as a Backend - dealing with WP_SITEURL

I've built a website in Angular that leverages Wordpress as a backend, specifically using its REST API. I am replacing an existing website, and my client does not intend to change the original ...
0
votes
1answer
106 views

WordPress multisite REST API connection refused with android - redirects to home page when using IP address in Postman

I have built a sub-directory type multisite and installed wp rest api on my localhost. Next step would be to connect the multisite to my android app using the rest api. This is where things go wrong. ...
0
votes
0answers
123 views

auth error with react native and wordpress rest api jwt token

I am trying to user wordpress rest api with jwt token and react native but I have issues debugging with postman; jwt/token returns the token, and the user display, etc. jwt/token/validate returns ...
0
votes
0answers
42 views

what make difference between shipping methods for a zone when a create order with woo api

please help ,when i decide to create an order i found that i have to specific shipping_lines "shipping_lines": [ { "method_id": "flat_rate", "method_title": "Flat Rate", "total"...
0
votes
0answers
15 views

Get automatically added content to posts via wo json rest api

I am using advanced ads plugin to show my custom image ads using placements, so these ads get automatically placed within the posts. Now I want use wo json ali in my android app and want to get those ...
0
votes
0answers
139 views

How to set JWT token with PHP on successful login?

I'm creating a decoupled application: the frontend is built with React, the backend uses Wordpress. However, due to some limitations the login and registration frontend pages must use a Wordpress ...
0
votes
1answer
138 views

wrapping 'rest_api_init' in 'is_admin()' function

i'm create custom admin page via add_menu_page, let's imagine that my custom page has url wp-admin/admin.php?page=settings_page then i'm checki is_admin() function via var_dump on my ...
0
votes
0answers
513 views

get token using the 'WordPress REST API with JWT Authentication' plugin

I'm trying to build a Wordpress plugin that is an API which can be queried from remote websites. I want to secure it with JWT web tokens, so I did install the JWT Authentication for WP REST API ...
0
votes
1answer
124 views

REST : how do you handle the rest_no_route error?

i'm playing with the REST api and when doing some REST requests I got sometimes what I want, and sometimes this response generated by rest_ensure_response() : { "code": "rest_no_route", "data"...
0
votes
0answers
21 views

WP API V2 Filtering URL request second tier

I currently have a WP API URL call that looks like https://siteurl/wp-json/wp/v2/knowledge_base?_embed&knowledge_types=8 The JSON code looks like [ { "knowledge_types": 8, } ] How ...