This is my first time working with Wordpress APIs, and i'm not a PHP developer. Essentially our client just wanted us to display WordPress articles in our react-native app with simple data like the:
date
title
content
thumbnail
etc..
...anything you'd find in the default response, and this was easy. We simply used the default endpoints like this one: https://demo.com/wp-json/wp/v2/posts?categories=1015
Anyways... Our client now wants to display the "view count" of each article. However, i can't find that data in the default response:
Is there a way to get this view count data, and have it return in the API response, without having to customize every single endpoint?
Thanks
I am developing an android app. I dont know anything about wordpress database or how to get data from the website. I googled for how to get data from the wordpress database I have got to know I could get json response from JSON API plugin of the wordpress. but It's hard for me to understand.
I am using food bakery theme for wordpress.
I just want to know how do I get required json response from this website. And where the data of products in that website is located in database.
for example : product,categories etc. etc
My expected response is something like this
{"Category":[{"ProductSubGroupCategoryCode":"PSG03","ProductGroupCategoryCode":"PG01","Description":"WRAPS"
,"CHello SirreatedBy":"101","CreatedDate":"\/Date(1486116932060)\/","ModifiedBy":null,"ModifiedDate":null}]},
{"SubCategory":[{"ProductID":"01","Description":"VEG BURGER","ReferanceID":"VEG BURGER","UOM":"EA","AlterUOM":"EA",
"ProductGroupCategoryCode":"PG01","ProductSubGroupCategoryCode":"PSG01","TaxCategoryCode":"","TaxCode":"VAT5","BuyPrice":100,
"AttributeCode":"PA01","BasicPrice":190.48,"TaxRate":5.00,"SalesPrice":200.00,"ProductImage":null,"CurrentStock":10,
"PlantCode":"PC01","StoreLocationCode":"S01","DisplayOnPOS":true,"POSDisplayOrder":0,"CreatedBy":"101",
"CreatedDate":"\/Date(1486446663333)\/","ModifiedBy":"101","ModifiedDate":"\/Date(1486447253063)\/"}
Edit:
I tried with WP REST API i have come upto, when i use this link it gives me response with id 1 http://localhost/mysite/wp-json/wp/v2/posts/1.
when when I have tried with other post IDs it gives me blank response.
FYI I got post ID for that certain post from wordpress_posts table of wordpress database
if you want to get post:
https://example.com/wp-json/wp/v2/posts
if you want to get a particular post
https://example.com/wp-json/wp/v2/posts/1852
whereas 1852 is the id of the post
For getting JSON response from word press site you need to install certain open source plugin on word press site
here is an WP API link
Click here
As per documentation You can also create custom API
You can access your posts json on wordpress with
http://oursite.com/wp-json/wp/v2/posts
we are facing a major issue on the Instagram API calling section using PHP (Codeigniter 3). First of all we want to tell you that our app in in live mode and we are very sure of that . The pagination URL object is coming blank after 20 images and we have tried different ways using the COUNT parameter on the section and the next_max_id and next_min_id but all in vain. So please suggest us some new way to do this section. We can not use javascript on this section according to our requirements.
Some of the small example are below how e call the api and what are we using.
https://api.instagram.com/v1/users/self/media/recent/?access_token=3963420514.440235f.df3a5b4f9d6546cb9512ffd0a13ae62f&count=13
https://api.instagram.com/v1/users/3963420514/media/recent?
Thank you in advance.
I checked your API response it has pagination data
just use the pagination.next_url to get the next set of 13 posts via API, I tried it, it worked with your API above.
If not you can also maually add &max_id={value of pagination.next_max_id} to the API to get next set of posts
cant quite find the answer I need so hopefully you guys can help.
I am trying to develop ( with basic but growing knowledge!) a split search bar for a custom cake website.
basically I have one search bar in the header, and a drop down with whole site and cakes in it.
When the whole site is selected I want it to pass the search parameters to googel custom search and display on the page. when cakes is selected it triggers a custom php search I wrote to search for and display a single cake picture.
I am doing this at the moment with an if statement. so if type=cakes then ( run php () else put search terms through google custom search.
Now I have tried using the results only format for it, but it doesnt seem to render anything! I dont know how to pass my parameter to the results page. I tried setting the parameter to cakeref which is what i have specified previously.
Any help or explanations as to how google custom search works and integrates would be amazing.
Try this
$search_query = "Is+Wikipedia+IsGreat";
$amazon_url = "https://www.googleapis.com/customsearch/v1?key=3425lh43lkh52lk34jh5&cx=023470239740:kj2h3kl4hlk23&alt=atom&num=5&q='$search_query'";
$google_search = file_get_contents($amazon_url);
You need API Key and CX number for calling this API. And urlencoding to encode query parameters.
Try Curl also..
API Client Library is here
http://code.google.com/p/google-api-php-client/
http://code.google.com/p/google-api-php-client/source/browse/trunk/examples/customSearch/index.php
http://www.phpclasses.org/package/6301-PHP-Perform-searches-with-the-Google-Site-Search-API.html
I have implemented google custom search engine on my website http://www.finalyearondesk.com/
What I want is that when user enters his query into my own defined search bar, then the results [By result I mean the result that is displayed right after just entering the query and hitting enter, for example "ubuntu"] must be displayed in this page... http://www.finalyearondesk.com/search.php . At now the result are just displayed where I have inserted the code that google has given me.
The Google custom search is a JavaScript Ajax widget. The browser talks to Google independent of your site.
If you want results in your search.php page, either put the search-box on the search.php page, or query Google server side, then display the formatted results any way you like. This is very not ideal because Google limits the number of queries you can do.
Long story short, you have to live with the ads and limited placement options google gives you.
You can always attempt to write your own web search engine if you don't like it [/sarcasm]