Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [restful]

The tag has no usage guidance.

0
votes
0answers
11 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
23 views

woocommerce plugin to query external vendors REST API

All, I am attempting to assist a friend with some research as to how much it efford /cost it would take to start a woocommerce site to sell ATV/Motorcycle parts and accessories. The site would be ...
0
votes
1answer
148 views

Serve text/html from wp-json API via WPEngine, headers not being set properly

I have read multiple entries in the WP Codex, numerous articles and Stack Exchange questions. I have a fully functioning API for a private plugin I am developing, but when moving it into production on ...
1
vote
1answer
305 views

WordPress Rest API Create Post

Is it possible to login to my different WP website from another WP website (they have different domain and host) ? Actually, I am trying to create a post on one of my site from my another site using ...
0
votes
0answers
335 views

How to upload multiple images using WP rest API to media?

I'm using JWT Authentication for WP REST API plugin and WP REST API Controller plugin Take this rest api for example, it's an api for this post, and here's the media I understand everything about ...
2
votes
0answers
608 views

WP Rest API max limit include parameter?

I'm using the rest API to get only selected posts though Rest API. I have used include=<ids> parameter. I have send the API request like: http://example.com/wp-json/wp/v2/posts?include=11,12 ...
1
vote
2answers
577 views

register_rest_route regex option for base64 or alternate

What I tested Wordpress Version: 4.9.5 PHP Version: 7.1.7/7.1.4/7.2.0/7.0.3/5.6.20/5.5.38/5.4.45 Web Server: Nginx 1.10.1/Apache 2.4.10 Environment/Host: Flywheel local https://local.getflywheel....
2
votes
1answer
202 views

Is it possible to nest the JSON result of Wordpress REST API?

