02_04-Subpaths_limits_etc

  • 11 năm trước

Category

📚
Learning
Transcript
00:00The Graph API allows you to search through a user's graph data by creating a path to
00:10You can build more complicated queries by using limits and also making sub queries.
00:19So, I have the Open Graph API Explorer already open and by default it's creating a path for
00:30In your apps, you're probably going to be using the path /me to get the graph of the
00:41If you want to find out about connections, then you've got a couple of options, you can
00:48At first you'll see this field section, if you scroll down you'll see connections, let's
01:01You can also see that friend was added to the list of fields in the path.
01:13Sometimes it's a little bit cleaner to have access to specific connections, like with
01:23We can request additional fields if you like, so let's add movies from the list of connections, and I'll hit Submit.
01:35example, when we request that movies, it's also returning category as well as the created
01:45From this pop-up list, I'll select limit, and type in a number, say 3.
01:56So here you have one friend, another friend, and another friend.
02:07one in, that's going to allow me to see the next three users.
02:19Let's say that now instead of limiting the amount of friends, you wanted to limit the
02:27command to the movies field.
02:35and select limit, I can type in a limit for the amount of movies that I want each result
02:47Notice that some of these friends haven't recommended any movies, but they still appear
02:53Let's go ahead and add the name of the friends so it's a little clear.
03:01Now within the movies you also have access to subfields, if you click on this plus sign
03:09They have things like awards, directed_by, name, plot_outline, and other things.
03:19You can choose them from this pop-up list or if you know him just type them in.
03:30One of the commands is limit(2) and the other one is fields and in there I can type in the
03:39So now I can see the movies ID, as well as the name, a link to a picture, as well as
03:51I also added a description and a number of likes that tells you how popular this movie
04:00These parentheses also let you go inside individual fields and pass additional attributes.
04:09us a URL right here.
04:16Now I'm going to hold down the Command key and click on this image, so it'll appear in a new tab.
04:28tries as best as it can to give you an image of that size.
04:36So you may have to develop some CSS just scale up or down any images that are too big too
04:46limit the pictures to the size that we want.
04:54So you can see that by adding some periods and parentheses, we can really get very detailed
05:01They can get quite complex, but they're pretty much like passing a string via a get command on a form.