Questions tagged [rest-api]

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

Filter by
Sorted by
Tagged with
-2
votes
1answer
20 views

how to know that a wordpress plugin support using API?

i want to ask about wordpress plugins how i can know that the plugin support api and can be used to build apps with Rest-api and some platform like React Native to build apps. the plugin need users ...
0
votes
1answer
19 views

Get a remote post ID via API given URL

Given you have a URL, how can you get the post ID of a post on a remote WordPress site? As far as I can tell, you would have to: HTTP GET /wp-json/v2/posts And then look for your URL, but the ...
0
votes
1answer
7 views

What date to use as a post date? date_gmt or modified_date_gmt

I am consuming a rest service with the posts, and get both date_gmt and modified_date_gmt ... What realy is the difference ? Is the modified_date a publish date also? Any way, if I am presenting ...
-2
votes
0answers
19 views

Get Carts + Value (Api or SQL) [on hold]

I wanted to analyze how many carts (+ their value) have been abandoned. I found a lot of plugins showing that ... but I would rather like to get the data via API / SQL ... do you guys have any ...
0
votes
0answers
32 views

Updating link on page via REST api

I have a page that I need to periodically update the file location for a link to point at a new file. Trying to do this via a Python script using requests. I've got authentication set up via '...
0
votes
0answers
14 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
35 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 ...
1
vote
1answer
27 views

Get loading state of wp data selector

I have a custom block that shows the assigned taxonomy terms for the current post. I'm trying to show a loading spinner while those terms are loading in the background. Let's say I have a selector ...
0
votes
0answers
23 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
1answer
21 views

Authenticating with REST API

I have tried every which way to authenticate a post request. WP User Plugin - As per the docs, I've logged in at wp-json/wpuser/v1/user/login and received my token. I've passed that token as a header ...
0
votes
1answer
20 views

Get user in rest API endpoint

I'm making some API endpoints that require me to confirm who the user is, and what they can do, before I let them use the endpoint. However, I can't seem to get the current user. My endpoint: ...
0
votes
2answers
68 views

Gutenberg Custom Block Getting All Posts

I'm trying to create a custom block but I need some assistance. I'm attempting to setup a <select> in the editor that lists all the posts. I'm not very experienced at the api yet but after ...
0
votes
0answers
12 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
14 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 ...
1
vote
0answers
14 views

WP rest api returns 404 only when author param is used

I have a multisite wordpress installation on aws linux, working perfectly fine. The WP Rest api is also working exactly as it should. Except for one single case. /wp-json/wp/v2/posts?author=<some ...
0
votes
1answer
22 views

What is an endpoint for custom post type comments in REST API?

In my react project i am using worpdress as backend and need to use my custom post type events comments also. So as per the WordPress documentation for comments API i am using an endpoint like this “...
0
votes
0answers
27 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
13 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-...
1
vote
0answers
49 views

Blocks Rest API rest_cannot_delete

I'm trying to make a Postman call to the Wordpress API to delete a block. However, I keep getting a 403. This user is used to add and delete pages, tags, and posts just fine using the Application ...
0
votes
0answers
8 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
8 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
1answer
18 views

Can I use REST API if the site is protected with .htpasswd

is there a way to use Wordpress REST API if the site is protected with AuthType Basic using htpasswd?
0
votes
0answers
28 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
36 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
13 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
11 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
15 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
25 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
1answer
36 views

Can we access the REST request parameters from within the permission_callback to enforce a 401 by returning false?

From what I have tried and tested so far, the getters and setters do not work inside the function permission_callback. The alternate way would be to throw a custom 401 from the callback itself. Is ...
0
votes
0answers
22 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 ...
2
votes
1answer
36 views

Rest API authentication issue when called from fetch request in bundle.js

I'm able to use the Rest API for calls that don't need auth, but I'm having an auth issue for the routes that require it. Here is part of a .php view template for an admin page: <div id="...
1
vote
1answer
26 views

WP REST API - Limit the taxonomy search to the first letter

I'm trying to make a A-Z index and would like to filter the response of my custom taxonomy by the first letter of the taxonomy name. So, if I have ['Ana', 'Olina', 'Ford'], i'd like something like wp-...
0
votes
1answer
16 views

Rest API: trouble receiving response through script (browser and Postman display correctly)

I made a simple plugin to practice connections to the WP Rest API. Testing a get request to http://localhost/wptest2/?rest_route=/wp/v2/posts/1 in browser and using Postman, I see the default "Hello ...
0
votes
0answers
11 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 ...
-1
votes
1answer
52 views

Rest API does not work after changing Wordpress Theme

Rest API works perfectly with default theme twenty sixteen, but when I change the theme the post on site does not appear. Anyone have the exact problem? <script type="text/javascript"> $(...
0
votes
0answers
14 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
1answer
31 views

Advanced Access Manager: RESTful endpoint to refresh token

I'm using Advanced Access Manager (AAM) plugin, and have been trying to refresh a still valid JWT token using the /aam/v1/refresh-jwt RESTful endpoing, however I’m getting the following error: “...
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
23 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
0answers
13 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
29 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
1answer
16 views

Which route in the WP REST API do I access data passed into register_setting()?

For example: $args = array( 'type' => 'string', 'description' => '', 'sanitize_callback' => null, 'show_in_rest' => true ); //Job Board ...
0
votes
0answers
18 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
36 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
19 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
1answer
55 views

wp_remote_get() returns 403 while file_get_contents() does not

We are working on a WordPress plugin and we require an API call. We are using the api: http://www.geoplugin.net/json.gp?ip=8.8.8.8 In this context: $response = wp_remote_get("http://www....
0
votes
2answers
43 views

Create custom post with meta field with AJAX and the Wordpress REST API

I have created a custom post type and I got it to show in the REST API. I have also registered a custom field using the following code : function slug_get_post_meta_cb( $object, $field_name, $...
0
votes
0answers
17 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
35 views

Wordpress REST API parameters are not affecting a response

I'm working on small, vue based SPA. I'm using axios to get data from api that I'm interested about. The problem is that parameters are not working in any way, the same happens in Postman (I tried ...
1
vote
1answer
117 views

Wordpress REST API, Expired Nonce from Cache results in 403 forbidden

My wordpress site sits behind Akamai, which is a cacheing service similar to Cloudflare. I make the following API call: GET /wp-json/mytheme/v1/get-posts?post_type=videos This is done using ...