I was looking through the documentation for the v5 API, and noticed a lot of them use the id (e.g user, channel, etc) to retrieve the specific object. But there’s no indication of where to get these ids… I was able to find how to get the user’s id by querying via login name, but that is not the case for say a channel.
Seems kind of counter productive that to get an object of something we have to use the id, but there’s no clear guide on where to get these id - unless I’m not seeing it.
@DallasNChains I did see that section during my search. Does that format apply to everything else (e.g channel, video, etc)? Meaning I can use /...?login=<videoname> or whatever to get the id of something?
@bvec No. Each object has an id or _id field that is returned from the API as appropriate. For example, the Get Top Videos endpoint has _id in the response for each video object. You can then pass that into the Get Video endpoint. The endpoint noted above was created to help ease the transition between v3 and v5 by translating between username (v3) to ID (v5).
It seems for a user and channel, I can use .../?login=<user|channel name> to get the object which should have the _id field. But what about other objects like video, communities, etc
@bvec I’m not sure if I’m understanding your question. For example, you can use Get Channel Videos and each video in the response has _id. That ID is what you pass into Get Video. A similar pattern applies to all objects in the API.
@DallasNChains Okay that answers my question. So there’s no straight forward way to get an id of something. I’d have to make several calls beforehand and look through the responses.
Is there a reason for that? Why not have to id readily available for lookup like in a video’s URL or something.