Image is not displayed after uploaded by the Google Drive API

0

I'm trying to understand Google Drive's api to perform uploads, I'm using Postman to do HTTP requests. I can upload an image to a folder in my Google Drive, but when I see the image, it is not displayed, not even when I download and open it on my computer.

The process I'm doing is as follows:

1st - I make a GET request

POST /upload/drive/v3/files?uploadType=resumable HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer {meuToken}
Content-Type: application/json; charset=UTF-8
X-Upload-Content-Type: image/*
Cache-Control: no-cache
Postman-Token: 22d77213-5eec-2cc0-45b5-88c9395a673b

{
"name":"imagemTeste",
"parents": ["1D11cM-VvYhsmD9gmdJPXsWinHbMc1oZB"]
}

2nd - With the response in the header of the first request, I have a new URL that google provides me, and in it I perform a PUT.

PUT /upload/drive/v3/files?uploadType=resumable&upload_id=AEnB2Up91ZnUH3q80KnaN2FnIcVCRiqV0xAQZgJmYqAdR-ppflu5k57pspmedhWcC11XKG7k0H5A7tZ1gH5IMYeBE7JSHdAOZw HTTP/1.1
Host: www.googleapis.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: {tokenDoPostman}

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="primeiraImagem"

https://download.shutterstock.com/gatekeeper/W3siZSI6MTUzNjYwOTA0MCwiayI6InBob3RvLzMzNjkwNjIxNS9odWdlLmpwZyIsIm0iOjEsImQiOiJzaHV0dGVyc3RvY2stbWVkaWEifSwiY05GcklNWTF2Qi9tL0ZYK1lVMFJhVStoM0JVIl0/shutterstock_336906215.jpg 
------WebKitFormBoundary7MA4YWxkTrZu0gW--

Everything works so far, but when I go to google drive to see the image, it is not displayed. What am I doing wrong?

    
asked by anonymous 10.09.2018 / 15:37

0 answers