Questions tagged [rest-api]

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

391 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

How to logout remotely from other website

My requirement is something like: Let's say I have a client side app/website. There will be logout link and on clicking Logout link, it will also remotely logout wordpress site. I believe WP has a ...
0
votes
0answers
9 views

Is there any method to add a Custom Comment Type to WordPress REST API?

Hellow!I am using AnsPress plugin(Forum/Question and answer plugin) with some customization.In Anspress,visitors can post replies to answers.Those replies stores in WordPress database under a comment ...
0
votes
0answers
51 views

“No Access-Control-Allow-Origin header is present” even though it is in the entry file

I'm seeing this in the Chrome browser console after doing a test fetch request: Access to fetch at 'http://localhost/wptest2/wp-json/pluginFolder/1.0/load?limit=10&offset=0' from origin '...
0
votes
0answers
15 views

Advanced analytics tools for WooCommerce?

Premise This question might seem out of topic but in my opinion it's strictly related to the whole Wordpress / WooCommerce ecosystem and its performance optimization. Problem The issue is about ...
0
votes
0answers
28 views

do_action doesn't trigger if it's in a template that gets loaded via REST endpoint

i'm building a single page application using woocommerce and custom REST endpoints to get template parts and load them into the browser ... one endpoint is getting content-single-product.php template ...
0
votes
0answers
14 views

Woocommerce Product don't return custom taxosonomy when using REST api

I created a custom taxonomy for woocommerece product. It's working fine in wordpress. but when I try to fetch it through REST (Javascript), it's missing. All other properties are returning but not ...
0
votes
0answers
22 views

Help when displaying a link in the Woocommerce order table

I am developing a module for woocommerce that consumes an API, in the back it shows the link correctly of each order that is made, but my problem is when I want to insert this link in the part that ...
0
votes
0answers
13 views

Wordpress improve REST API - SHORTINIT not work

i'm trying to improve the performance of Wordpress API custom endpoints. I created a plugin, simple file under plugin/PLUGIN_NAME folder where I call "register_rest_route" function to set the ...
0
votes
0answers
34 views

Create Session with JWT

I'm currently working on a shop like project that uses React as frontend and Wordpress with Woocommerce as a backend. To authenticate with the API I use the JWT Authentication for WP REST API, which ...
0
votes
0answers
38 views

I can't post comment via REST API

I try to insert comment via REST API , but i get this error : Query parameter not permitted: author I followed this docs and author is one of the arguments this is the link test that i use https:/...
0
votes
0answers
118 views

Custom REST API with Stripe webhooks error: No signatures found matching the expected signature for payload

I've created an API endpoint listener for the Stripe "payment successful" webhook on our installation. add_action( 'rest_api_init', function () { register_rest_route( 'myplugin/v1', '/stripe', ...
0
votes
0answers
23 views

Can I set rest API endpoints from within a theme?

I would like to know if it is possible to set rest API endpoints from within a theme? I created a class to do this and made an instance of the class in the theme's functions.php file. This triggers ...
0
votes
1answer
41 views

register_rest_field update_callback don't work for $_FILES