I have been try to search around if it is possible to have a 'nested' JSON response in adding some custom fields through register_rest_field I have this code: function video_get_post_meta($object, $...
2
votes
0answers
2k views

WordPress REST Upload Media

How to Upload Media via the WP REST API ? I am trying to upload media to http://example.com/wp-json/wp/v2/media using POSTMAN. I tried uploading image using the following headers Content-Type: ...
0
votes
1answer
49 views

Should I edit a user meta field with PUT, PATCH, or POST and WP::Editable

I have a simple CPT called App in the backend. I have added a custom usermeta field called favorite_apps to Users On the front end, I show a list of apps, and then the user presses a star(☆) icon to ...
3
votes
0answers
88 views

How should an old API version be deprecated gracefully?

When researching and reading about the WP REST API utilization I've seen many topics mentioned about how another version should be rolled out but nothing in the documentation regarding a return for a ...
1
vote
1answer
139 views

Add Data to Response of WP-JSON Root

The default content at /wp-json/ contains name, description, url etc. but I want to add some additional content at this root level. I see lots of ways to modify the responses of items with object ...
0
votes
0answers
727 views

Custom Rest API namespace and endpoints are responding with 404 & 503 errors

I am new to WordPress plugin development. I was developing a plugin for WordPress that would be used to create mobile apps for WordPress Bloggers. The whole source code of the plugin is at:- https://...
1
vote
1answer
111 views

How can I pass get_the_author_meta('user_email') through the REST API?

In my plugin if I hard code an email address in my function with either wp_mail() or mail() I can get my form to work: function email_form($ip_address, $agent, $referrer, $email, $name, $message) { ...
2
votes
2answers
808 views

WP REST return value to error function from Request

With WP.SE's help I've learned how to send data from a form to WP_REST but now I'm having an issue with returning a custom error. I can successfully pass information to the WP_REST_Response and I've ...
1
vote
1answer
100 views

How to pass outside function to WP_REST_Request

Learning with WP REST I'm unsure how to properly pass what is typically at the beginning of a PHP page form to WP_REST_Response. For example: At the beginning of page-foobar.php if I have: // IP ...
1
vote
2answers
3k views

Confused on AJAX submit form through page template

I think I've been looking at too much code and have confused myself while trying to get a better understanding of forms in WordPress with AJAX. I set out this week to learn how to create a form for a ...
2
votes
0answers
302 views

Prevent wp_insert_user from creating duplicate users

I have a custom plugin that automatically creates a new user via wp_insert_user() if the current user does not exist yet. We use data from our remote ldap server to provide the new user's details (...
2
votes
2answers
6k views

Get Image URL instead of Attachment Id in Rest API

I want to show recent posts in my Android application and I'm suing this end point to get the list of posts https://www.geekdashboard.com/wp-json/wp/v2/posts How can I get the complete URL of ...
3
votes
2answers
2k views

How to call a REST endpoint when a post is published?

I need to make WordPress call a specific REST endpoint when a new post is published, passing the most important post data via JSON. I found a plugin, HookPress, that apparently did just that by ...
0
votes
1answer
419 views

How to create REST Based JSON API(how to modify the code below)?

if(isset($_GET['api']) ) { if ($_GET['api'] == 'json'){ $args = array( 'post_type' => 'post' ); $query ...
5
votes
1answer
591 views

WP-REST API not returning all its endpoints, 404 on documented endpoints

Here's my configuration: WordPress multisite installation on a subdirectory WordPress version is 4.7 Let's say my WordPress site is example.com/mywebsite My WordPress site has published posts The ...
20
votes
1answer
456 views

With Rest V2 (WP4.7) how does one restrict certain RESTFUL verbs?

I am aiming to restrict certain RESTUL verbs per custom post type. For example, given a Vocabulary custom post type, I would like to say: Permission Matrix +-------+---+----------+ |index | X | GET ...
4
votes
4answers
3k views

How do I fetch the static front page using the REST API?

I would like to create an Angular 2 SPA that uses the WordPress REST API as a back-end. How can I use the API to fetch the page the user has set as their front page?
1
vote
1answer
2k views

wp_remote_get keeps timing out

I'm making a plugin that compares data from external API with meta items in WordPress backoffice. I tried using wp_remote_get method to query my API but it doesn't return anything, nobody, nothing. ...
1
vote
1answer
253 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 (...
1
vote
2answers
96 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
3answers
10k 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 ...
0
votes
1answer
360 views

WP-API + JS Backbone client - how to update post meta

Using the WP API and Backbone-based JS client, I'm trying to update a post's metadata as follows: var parentId = 96; // the post id var metaData = new wp.api.collections.PostMeta('', {parent: ...
3
votes
0answers
159 views

WP REST API route request explain

Maybe can someone explain or show additional info about "WP REST API route request" from beginning to the end. Main questions, how handle this request in most earlier stage. For example for ajax ...
0
votes
0answers
783 views

GET request for media files in WP REST API 2 results in an empty array

EDIT: I have reported the issue to the development team of the plugin and they have resolved it in BETA10 version of the plugin. I have been trying to fetch all the media files from the REST API ...
-2
votes
2answers
28 views

Do i need to use PHP in customizer api?

i understand with the wp rest API i will be able to build Wordpress themes with other languages but will i be able to do the same in customizer api or would i need to use php to give customization ...
1
vote
1answer
91 views

Does it still make sense using json endpoint ep_mask now that there's the new rest api? [closed]

I was wondering... Maybe I don't get the point here, don't know. I think that the rewrite api is still usefull for creating beautiful frontend urls for regular users. But I'm not sure on adding a json ...
1
vote
0answers
21 views

AFNetworking incorrectly interpreted WP_Error

I have client code that communicates with the server to create an account. The communication works, but the error response is not received correctly. In the Objective-C code below, I use AFNetworking ...
4
votes
2answers
1k views

how to authenticate for the REST API from a plugin and from command line

I want to try the new REST API but I'm not used to this kind of things. Basically, I want to use it to GET custom posts via ajax and show on the website frontend (I'm building an ajax product ...
7
votes
1answer
5k views

How to remove rest api link: in http headers?

i would like to remove the "link:" line added to the http headers since wordpress 4.4 here is a curl -I killcandida.org here is the output extract of the line that i would like to delete: Link: &...
1
vote
0answers
533 views

WP - API - OAuth 1.0a Server, How to implement with AngularJS?

I making an Angular WordPress theme and I want to add authentication to it using the WP REST API - OAuth 1.0a Server plugin, which isn't documented not very well. I get oauth_token and ...
9
votes
1answer
7k views

Query WP REST API v2 by multiple meta keys

Using v2 of the REST API, I'm wanting to query some posts by multiple meta keys. With v1 I was able to format the url like &filter[meta_value][month]=12&[meta_value][year]=2015 and it worked (...
1
vote
1answer
3k views

How to loop through JSON data in wordpress WP REST API

I am using the WP REST API plugin in wordpress and want to loop through my json data using a for each loop, however when I var_dump the variable that the json data is stored in it gives me an error. "...
1
vote
1answer
45 views

Transfer WordPress post to RoR site: is the REST Api the only and/or best solution?

I'm creating a new version of my site without WordPress, using Ruby on Rails. How can I transfer all my posts and users to this new site ? I was thinking of using the REST Api but none of the ...
10
votes
2answers
16k views

Add media with WP-Rest-API v2

I need your help to upload a media image in my wordpress blog via the Wp-rest-api v2 and Oauth2 authentication. I did not find in the REST API documentation the way to send my image data (name of ...
1
vote
1answer
4k views

WordPress REST API not returning all posts

I am trying to get the json data of my posts. I have tried with both v1.2.4 and v2 of the REST API plugin. If I enter http://example.com/wp-json/posts?type=magazine or http://example.com/wp-json/...
2
votes
1answer
816 views

Request object for validate_callback

I'm trying to define a new REST Api endpoint based on WP REST API (version 2) and have question relating to what arguments are available to the validate_callback and sanitize_callback. Is the Request ...
6
votes
0answers
861 views

Slow REST API calls on self-hosted WordPress [closed]

I'm using WordPress REST API to access some posts from an app we're creating, but the API calls are really slow! If I'm using the domain in the call like this: https://public-api.wordpress.com/rest/...
0
votes
1answer
4k views

WordPress REST API Plugin Development - Add Custom Endpoint

I have this question on Stack Overflow but thought here might be a better place for it... I'm almost certainly doing something stupid - or rather not doing something obvious that I should have done. ...
3
votes
2answers
2k views

WP REST API, query total posts in a category

I have just started playing with the WP REST API and found that when querying posts that there is a limit of 10 post per page unless specified. What I would like to know if is is possible to return ...
0
votes
1answer
616 views

Wordpress /users/me endpoint request forbidden

Using Wordpress's plugin WP REST API version 1, there is an endpoint called /users/me which response with data for the currently logged-in user. When I requested /users/me I got 403 Request Forbidden ...
0
votes
1answer
3k views

Retrieve posts by page in wp rest api

I want to develop an app for my WordPress.org website. I am using wp rest api to receive post in json. My question is how do I retrieve posts page by page. For example if there are 50 posts I want to ...
0
votes
1answer
1k views

multi-language multi-site with REST API

I am creating a site with multiple sub-sites that should support multiple languages and be queryable with a REST API. The site itself is mostly a CMS with various pages and maybe some posts for ...
0
votes
1answer
1k views

Passing form data via AJAX to REST API And displaying results

I'm new to WordPress but have been programming PHP for a long time... I searched a bunch of questions but couldn't find what I need. I have a page with a search form that contains a few parameters ...