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
1answer
4k views

Problem with cURL and rest API

I use last version of wordpress and woocommerce but I get this {"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}} when I try to get product by ...
3
votes
1answer
7k views

How to filter by category in REST API, excluding posts also in other category term?

I'm using REST API to load a several posts from other site, each post must belong to a different category. However I have one "Featured events" category, that includes posts also shown in other ...
1
vote
1answer
3k views

Handling nonce generation in AJAX registration process

I am currently working on a multi-steps registration system, based on the new Wordpress Rest API and I got an issue related to the nonce generation and verifying. My first step is to ask the user ...
1
vote
1answer
449 views

rest api request including meta_query filter

I'm creating a web service using the WP REST API v.2. Is it possible to include something like a meta_query filter when requesting a custom post type? For example, if I was using WP_Query, I could ...
10
votes
1answer
454 views

run silex or slim with wordpress

I am running a theme on WordPress. In this theme, I am making some AJAX calls where I am expecting some response. (http://example.com/capis/v0/packages/) To serve above http calls I am using silex ...
0
votes
1answer
278 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 ...
1
vote
2answers
160 views

Confused about AngularJS and Wordpress

Ok, so I have created a custom post type and installed the relevant REST plugins and I have a working JSON feed. What do I do next? Basically, I would like to display a portion of the JSON feed on ...
6
votes
1answer
3k views

Wordpress REST API - Permission Callbacks

I'm currently building a small REST API with the WP-REST v2 plugin. Everything is working perfectly fine, however, in the documentation there are permission callbacks, which restrict access to certain ...
4
votes
0answers
159 views

Retrieve CSS and JS From the REST API

Does anyone know of a way to get a list of all registered styles and js scripts in-use on a site via the REST API? Essentially was wp_print_styles() does?
3
votes
1answer
1k views

Android authentication

I'm using WordPress REST API (Version 2), and I want to authenticate Android native app with my self-hosted WordPress site. How can I perform that using username and password ?
2
votes
1answer
7k views

WordPress V2 REST-API: Endpoints 404?

I just installed and activated the latest version of the WP REST API plugin. However, when I attempt to access a REST endpoint, I end up with the Apache 404 page. $ curl -i 'http://example.com/wp-...
1
vote
1answer
265 views

Post to WordPress using REST API from external site

I am trying to post to WordPress using the REST API. The aim is to have a form that accepts The following information: Title Content ACF Custom Field 1 (possibly repeater field) ACF Custom Field 2 (...
4
votes
1answer
472 views

Using the REST API (v2) javascript client on a private namespaced route

I am using the latest version of the REST API plugin in a project and I've added my routes to a separate namespace (as recommended in the documentation). The javascript client included with the API ...
2
votes
1answer
4k views

How to generate HMAC-SHA1 signature to use with WP REST API and OAuth1

I'm trying to publish a post using WP REST API. I was able to authenticate using OAuth1 using the PAW http client. I was able to publish a post to the site as well (again using PAW). PAW generated ...
1
vote
1answer
1k views

Get all tags not just first 10 with wp api 2.0

if I do /wp-json/wp/v2/tags I only can get first 10, and seems the adding per_page=0 no longer work on it for getting actually all tags. Anyone knows how to actually get all the tags with wp-api 2.0?
3
votes
1answer
3k views

register_rest_field for custom taxonomy fields that are assosiated with custom post type

I am trying to register a rest field for my custom taxonomy's custom meta fields. I followed the tutorial at Modifying Responses . The code worked great for adding a rest field for post meta data for ...
14
votes
4answers
18k views

Hiding WordPress REST API v2 endpoints from public viewing

I would like to start using the WordPress REST API v2 to query information from my site. I've noticed that when I visit an endpoint URL directly, I can see all of the data publicly. I've also seen ...
1
vote
3answers
991 views

How to handle malformed response from WP REST API?

Happy day scenario: I implement WP REST API that sends JSONs to a JavaScript client, which parses it and displays the data to the user. All is fine. What actually happens, inevitably: some WordPress ...
9
votes
4answers
17k views

How to get custom post meta using REST API

I am trying to create a REST APIs for my wordpress website which is used for facility listing using wordpress job manager plugin. I have registered my custom post , taxonomies in \plugins\rest-api\...
1
vote
2answers
98 views

How do I query my Wordpress posts on another HTML page using the Wordpress Restful API?

I have a fully functional Wordpress site and I want the to create a new separate website that displays the posts from the wordpress site using the Wordpress Rest API. I understand that typing http://...
0
votes
1answer
2k views

Getting a Page via its post-name using WP REST API v2 and Postman

Using Postman as a Chrome extension I have had success accessing Pages(not posts as I don't use them) from my WP website. Having trouble pulling data using the post-name url that I set way back in ...
4
votes
0answers
1k views

How to allow users login to WP from external domain and make REST requests

Basically what i want to do is: Use Wordpress as a login system and data storage for web-application on another domain. Make users able to register and perform REST calls from the application. Let ...
14
votes
4answers
10k views

Filtering multiple custom fields with WP REST API 2

I want to filter posts based on multiple acf custom fields with AND relation. Something like this: $args = array( 'post_type' => 'product', 'meta_query' => array( '...
0
votes
1answer
2k views

WP REST API - get custom taxonomies based on terms & filter

I need to get the list of data's with taxonomy term property_category,based on this property_category having data's like apartment,house,office etc.For example localhost url given http://192.168.0....
0
votes
1answer
415 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 &...
3
votes
1answer
3k views

How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API

I'm new to wordpress and also working with WP REST API for mobile application development for the wordpress website. Here I want get data's filter & search based post meta custom fields. I've ...
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
1answer
144 views

Replace content via rest api only?

I am not really looking for code as answer but just the idea. How can i replace content in posts or pages without using short codes or plugins via the recent rest API? In template engines you'd have ...
0
votes
2answers
2k views

Why 'do_shortcode' doesn't work in a REST request?

Why do_shortcode doesn't work in a REST call ? In the example below, do_shortcode exists, but the shortcode isn't interpreted. Route declaration /* Adding a route with callback is ...
3
votes
1answer
1k views

WP MultiSite API - Create new sites

I'm building an app for iOS/Windows. I want to allow my users to register / create a new sub site on my domain via the app. How can I achieve this? Does the REST API allow this? Thanks.
0
votes
3answers
4k views

How to get author meta into post endpoint in api v2

I'm trying to output all of the fields in the json result but seem to be using the object incorrectly. I want to add author meta fields to the post endpoint. This doesn't work function ...
2
votes
2answers
2k views

Get blog title with REST v2

I can't find the answer after searching, so... How do I get the title of a site using the REST API v2? All I can find in the API docs are the posts, pages, tags,...
3
votes
1answer
7k views

Custom route for WP-API gives “rest_no_route” value

I am following this tutorial to create custom end points to WP-API . I am always getting this error on hitting /wp-json/custom-plugin/v2/get-all-post-ids/ on postman to test : { "...
5
votes
2answers
24k views

How to use WP-REST API to login user and get user data for Android app?

I want to use Wordpress REST API to Login and get user data on android app. I am using wp_users table for user and a custom table for user info . I tried writing my own REST API but i for that i ...
1
vote
1answer
2k views

Develop REST API using Wordpress for Android app [closed]

I am an Android developer and new to WordPress. Requirement : is to write rest APIs to Login and get User details after login. All the plugins and wp-rest apis only expose core functionalities and ...
2
votes
1answer
5k views

How Do I Add User Custom Field to REST API Response?

I am writing a WordPress theme that adds several custom fields to the user profile using the following function function add_contact_methods( $profile_fields ) { // Add Social Media Fields $...
0
votes
2answers
213 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
3answers
13k views

WP REST API - Retrieve content from page

I already get posts from categories with: http://domain.com/wp-json/wp/v2/posts?filter[category_name]=category-name but how can i retrieve content from page? - [page_name]=page-name for example but ...
1
vote
1answer
4k views

WP REST API format response

I'm using 'WP REST API Version 2.0-beta12" by http://wp-api.org/ to use REST API, available via HTTP of my site's data in simple JSON format. I have formatted my json output to limit reponse field ...
2
votes
2answers
5k views

How would I add custom tables/endpoints to the WP REST API?

I have created custom tables for performance reasons for products, carts, and notifications. I want to make these tables and their data available for normal CRUD via the WP REST API v2. How would I ...
16
votes
6answers
5k views

Does something like is_rest() exist

I am starting a bit with the REST API. If I am not completly mislead, the init action hook is also executed when its a REST API request. Now, I want to execute some code only, when it is not a REST ...
1
vote
2answers
2k views

Why aren't tags and categories added in post request to WP Rest API

I'm using V2.0 and trying to create a post using the /posts endpoint. Here's the payload being sent with my request: var payload = { title : "some title", format : "link", tags: ["...
1
vote
1answer
368 views

body_class REST field in WP-API

I'm building a site with WP-API (v2). I'm attempting to add a REST field according to documentation that includes anything from body_class. However, body_class is returning either one class (one ...
0
votes
1answer
1k views

wp_query json ouput

I'm writng custom endpoints for my mobile app.. My output like this Tried somethings, but getting null values for id, title and content. function my_function($request) { $data = array(); $id = (...
2
votes
1answer
2k views

Wp Rest Api Custom Endpoint for page subpages

I'm tring to add a custom endpoint for a page subpages. Parent Page ID = 151 function list_subpages( $data ) { $subpages = get_pages( array( 'child_of' => $data['151'], ) ); if ( ...
0
votes
1answer
1k views

Attach featured image to custom endpoints

I went through this article and create a custom endpoint so that I can specify multiple meta key and value pairs for filtering. However I have no clue to attach featured image on this result. How can ...
6
votes
1answer
1k views

WP REST API create post authentication issue

I am getting a 401 or 403 error when trying to create a post from front end. I am using angular in the front end and I want to use basic authorization. I have enqueued the api and created the nonce: ...
5
votes
1answer
2k views

wp rest api v2 return json_no_route

i am using WP rest API v1 and everything is ok. But now i want taste some WP rest API v2. the problem is, when i cal: mysite.com/wp-json/wp/v2/posts or: mysite.com/wp-json/wp/v2/post or ...
0
votes
1answer
188 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 ...
17
votes
7answers
815 views

REST API purpose?

First of all, I understand that this is a plugin at current point but it is most certainly almost part of WordPress anyway. So I hope that this is not getting flagged as off-topic. I've read their ...