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
0answers
5 views

REST API: Search products only in the names

I'm using the REST API to search products by string. Quick question: Is it possible to limit the REST API query ?search= to products names ? Currently it also searches the string in the descriptions.
0
votes
2answers
614 views

Bypass wp_safe_remote_get()?

I have a PHP(Laravel) application that pushes data to WooCommerce through the WooCommerce REST API, everything works except for images. I was able to pin this down to wp_safe_remote_get() and $args['...
0
votes
0answers
16 views

How to query a nested field in wordpress api using _fields param

I'm trying to access certain fields which are deeply nested using _fields param which is offered by wordpress. What's wrong with my query? structure of response. { "_embedded" : { ...
5
votes
1answer
2k views

WP REST API returns blank response if post is too long

I'm working on an iOS app that requires the use of WP Rest API to fetch posts. Everything is working smoothly and I fetch posts by ID using this endpoint: https://example.com/wp-json/wp/v2/posts/...
1
vote
0answers
13 views

How to filter meta_values using REST API

i am able to get the data by make an API called with these args ?meta_key=frequent&meta_value=day are there any possible way to filter with multiple meta_value? i already tried meta_value=day,week ...
0
votes
0answers
9 views

How do I read Jira issues in a WordPress site using OAuth?

We're trying to setup the Jira REST api and are getting hung up on the OAuth authentication process. We followed the Atlassian (Jira) examples for this but they are seemingly outdated and not working. ...
1
vote
0answers
12 views

Downloads from my plugin not shown after migrating to up2date WP/WooCommerce

What does the plugin: The Plugin creates a custom endpoint which is used to pass the download URL to woocommerce as post metadata and complete the order. It adds the download with order id, date and ...
0
votes
0answers
11 views

Oauth question for gravity forms API in python [closed]

I'm trying to access the entries endpoint via python on a wordpress site. I am able to use Postman successfully, but when I try to use the requests library in python I run into some errors. First I ...
2
votes
1answer
29 views

Get HTTP response code on non-2xx apiFetch request

I'm using WordPress' apiFetch library to make requests (in WordPress admin dashboard) to my WordPress REST endpoints. It looks like apiFetch will throw an error if the response is a non-2xx code, ...
1
vote
0answers
11 views

Formating content rendered from wordpress REST API as JSON and not HTML

I am new to Wordpress and REST API and I need to read posts from /wp-json/wp/v2/posts with an external application called Intuiface. Intuiface can interpret JSON but the content of the post is shown ...
0
votes
0answers
21 views

Rest API and how to deal with it in server side

I'm developing a wordpress theme that uses REST API mostly. Normally I'm just creating a custom endpoint and pulling the data from that endpoint with vanilla JS's fetch. My problem is: I have a ...
1
vote
0answers
16 views

Ho to style post content for Wordpress API?

I'm completely new to Wordpress and Wordpress API. I managed to understand how the API works and how to fetch data from it on my Vue application. Now, I have an issue with my posts. I am trying to ...
1
vote
1answer
921 views

filter custom post in rest api with custom function

i have 3 custom post type : artists, songs, videos songs and videos have a meta that sort artist id of songs or videos filter in rest api couldn't return filtered post by artist id custom meta so i ...
1
vote
0answers
12 views

Use the backbone.js client to save custom post type meta

So I have this small piece of code that renders an array of IDs: const selected = this.$data.list.selected; function get_ids(input, field) { const output = []; for (let i=0; i < input....
2
votes
0answers
22 views

Wordpress blog posts api - get posts by author

Is there a standard route for getting all blog posts by specific author id? I can't find anything obvious. I tried this but I get a 404 error http://localhost:8888/mysite/wp-json/wp/v2/posts?author=...
1
vote
2answers
5k views

Get the Category Name instead of ID from WP-API

I'm trying to get the category name instead of the ID from the WP REST API for my Custom Post Type. Some articles about endpoint modification gave me some ideas on how to solve it, but unfortunately i'...
0
votes
1answer
76 views

Strange behavior: random HTTP error 500 fixed by visiting Permalinks settings page (htaccess issue with language code)

I’ve got a pretty weird behavior on my site that I’d like to resolve. From time to time (no recognized pattern), my site shows a 500 error, on the front pages or on some admin pages. When this 500 ...
0
votes
0answers
10 views

Need to display custom post type data in xml format in domainname.com/example.xml url

I need to display custom post type all data as XML format in domain.com/example.xml url Please guide me that how can I do it. It will be always updated details. Site is in wordpress.
1
vote
1answer
128 views

Custom endpoint that returns an xml

I need to create an endpoint that when called returns an XML with the products of the store. I have the XML generated, but I don't know how to make the endpoint return it in XML format, because now it ...
1
vote
1answer
844 views

Can the new REST API now make WP into it's own push notification server?

I'm not a coder by any stretch but if i'm not mistaken, if I wanted to use my WP website as a source of dynamic content inside a phone app then I'd need a 3rd party server to send the push ...
0
votes
0answers
13 views

Woocommerce REST API - add filter to set maximum query per page for product brands

I'm trying to list all my product brands in a single page, currently i'm able to get only 100 brands per page by using wp-json/wc/v3/products/brands?per_page=100. but if i set per_page=200, i'm ...
1
vote
1answer
858 views

Embedding custom posts with REST API

I am trying to find a way to embed basing custom post infomation, such as post title and few custom metas on other website. The easiest seems to be doing it in iFrame, but there are many "no's", you ...
0
votes
1answer
1k views

Custom Post Type API doesn't show taxonomy or category array

Using this url http://www.my_site.it/wp-json/wp/v2/portfolio/ this is a object custom type on that json: where are taxonomy or category array?
0
votes
1answer
21 views

wp_get_object_terms() returns invalid taxonomy inside rest_api_init hook

I have created a taxonomy called 'country' and I have created a function that hooks into rest_api_init inside which is wp_get_object_terms($post-ID, 'country'). For some reason wp_get_object_terms ...
7
votes
2answers
14k views

WP REST API — How to change HTTP Response status code?

I have a custom endpoint where I want to change HTTP response status to 404 in certain scenarios (e.g post does not exist). How can I do that? Here is an example of custom endpoint: function ...
0
votes
1answer
26 views

Application passwords not working on localhost?

I have to get following error on the localhost "code":"application_passwords_disabled" Server & Apache: Xampp v3.2.4 OP: Win 10 64Bit WP: v5.6.1
0
votes
0answers
12 views

Woocommerce API v3 get products in multiple categories - relation AND [closed]

all of these show products in any of these categories. I want only products with ALL categories. wp-json/wc/v3/products?category=126&category=123&category=125 wp-json/wc/v3/products?category=...
1
vote
0answers
15 views

Override Wordpress POST REST API

I use the REST API to create post and taxonomy remotely in a Wordpress website. It works perfectly for classical fields but i need to send some custom fields, and there are not interpreted by ...
0
votes
0answers
16 views

External API integration in WordPress

I have API URL where I have access key and token along with JSON format. Now I need help as to how to integrate it. My clients need his form leads directly into his API. Below is the code with the ...
0
votes
0answers
15 views

Escape commas in REST API

Sending metadata through the REST API like this, is creating multiple entries because of the commas meta: { plugin_rule_what: 'discount_percentage', plugin_rule_applies_multiple_options:'product_22119,...
0
votes
2answers
31 views

How do I get the site url from a Block (within the block editor)

I have a block in which I'd like to display a link based on the site url. So for example, when the user enters "Futuristic", the link will display as https://my-site.com/futuristic/ I've ...
1
vote
1answer
120 views

How to stop a Gutenberg Block from firing multiple GET Requests?

I've been building a Gutenberg Block that sends a GET request to the Woocommerce REST API. It is composed of a text input that receives an ID of a product and fetches it to the Woocommerce REST API. ...
0
votes
0answers
14 views

building a new site, can i use the woocommerce Rest API for bulk importing

for work, i have been tasked with building a new website. their main concerns with the new site was a better categorisation system. in order to import their products from the old site to the new one, ...
1
vote
2answers
322 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
1answer
1k views

Woocommerce Rest Api Categories problem

/wp-json/wc/v3/products/categories My site has 10 main categories. But when I run the query, only 3 main categories and their subcategories are listed. Other categories don’t come up with what could ...
4
votes
4answers
5k views

REST API, get user role?

I'm trying to figure out how to retrieve a user's roles from the API, but I haven't been able to sort it. Is this information not accessible by default? Can anyone point me in the right direction?
0
votes
0answers
12 views

WooCommerce Customer Rest API

I am trying to create a mobile app for a WooCommerce site, I can see that there is a REST API, however, it would seem this is for use for the admin side of things. Such as an admin app to monitor and ...
0
votes
1answer
31 views

WP_REST_Response() doesn't seem to return the expected object

Building on this answer, the WP_REST_Response() object returned by the callback function of my custom route is not the object I'm asking it to return. My object has a "status" of 304 and a &...
1
vote
1answer
31 views

How to create a post using REST API with sending data as a JSON body?

I am able to create posts on my WordPress website using it's REST API with the below curl request format. Website uses basic auth plugin for the authentication process. curl --user "username:...
1
vote
2answers
643 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
2answers
1k views

Sending post data over REST API, how to parse shortcodes in post_content?

I am using the REST API to publish posts outside of WordPress, and have run into a problem where not all of my shortcodes are getting processed. Specifically, most of my plugins' shortcodes are ...
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
0answers
70 views

Organize media library into folders and get folders via WP Rest API?

I'm building a Vue/NuxtJS portfolio site that will hopefully use WordPress as a headless CMS. I've been searching for hours but can't seem to come to a definitive solution. I know it's possible to ...
0
votes
1answer
12 views

Fill up advanced custom field of a custom post type via API REST POST

I have few custom fields created by ACF on a custom post type "room". I use postman and the REST API to try to create a new room with my custom fields. The Autorization is ok. I success to ...
1
vote
0answers
16 views

How to upload Woocommerce product images via API? [closed]

I am using Python lib to automate product uploading. I am looking at Woocommerce Rest API documentation and I could not find a way to upload products while creating one. All it assumes that product ...
0
votes
1answer
732 views

Single page applications with Wordpress: routes and templates

(Read carefully, this is a question about Wordpress and not about AngularJS) I'm trying to make a single page application with AngularJS and the Wordpress rest API. Many things that are usual when ...
0
votes
0answers
21 views

Exporting Post Content Including post_content_filtered Field

How can we include the post_content_filtered field with our exported post content in WordPress? We have an older WordPress site (setup behind a firewall circa 2016/2017, version 4.7.19). This site ...
5
votes
1answer
94 views

Are there server performance benefits to fetching only specific fields when querying the REST API?

I understand that having less data being downloaded improves the experience to the end user, but my question is related to the actual server performance, would the response be faster? I am fetching ...
4
votes
3answers
1k views

How to check WordPress website username and password is correct

On my site i have one form for client to submit their WordPress site details. On that form containing these fields WordPress admin url, username, and password. I want to check their login details are ...
0
votes
1answer
13 views

Get Custom taxonomy parent with wordpress REST API

I have a custom taxonomy product_category , and it accepts parent / child relationship. The url: /wp-json/wp/v2/product_category shows me everything, Parent and Child. is it possible to add parameters ...

1
2 3 4 5
23