2015-04-07 45 views
2

我總是得到400 - 錯誤的請求 - invalidArgument爲什麼我在https://www.googleapis.com/appsactivity/v1/activities上遇到400錯誤?

400 OK 


- Hide headers - 

cache-control: private, max-age=0 
content-encoding: gzip 
content-length: 133 
content-type: application/json; charset=UTF-8 
date: Tue, 07 Apr 2015 11:11:32 GMT 
expires: Tue, 07 Apr 2015 11:11:32 GMT 
server: GSE 
vary: Origin, X-Origin 

{ 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "invalidArgument", 
    "message": "Bad Request" 
    } 
    ], 
    "code": 400, 
    "message": "Bad Request" 
} 
} 

我沒有使用任何參數,文檔中的所有可選

這個錯誤出現在所有以下情況

  1. Documentation page demo
  2. playground
  3. using python api

有人可以幫助我嗎?,我做錯了什麼?你可以嘗試在文檔頁面:https://developers.google.com/google-apps/activity/v1/reference/activities/list?hl=es

感謝

回答

0

你應該張貼你要執行的代碼,或至少提供更多的細節上演示的一部分,你正在使用和遇到的錯誤用。

嘗試它後,我的GET請求是這樣的:。

GET https://www.googleapis.com/appsactivity/v1/activities?drive.ancestorId=aa&key={YOUR_API_KEY} 

注意{YOUR_API_KEY}中從未取代

你需要去這裏:https://console.developers.google.com/project,並得到,如果你的API密鑰還沒有。然後,您需要在「Google Apps API」下啓用。

5

好吧,我發現這個問題,

drive.fileId是不可選的,是文檔中的錯誤,來源應該是=「drive.google.com」和drive.fileId =「file_id」

@dubhov,感謝您的幫助。但「YOUR_API_KEY」由Google內部處理。

+0

您對@dubhov的回覆應該是對他們回答的評論,而不是回答。 – abraham

0

頁的演示工作,

你需要只發送一個drive.fileId或drive.ancestorId,如果您同時使用這將返回「invalidArgument」。

源應該是= drive.google.com

並授權使用OAuth 2.0請求。

這就是所有你需要使它工作。

祝你好運。

相關問題