Tumblr API: how to retrieve title and id of all text posts - tumblr

I want to pull all the text posts ever made to display a list of links. I just need the post title and id.
This form of url
http://api.tumblr.com/v2/blog/{mydomain}/posts/text?api_key={key}
retrieves all the data for the first 20 or so entries. Is there a way to
Just get the title and id to reduce the amount of data returned (the
body element can be large).
Get more than 20 entries with one request (since the amount of data is now smaller the hit on the tumblr server is reduced and I'd like it to do more).
Without a solution the only way I can think of to display a table of contents for all posts is to query and retrieve all posts: including their body elements.

Related

Post into Confluence table using REST API

Found many examples on simple API queries but nothing close to what i want.
I have my space key and page ID, this is my table
How can i append hyperlinks, and attach a file in cell 3 for each build using REST API.
get the page : add expand=body.storage as a query parameter to get the body.storage.value which holds the html tags. Then parse the get response to edit the specific value in the 's then when updating the page update the body.storage.value withing your json like in the example: https://docs.atlassian.com/atlassian-confluence/REST/latest-server/#content-update

Parse Data Model for users tagging items

im trying to figure out a good data model approach when using parse (underlying mongodb) for users that are allowed to select a tag and provide a value to them, lets call it just a rating since thats the easiest to understand.
Im working on a class that is called user tags that has the following structure currently in its collection.
User (pointer to user class)
Object (pointer to object to tag)
Tags (array of tags with values)
The tags can be up to maybe 30 tags and each one of them can have a rating of 1-5 in this case...
I was wondering if I could do a PFRelationship in an array that has the objectId of the tag as the key and value as the 1 - 5 rating.. here is an example json object mocked up to what im saying.
{
"3q24afadfadf": 3.5 //parse relation object id : value,
"234rrdfadfk": 2.4 //parse relation object id : value,
"as4q2w34lsdf": 2.3 //parse relation object id : value
}
This way I can store one row for the item that the user tagged and all the tags with its rating value along with that.
I'm not sure this is the right way or if its scalable when doing queries for get me all users items he or she tagged, along with the tag (name) and the values).
I also on top of that need to figure out a way to when many users tag the same item with different values that I build up some analytics or maybe counter class that gets incremented or averaged in to then be displayed along with the item. I might try cloudcode to do saveafter to update the analytic data class for that item.
Anyhow Any thoughts on this model would be appreciated and most importantly need to be able to get at the data inside the tag array, with hopefully the key being a pointer, if not a pointer i'm up to suggestions because the result should return
Item A
Tag name 1 with value 4.5
Tag Name 2 with value 3.5
and so on..
...
Also if you have any pointers to how to build aggregated data of the item and its over all value that many users have tagged over time.. My thought as above is to have a analytic class that the cloud code increments or that the app then increments, the challenge is to load all the user tags of item x, and get the tag and value out of the array and then add them to the analytic class. I could run this at night since it doesn't have to be real time.

How to write nested Graph API request

I am trying to create nested FB Graph API request to get images for public event.
The full JSON object is given at this gist: https://gist.github.com/ZeKoU/be92b88440a6ca3d6be3
What I am trying to do is to get only data.0.images object, i.e. I want to get first object from data , then to get images array, and then to pick some fields from there (source for example).
However, all my attempts (see picture below) are returning only two fields for each object inside data field.
Not sure what you're trying to do, but from what I understood the query
/310897782446456?fields=photos.fields(id,images{source}).limit(1)
should be an example of getting the first photo, extract only some fields from the object (id and images for example), and then get a single field (source for example) from the images array's objects.
https://developers.facebook.com/tools/explorer?method=GET&path=310897782446456%3Ffields%3Dphotos.fields(id%2Cimages%7Bsource%7D).limit(1)&version=v2.3
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#fieldexpansion

Google Chart - DataTable inside a form

I have a table created with DataTable of Google Chart, which has a column with a drop-down list. In this way the user can set the proper value of a row.
I am working in Python and Flask and I can retrieve the request data correctly. The problem is that the table, given the amount of data, is showed in pages, each one with 20 rows. When I retrieve the request I get only those 20 rows, so I have no way to know what the user set in the other pages.
How can I get the values of all pages?
Moreover, I noticed that when I change page and then I go back, the table forgets the user changes, so I think I should be careful also to this fact.
Finally, I solved the problem by using a dictionary containing all the changes made to the table and updating the html string inside the table to keep the content updated.

How to get (better) demographics for fans of a Facebook page?

I'm trying to get demographics for fans of a page on Facebook - mostly country and city, but age and gender as secondary.
The primary way to do it is using FQL and doing a query in the insights table. Like so:
FB.api({
method: 'fql.query',
query: "SELECT metric, value FROM insights WHERE object_id='288162265211' AND metric='page_fans_city' AND end_time=end_time_date('2011-04-16') AND period=period('lifetime')"
}, callback);
The problem with this, however, is that the table returns a maximum of 19 records only, both for the country and the city stats. The response for a page I'm testing is as such:
[
{
"metric": "page_fans_city",
"value": {
"dallas": "12345",
"atlanta": "12340",
(...)
"miami": "12300"
}
}
]
So I'd like to know if there's any alternative to that -- to get demographics of the current fans of a page (no snapshot necessary).
Things I've tried:
Using LIMIT and OFFSET on the query do nothing (other than, sometimes, give me an empty list).
One alternative that has been discussed in the past is to use the "/members" method from the Graph API (more here) to get a list of all users, and then parse through that list. That simply doesn't work - a method exists, and it may have worked in the past, but it's not valid anymore (disabled?).
Request:
https://graph.facebook.com/platform/members?access_token=...
Response:
{"error":
{
"type":"OAuthException",
"message":"(#604) Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http:\/\/developers.facebook.com\/docs\/reference\/fql "
}}
Other solution was to do a query to the page_fan table and filtering by page_id. This doesn't work, either; it may have worked in the past, but now it says that the page_id column is not indexable therefore it cannot be used (same error as above, which leads me to believe /members uses the same internal API that has been disabled). Page_fan query is only useful to check if individual users are fans of a page.
There's also the like table, but that's only useful for Facebook items (like posts, photos, links, etc), and not Facebook Pages.
Going to the insights website about the Page, you can see the data in some nice graphs and tables, and download an Excel/CSV spreadsheet with the historic demographics data... however, it also limits the data to 19 entries (sometimes 20 with a few holes in there as cities trade top positions though).
Any other hint on how to get that data? I'd either like the insights query with more results, or at least a way to get all the page fans so I could do the location query myself later (even if the page I want to get it from has almost 5 million fans... gulp).
The data pipeline for this metric is currently limited to 20 items. This is a popular feature request and something Facebook hopes to improve soon.