I am doing an analysis of Credit Union social activity. I have some code that takes a link like this...
https://www.facebook.com/americanlakecu/likes
... and converts it to this...
http://graph.facebook.com/americanlakecu
..which enables me to grab 'Likes' and 'People Talking'. The problem is many institutions, particularly the smaller ones, seem to use a different format. Here's an example.
https://www.facebook.com/pages/EvergreenDIRECT-Credit-Union/276887662722?sk=likes
Anyone know how to convert the link above so I can use the api to render JASON in the same way as http://graph.facebook.com/americanlakecu ?
You need to reference the facebook id when hitting the graph for the other institutions. For americanlakecu, that id is americanlakecu. For Evergreen's case, try 276887662722. But for some reason, your "smaller" pages need an access token. I think the difference might be a simple matter of availability of data.
You can still get their data as I described above, but you need an api access token. For instance, following this link directly will show you nothing: http://developers.facebook.com/tools/explorer/?method=GET&path=276887662722 , but after you get there, if you fetch an access token, you will see all the info you need.
So, configure your implementation of the SDK to use an access token, and you ought to be able to continue using the handy graph method.
Related
for a master thesis I need to analyze several Instagram profiles with more than 1000 posts each.
I need a list of the following things:
Post Type (Image, Multi Image, Video)
description
Likes
Comments (count)
Is there a way to do this with the Instagram Api or do you have another idea how this can work?
Thank you so much
Torben
Sorry. Not easily possible. Facebook has disabled this feature. What parts of this that still work will likely be disabled. You could try to scrape the profiles yourself from the public HTML Instagram webpages.
Using the developer console in Google Chrome and analyzing the network traffic I found the following URL that might be able to do some of what you want. Looks like calling the /graphql/query/ URL with a JSON object as a query parameter labeled: variables, along with a hash of some kind of that object. Not sure if you can call it on your own, but I've had success with other embedded URLs like this. The ID is the users ID which you can get from the HTML as well.
I hope it helps somehow.
https://www.instagram.com/graphql/query/?query_hash=76d9c5f9c2d88aa251ece9ea61fdc570&variables=%7B%22id%22%3A%225466275%22%2C%22first%22%3A12%2C%22after%22%3A%22AQCqBkaT0gZcgV1z9nfTgM3saTJi3cDRQoQy2YM4SdWNWyo3kdMTfCzWvuGcGRI9e1WpAIquMMG9jeuuXSe0TSMiQMPIL1ZmVimTMQ0dfrD_9Q%22%7D
Decoded that is:
https://www.instagram.com/graphql/query/?query_hash=76d9c5f9c2d88aa251ece9ea61fdc570&variables={"id":"5466275","first":12,"after":"AQCNhv_lxGd-nHBBaZb5kk3J4N-n058NgyCiWDnJ10rLc2V-YrVUvGsiuXr4NsMQ4QDzOLdjbTIVqoMpspJ69r-0s-PzOceis9J25o8P2BcjdA"}
I’m in the middle of making an Express app. It’s just a learning project.
I’m getting some info from an Anime api called jikan.me, it provides info about different Anime series like a picture url and synopsis.
For example one is at https://api.jikan.me/anime/16 .
Now, the jikan api might have a json endpoint at anime/1 but there's nothing at anime/2.
I want to find a list of all the numbers (https://api.jikan.me/anime/[numbers]) that actually contain endpoints.
I've tried simply going to https://api.jikan.me/anime but it returns error: No ID/Path Given.
I'm expecting there is likely no absolute answer to this problem but that I might learn something about server-side code along the way.
Where would I begin to look to find this info?
This is a bit late but, Jikan is an unofficial REST API for MyAnimeList. The IDs are respective to the IDs on MAL. For example; https://myanimelist.net/anime/1 can be parsed through https://api.jikan.moe/anime/1 but the ID 2 does not exist on MAL. It's a 404, hence that error.
To initially get some IDs, you can try the search endpoint.
Furthermore, I'll be releasing REST 2.2 quite soon (this month) which will give you the ability to parse from pages like these and thus you'll get another endpoint that provides a handful of IDs to get their data from.
Source: I'm the developer of Jikan
If it's not in the documentation it's probably information not available to you... a REST api needs to be specifically configured to offer certain endpoints, that number at the end might just be an ID that's searched for in an internal database and there's no way for the application to know if there's gonna be something there; all they can do is return an error message for you to handle as is the case here.
I'm very new to the api system and i was wondering how to get data from a certain page. So my link is:
https://nookipedia.com/w/api.php
but i want to get my api from this page:
https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf
but when i try this:
https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf/w/api.php
the link doesn't work and gives me this error:
Error 404: Not found
The requested page or file could not be found on our server. It may have been moved or deleted.
How would i get that certain page?
I suggest you play around with the API sandbox on Wikipedia to see how queries are built. You will still need to read the actual API documentation to get useful information...
Basically, you want to pass the title(s) as a parameter to api.php, like so:
https://nookipedia.com/w/api.php?titles=Bugs/Animal_Crossing:_New_Leaf
However, this will still get you no information by itself; you need to know what data you want exactly, and use the correct API module with the appropriate parameters. For example, to get all the categories of a page:
https://nookipedia.com/w/api.php?action=query&titles=Bugs/Animal_Crossing:_New_Leaf&prop=categories
For this specific example, you can see the documentation for the Query API and the Categories property:
API:Query
API:Categories
I’m developing a REST-API with NodeJS and Express with a MySQL-backend. The existing database has a lot of 1:n relationships and I’m struggling to find the right URI-scheme for these specific cases.
A simple example:
user {
id
name
}
comment {
id
text
user_id
}
Now, when I try to get the a list of all users, my uri would be: /users
- for one specific user: /user/{id}
- data for one specific user: /user/{id}/name
- for a list of all comments: /comment
- for one specific comment: /comment/{id}
- data for one specific comment: /comment/{id}/text
Now, the part where I’m struggling.
There is a 1:n relationship between user and comment. One user can have multiple comments, one comment belongs to one user. I want to implement something like a ‘back-reference’, so that when I access the data (meaning one specific field) for one specific comment, I can also get the information about the user the comment ‘belongs’ to.
The API doesn't know about these relationships, I'm also not using an ORM, so I have to hard code the information about the relationships somewhere anyway.
I already implemented a route where I can make a request on /comment/{id}/user_id where I redirect the request to /user/{id} with the id the comment belongs to. But this would be the same request for when I just want to get the user id for that comment, not the whole dataset for the user.
I've read a lot about the REST architecture and roy fielding always talks about making the API "browsable" or "explorable". One approach I came upon was adding a reference uri to the linked dataset, in my example that would mean expanding the user_id field to something like this :
user_id {
id:id
ref:/user/id
}
The results I'm getting from the database are much more complex than that and extracting the respective fields and adding this information seems like a bit much to do for this ‘simple’ problem.
I don't know if I'm missing something here, I'm developing this API for a project on which I also write a paper about and I try to follow the rules of the REST architecture as much as I can, but I'm a bit stuck right now.
What about publishing the comments "under" the user resources like this:
/user/{userid}
/user/{userid}/comments/{commentid}
Note, that you don't have to publish "database rows" one-to-one in a REST API. Indeed, this is usually frowned upon by REST people.
Also note, you don't have to publish each attribute of a resource as a resource. The resource /user/{userid} could very well return a complex (json, xml, etc.) representation that includes all the necessary data. Of course there are reasons to do it your way, for example I would make the text of a comment a separate resource if it is available in pdf, text, html, or in other formats which I don't control.
A minor point about Fielding's "browsable" API: What he means is that these resources reference each other through links in the returned data representations. Comments would reference the users (link to user), and users should reference their comments (links to comments). The client should never have to "guess" or "construct" an URI on its own, it should "browse" resources by following links only!
There is a web service that allows me to go to a URL, with my API-key, and request a page of data. The data is returned as JSON. The JSON is well-formed, I ran it through JSONLint and confirmed its OK.
What I would like to do is retrieve the JSON data from within MS Access (2003 or 2007), if possible, and build a table from that data (first time thru), then append/update the table on subsequent calls to that URL. I would settle for "pre-step" where I retrieve this information via another means. Since I have an API key in the URL, I do not want to do this server-side. I would like to keep it all within Access, run it on my PC at home (its for personal use anyway).
If I have to use another step before the database load then Javascript? But I dont know that very well. I dont even really know what JSON is other than what I have read in Wikipedia. The URL looks similar to:
http://www.SomeWebService.com/MyAPIKey?p=1&s=50
where: p = page number
s = records per page
Access DB is a JavaScript Lib for MS Access, quick page search says they play nicely with JSON, and you can input/output with. boo-ya.
http://www.accessdb.org/
EDIT:
dead url; wayback machine ftw:
http://web.archive.org/web/20131007143335/http://www.accessdb.org/
also sourceforge
http://sourceforge.net/projects/accessdb/