I try to insert a post with REST API who contain text and image in one api call. My image is an acf field. I register my field like that: register_rest_field( 'project', 'logo', array( '...
0
votes
0answers
15 views

How to rerieve comments and their replies from DB

I need to get comments and their replies from database to show them as json for an android app, so how can i tell if a comment has replies (get their number ) , and how can i list replies nested with ...
0
votes
1answer
15 views

Is there anyway to format my EndPoint URL in WordPress?

I have wrote an endpoint in WordPress and it works just fine. The problem is with the URL. The current format of the URL request must be like this: https://iotkidsiq.com/wp-json/zaindob/v1/sync_order/...
0
votes
0answers
39 views

WooCommerce - Add product with Product category and Image from Mobile App

I am new to WooCommerce development and REST API provided by WooCommerce. I am facing 2 issues right to add new product as a vendor from my Mobile app which is in React Native. 1.I am adding new ...
0
votes
0answers
66 views

REST API list_user

I need to get a list of users by specific role. I user this endpoint: GET /users?roles=customer but I got: "code": "rest_user_cannot_view", "message": "Sorry, you are not allowed to filter users by ...
0
votes
0answers
31 views

Get templated page/post content via the WordPress API

I've been tasked with converting a WordPress site into a single page application so a persistent audio player can be added, while retaining its current theme. I need to do this in such a way that the ...
0
votes
0answers
43 views

Exclude categories in WP REST API response through function

I want to exclude some categories from the API response but not using the argument exclude but through function: When using the default route: https://example.com/wp-json/wp/v2/categories I want to ...
0
votes
0answers
71 views

How to get WordPress Theme Customizer options in the REST API?

I am trying to work with the WordPress REST Api as a backend for a React application. But I don't understand how to get/fetch the customizer options (check this image for example -> https://imgur.com/...
0
votes
0answers
16 views

Creating Wordpress user remotely

I’m looking for a solution for my problem. Let me explain: I have two different websites. I’m listing my digital products on my first site. Users can purchase products through woocommerce. After a ...
0
votes
0answers
231 views

Restricting access to WordPress's REST API to localhost

In reviewing the WordPress REST API documentation, it's my understanding that the endpoints are publicly access thus when accessing www.domain.com/wp-json for example, it exposes the JSON construct ...
0
votes
0answers
40 views

How to update a user with REST API v2 knowing only the username?

I'd like to call WP REST API to update a user. I have only username, so I suppose I should retrieve user ID first of all, as the endpoint for updating a user is: GET /wp/v2/users/<id> How to ...
0
votes
0answers
37 views

Add Social Login(Google & Facebook) for woocommerce customer login

I want to add social login in woocommerce with much functionality like... 1) I have created android/iOS apps by using wordpress custom REST API. by using all API whole app is running. 2) if I ...
0
votes
1answer
27 views

Issues with Multisite installation and 403 error for REST API request

I have set up WP as multisite installation with subdomains. The dashboard for both the site network and each site is working fine, except for the error I get using Block Editor on my parent site. So ...
0
votes
0answers
270 views

Test WordPress api with postman

