如何使用 google-gdata .net API 通过 ID 从 Picasa 获取单张照片
我正在尝试使用 .net API 库通过 ID 从 Picasa 获取单个图像。
到目前为止,我尝试通过以下方式找到正确的调用:
- new Photo();但没有构造函数参数告诉它要获取哪张照片
- new Entry();与上面相同
- PicasaQuery.CreatePicasaUri;但我还必须指定 albumId,但我没有。
我似乎也无法在 API 文档中找到对此的 REST 调用(通过它我可以完全绕过 .net API)。
我当然已经用谷歌搜索过这个,但要么似乎没有人想要通过 ID 获取单个图像,要么我错过了明显的(或者这是一个疯狂场景......)。
I'm trying to use the .net API library to get a single image by ID from Picasa.
So far, I've tried to find the correct call by doing:
- new Photo(); but there are no constructor params to tell it which photo to get
- new Entry(); same as above
- PicasaQuery.CreatePicasaUri; but I have to specify the albumId as well then, which I don't have.
I also can't seem to find the REST call for this in the API documentation (with which I could circumvent the .net API completely).
I've of course Googled this, but either nobody seems to want to get a single image by ID or I am missing the obvious (or this is a crazy scenario...).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CreatePicasaUri 方法具有三种变体,其中一种接受照片 ID。您说得对,您需要专辑 ID,但您应该能够获得它。
要获取相册列表及其相关信息(请注意,我使用名为 MyAlbum 的结构来存储相册中的所有照片信息,以便稍后在我的代码中使用):
根据照片 ID 进行查询:
The CreatePicasaUri method has three variations, one of which accepts a photo ID. You're right that you'll need the album ID but you should be able to obtain that.
To get a list of albums and their associated info (note that I use a structure called MyAlbum to store all of the photo info from the album for use later in my code):
To query based on Photo ID:
你写道:
我同意您的观点,Picasa 上的 Google API 文档没有明确说明。不是我看到的。
但是,执行 GET 操作
https://picasaweb.google.com/data/feed/api/user//albumid//photoid/
您至少需要 2 个标头在该 GET 请求中:授权和 GData 版本。请查阅文档以了解这些标头需要保存什么。
典型的照片请求如下所示:
典型的响应如下所示:
You wrote:
I agree with you, the Google API documentation on Picasa doesn't spell it out explicitly. Not that I saw.
But, Do a GET on
https://picasaweb.google.com/data/feed/api/user/<userid>/albumid/<albumid>/photoid/<photoid>
You will need at least 2 headers in that GET request: Authorization and GData-Version. Consult the doc to see what those headers need to hold.
A typical request for a photo looks like:
A typical response looks like: