2016-11-30 1 views
1

사용하여 폴더를 만들 수 없습니다 :내가 항상 얻을 다중

다중 몸에 누락 된 최종 경계를.

API 샌드 박스가 도움이되지 않습니다. 거기에 폴더를 만들 수 있습니다.

요청은 다음과 같습니다. 컬 https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart -d @ home/payload -H '인증 : 무기명 mytoken'-H 'Content-Type : multipart/boundary; 경계 = RubyApiClientUpload '

페이로드는 다음과 같습니다 당신은 잘못된 API 호출을 사용하고

--RubyApiClientUpload 
Content-Type: application/json 

{ "mimeType":"application/vnd.google-apps.folder", "name":"newfolder", "parents":["0AMtAREF....."] } 
--RubyApiClientUpload 

--RubyApiClientUpload-- 

답변

0

. 폴더에는 내용이 없습니다, 그래서 당신은이 코드는 나를 위해 작동 POST https://www.googleapis.com/drive/v3/files?key={YOUR_API_KEY} { "mimeType": "application/vnd.google-apps.folder", "name": "test folder" }

+0

감사합니다. @pinoyyid! https://www.googleapis.com/upload/drive/v3/files 대신 https://www.googleapis.com/drive/v3/files를 의미합니까? 전화를 걸면 다음과 같이 나타납니다. '업로드를 업로드 URL로 보내야합니다. 이 요청을 https : //www.googleapis.com/upload/drive/v3/files? uploadType = multipart'로 다시 보내십시오. json 페이로드 (uploadType 없음)로 호출하면 무시되고 그냥 '이름'파일. API 샌드 박스에서 작성한 호출도 시도했습니다. 같은 결과 - 폴더 대신 파일이 없습니다. –

+0

예. 폴더에 대한 업로드가 없습니다. 파일 메타 데이터를 파일 끝점에 게시하면됩니다. 시도해 보는 가장 간단한 방법은 Try It을 사용하는 것입니다. 답변을 업데이트했습니다. – pinoyyid

0

을 볼 수 어디 https://developers.google.com/drive/v3/reference/files/create#try-ithttps://developers.google.com/drive/v3/reference/files/create

쉽게 테스트 할 수있는 URL에 게시하여 만듭니다.

const body = JSON.stringify({ 
    name: "Super folder!!!", 
    mimeType: "application/vnd.google-apps.folder" 
    }); 

    const headers = new Headers(); 

    headers.append("Authorization", `Bearer ${accessToken}`); 
    headers.append("Content-Type", "application/json"); 
    headers.append("Content-Length", body.length); 

    fetch(
    "https://www.googleapis.com/drive/v3/files", { 
     method: "POST", 
     headers, 
     body 
    });