无法使用Google Photos API(和ColdFusion cfhttp)获取Google相簿内容

时间:2019-03-21 09:53:43

标签: coldfusion google-oauth google-photos google-photos-api

我会尽量简短。我的OAuth使用的是Google Photos API。我可以返回专辑和媒体项目,但不能返回专辑特定的媒体项目。

下面,我已经完成了三个请求。前两个起作用,而第三个不起作用。 注意:在第三个请求中,我从第一个请求中返回的结果中获取了专辑ID。

<!--- This works --->
<cfhttp method="GET" charset="utf-8" url="https://photoslibrary.googleapis.com/v1/albums" result="res">
    <cfhttpparam name="Authorization" type="header" value="OAuth #application.oauth2.GetAccess_token()#" />
</cfhttp>
<cfdump var="#deserializeJSON(res.filecontent)#">

<!--- This works --->
<cfhttp method="GET" charset="utf-8" url="https://photoslibrary.googleapis.com/v1/mediaItems" result="res">
    <cfhttpparam name="Authorization" type="header" value="OAuth #application.oauth2.GetAccess_token()#" />
</cfhttp>
<cfdump var="#deserializeJSON(res.filecontent)#">

<!--- This doesn't. I get a 404 for this --->
<cfhttp method="POST" charset="utf-8" url="https://photoslibrary.googleapis.com/v1/mediaItems:search" result="res">
    <cfhttpparam name="Authorization" type="header" value="OAuth #application.oauth2.GetAccess_token()#" />
    <cfhttpparam name="albumId" type="formfield" value="AHeArAbj3EfLJqs23FHD9SWuReCaaPA0VBZxw6HNwL752bJr5X882_ZJnitk7kjZJwtzXvrw6hp2" />
</cfhttp>
<cfdump var="#res#">

这是我为上一个请求得到的结果; enter image description here

我最近发出的请求有什么问题?我正在尝试使用以下API调用:https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search

0 个答案:

没有答案