I have some API endpoints. For example: add_action('rest_api_init', function () { register_rest_route(MY_APP_NAMESPACE, '/init', array( 'methods' => 'GET', 'callback' => ...
0
votes
0answers
18 views

Make plugin return HTTP 200 OK on POST

I am developing a custom plugin - payment gateway - which returns me data through POST request. The payment gateway is expecting this response: HTTP/1.1 200 OK Content-Type: application/x-www-form-...
0
votes
0answers
21 views

Getting Subscription Products from WooCommerce Subscriptions API

I am trying to access my site's Subscription Products via REST API. At wc/v1/subscriptions I can get the active subscriptions, and at wc/v3/products I can get all products except subscriptions. There ...
0
votes
0answers
23 views

Store Featured Image in base64 string for Restful API

I am using WordPress' default REST API for posts. The app also needs images as base64 string. For this, I convert featured image to base64 on the fly. For example, in an API call, 10 posts are being ...
0
votes
0answers
199 views

REST API and Loopback error

I've been working on a site for a client for a few months now and recently I noticed that the Health Check functionallity added on the newest versions of WordPress is reporting two errors about the ...
0
votes
0answers
102 views

Deleting media using the Wordpress Rest API

I am trying to delete a media object from my Wordpress instance using the Wordpress API in Postman. I'm having trouble finding the endpoint according to the documentation. Here is my http method and ...
0
votes
1answer
23 views

localize_script or rest api

If the data is available in both options, in what use cases should i use the localize script to make data available to my javascript code, and in what cases should i use the rest_api? I have a custom ...
0
votes
1answer
15 views

Rest API: Register and Login errors aren't specific

I've created a Register/Login form, and while it works perfectly for both, it's the error messages that are stumping me. I've tried to produce the following errors for registering: email already in ...
0
votes
0answers
17 views

WP Rest Api GET method restriction on route, but POST method also works

I'm doing some basic API testing and notice that restricting my new route to GET doesn't work. POST requests also go though using Postman. (PUT, PATCH, DELETE do not however, displaying a "no matching ...
0
votes
0answers
48 views

Not able to delete media by REST API

I'm following the official documentation to requesting the REST API endpoint to delete media. I already have Basic Auth plugin installed in my WP and I'm able to upload media by REST API, but when I ...
0
votes
0answers
56 views

Users REST API not working?

My site has 8 users: All (8) | Administrator (2) | Subscriber (2) | Customer (1) | Vendor (3) When I go to mysite.com/wp-json/wp/v2/users I only see one user, admin. There are even two admin users ...
0
votes
0answers
18 views

Buddypress notification description returns null

I am currently trying to modify the Buddypress rest api, specifically the notification endpoint and trying to add the notification description to it. I have tried using the following functions and ...
0
votes
0answers
18 views

Wordpress as backend for SPA - problem of 404 page for custom routing

I'm going to use wordpress as backend rest api and vue.js (it doesn't matter what framework) as frontend part. I have some custom route on frontend side, e.g. "/custom". Actually it works on my ...
0
votes
0answers
13 views

Create a custom role to can access only a custom api endpoint to fetch data

I have a small external app which is communicating with a wordpress custom REST API endpoint, in the meaning is requesting some data aggregation from web but will never push back data to wordpress DB. ...
0
votes
0answers
102 views

Modifying custom order item meta from admin order view

I'd like to have a simple custom meta for order items that says if the item has been fulfilled or not. I have this in my functions.php: add_action( 'woocommerce_admin_order_item_values', '...
0
votes
1answer
17 views

Showing how many times is plugin activated or deactivated

I develop a custom plugin for my needs, and I stuck on one task. I need some kind of solution, to show on my website how many times is that plugin activated or deactivated on every site where will ...
0
votes
0answers
51 views

Modifying server's response to API endpoint

I have a Javascript application in the front-end, with Wordpress in the back. The index.php of Wordpress serves the application if user is logged in, else redirects to login page. My application ...
0
votes
0answers
20 views

Can I use the WooCommerce API to expose shopping functionality to REST clients?

We have an online store using WordPress and WooCommerce to sell software and content. A long standing goal of ours was to also make the content store available directly inside the software we sell as ...
0
votes
0answers
163 views

What is causing REST API issues in the plugin/script for logons?

I am not really sure when the problem started but we have a long-standing and still very functional SSO script that was made in-house for automatic WP sign-in based on SSO handshake. The script is ...
0
votes
0answers
29 views

External requests to authenticate Wordpress Rest API, with a private secret key

I want to validate the Wordpress Rest API for requests from two different domains. Wordpress, Cookie or O-auth methods can be verified. But it is impossible to accept external requests with Cookie. ...
0
votes
0answers
30 views

import products into woocommerce from supplier's rest api

How do i import products into woocommerce from an external REST API? Hello.I am creating an ecommerce shop on woocommerce. i want the products to be imported and stock reload(every 3 hours) from my ...
0
votes
2answers
23 views

Can't access 3rd party API, code works on local server but not on wordpress

I've been working on a project and I just cant pull the data from this API. I'm developing a plugin that's supposed to pull data from an API and then use that data. I developed this project offline ...
0
votes
1answer
191 views

Extend Woocommerce rest api routes fails

While I'm trying to extend Woocommerce Rest-API routes with a custom one I face the following problem. I have the following class which tries to hook inside Woocommerce API class API_LOADER { ...
0
votes
0answers
121 views

How can I secure my custom rest api endpoint or add under a already existing rest group

Creating a custom REST Endpoint I search a way to secure the route with JWT or integrate my endpoint under Woocommerce rest routes which already has an authentication logic. The perfect solution for ...
0
votes
0answers
97 views

WC Booking query bookings with date ranges

Using WooCommerce Bookings extension and the newly provided REST API I search a way to query bookings by date intervals. Is possible to achieve something like this?