I am working on an Android application for my Wordpress site, I've added the Rest API plugins in order to be able to get the data in JSON form.
I am using the following URL to get posts
http://mywordpress.com/wp-json/wp/v2/posts/?categories=1&per_page=100
I am using &per_page=100 because it seems that by default it loads only 10 posts.
My problem is that every time I load posts in my Android app, the posts are displayed in a random order, I am using SwipeRefreshLayout so that I can refresh the posts, but each time I do the refresh the posts are displayed in random ordered, is there a way I can order my posts by date desc?
JSON data can never be relied upon to be in a certain order. Refer to JSON order mixed up
Sort the data to get a certain order.
Related
I am completely new to Bixby development so I apologize in advance if this is a newby question that doesn't make sense. I'm trying to understand the best way to store value sets returned from external APIs to use throughout Bixby Voice experiences. An example might be an API that gets all the menu items at a restaurant or an API that gets all the clothing catalog items from a store. When users interact with the data to search or transact I don't want to have to go back to the external API to get the value set again. For example: Find Vegan Menu options followed by Okay how about pescatarian options. Or: Find dress pants followed by okay how about dress shirts. I'd like to come back to a menu object in the first case or a catalog object in the second without having to re-load the value sets from the API.
In the sample code I've seen all of the value sets appear to be read in each time an action/endpoint/java call is made
There is no local storage in the current version of Bixby.
The easiest solution is to request through API calls. However, http.getUrl() itself is cached by default, and Bixby runs on Samsung server, so no actual API calls in practice when requesting same url in short sessions.
You can read more about http API options and how to disable cache feature by reading more here
Images in homepage and search result pages are missing for some time, this happens after performing Impex import for products after making some changes in media files. The product details page works fine by showing the updated images after synchronization from staged to the online catalog.
Interestingly this issue will be solved after some time makes it difficult to debug.
This issue is related to the Solr indexing after synchronization. after impex import and synchronization with online cataloge,the media URL will get updated.Since the Product details page fetch image url's from database,it will show up.but the respective images in home page and search pages are taken from solr and that is not valid anymore because the cron job to update sold index not yet completed.
The solution is to replace the image URL which is suppose to be shown in search page as well as in the home page contained in product data to the updated one from DB using modelservice().save(productData) using populator.
I am trying to add a feed of my Instagram/ a hashtag to my Big Cartel homepage.
I have tried several widgets but pasting the code they generate, no feed shows up on my page.
I know I will need my Client ID and/or Access Token.
I am using the Luna Template.
I would really appreciate any help.
when i'm accessing the instagram API via the https://api.instagram.com/v1/tags/nofilter/media/recent and i click refresh on the browser, it seems to get more posts, but the count doesn't change on the app in iOS or on the API. Is there actually more posts being posted or is it just cycling through old ones?
There is a maximal limit of returned media per request: 33 (by now). By default the API should return 20 items. Regardless of refreshing the browser, the number of posts per request does not change.
I assume that you were getting the same number of media after refreshing the browser, but they were new, just being posted on the Instagram. However, they could have more data (longer descriptions etc.), which could give you an illusive impression of more fetched items.
Current scenario
I have build an application that harvest Instagram images from a specific hashtag.
I use the pagination to fetch all images, and store the data (not the images) locally in a database. The first invocation of the app harvest all images. Subsequent invocations only harvest those newer than the newest image in the local database. Otherwise I would need to make thousands of request to page through all images on popular tags. And that would need to be done every few minutes, if images where to appear without too much delay in the app.
The problem that arises is that when users put tags on old images, these images are then not fetched by my app - because of the only-fetch-new-images performance construct.
Attempt at solution
I looked at the realtime API, but is seems to me it is constructed in a way that makes it unsuable. This is what it sends in a realtime update for a tag:
{
"subscription_id": "2",
"object": "tag",
"object_id": "nofilter",
"changed_aspect": "media",
"time": 1297286541
}
I would have thought that there would be a list of media IDs, representing the new/changed content, from which I could fetch the actual content - but there is not.
My current solution is to fetch new content every few minutes, and then doing full rescans every hour. This is suboptimal both from a user, and a performance perspective.
Question
Is it really not possible to do in a more elegant way? I appreciate that Instagram does not send the full content in the realtime update, but sending the IDs should not be a problem in terms of payload-size. It seems like the API is pretty useless in this regards - the only use-case I can think of, where it would be of any use, is for a "There is new content on you hashtag watch" nofications.
Best,
Torben
What I do with geography search is that everytime I get a update package I query the recent geography endpoint. This works quite well. Im guessing thats the idea with tag subscription aswell, have you tried querying the recent instagrams tag endpoint?
/tags/[tag-name]/media/recent
Paginate the recent media for a tag with the min_tag_id parameter to sort the result based on when it was tagged and not when the photo was taken. We use this in combination with the realtime api at silarapp.com and it works fine.
From the Instagram Api Documenation (my emphasis):
Get a list of recently tagged media. Note that this media is ordered by when the media was tagged with this tag, rather than the order it was posted. Use the max_tag_id and min_tag_id parameters in the pagination response to paginate through these objects. Can return a mix of image and video types.