ColdFusion を使用して Google Drive API の作業を開始しましたが、ColdFusion を使用してファイルをアップロードするのに苦労しています。新しいプロジェクトの登録を完了し、クライアントとクライアントシークレットを取得しました.accessTokenを正常に取得できましたが、どういうわけかGoogleドライブにファイルをアップロードできません.
Here is the code to get the code and accesstoken
<cfoutput>
<cfset request.oauthSettings = {
scope = "https://www.googleapis.com/auth/drive", client_id = "clientid",
client_secret = "clientsecret",
redirect_uri = "link"}
/>
<!--- create login url --->
<cfset loginURL = "https://accounts.google.com/o/oauth2/auth?scope="
& request.oauthSettings["scope"]
& "&redirect_uri=" & request.oauthSettings["redirect_uri"]
& "&response_type=code&client_id=" & request.oauthSettings["client_id"]
& "&access_type=offline"
/>
<a href="#loginURL#">Login with Google account that has access to analytics</a>
<cfif isDefined("URL.code") AND URL.code NEQ "access_denied">
<cfhttp url="#arguments.gaOauthUrl#" method="post">
<cfhttpparam name="code" type="formField" value="#arguments.code#">
<cfhttpparam name="client_id" type="formField" value="clientid">
<cfhttpparam name="client_secret" type="formField" value="clientsecret">
<cfhttpparam name="redirect_uri" type="formField" value="link">
<cfhttpparam name="grant_type" type="formField" value="authorization_code">
</cfhttp>
</cfif>
</cfoutput>
次のコードを使用してファイルをアップロードしています。正しいものにするためにさらにいくつかのパラメーターを渡す必要があることはわかっていますが、そのパラメーターが何であるかはわかりません。
<cfhttp url="https://www.googleapis.com/upload/drive/v2/files?uploadType=media" method="post">
<cfhttpparam name="Content-Type" type="formField" value="text/plain">
<cfhttpparam name="Authorization" type="formField" value="#session.ga_accessToken#">
</cfhttp>
Googleドキュメントで調べようとしていますが、うまくいきません。ColdFusion のドキュメントはありません。誰かがこの領域について手がかりを持っている場合は、他のパラメーターを教えてください。