I am trying to upload a image file into google drive... Code ;
function upload() {
var url= // url for image
var contents=UrlFetchApp.fetch(url).getContent() // trying to get image content
var base = 'https://docs.google.com/feeds'
var fetchArgs = googleOAuth_('docs', base);
fetchArgs.method='POST'
fetchArgs.contentType='image/jpeg'
var xml={title :"image",content:contents}
fetchArgs.payload=xml
var fileURL='https://www.googleapis.com/upload/drive/v2/files?uploadType=media'
UrlFetchApp.fetch(fileURL, fetchArgs)
}
function googleOAuth_(name,scope) {
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey(consumerKey);
oAuthConfig.setConsumerSecret(consumerSecret);
return {oAuthServiceName:name, oAuthUseToken:"always"};
}
When I am running this code, I am getting this error :
Request failed for returned code 403. Server response: { "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } }
What am i doing wrong, I am not getting this....Please give me some feasible solution