base-urlgoogle-photosgoogle-photos-api

Google Photos REST API “BASE_URL=dv” return "302 Moved" error


I was using Google Photos REST API to download my videos. Based on the documentations, I was using the below curl command with BASE_URL=dv parameters to get the video file and getting 302 Moved error but video is in READY state. Pasted the output below. Kindly help to resolve the error.

API:

curl --compressed --output - --request GET   --header 'Authorization: Bearer ACCESS_TOKEN'   --header 'Accept: application/json' 'BASE_URL=dv'

Output:

<HTML>
<HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="VIDEO_URL">here</A>.
</BODY></HTML>

Solution

  • I believe your goal as follows.

    In this case, please use the following curl command.

    Modified curl command:

    curl -L "base-url=dv" -o sampleFilename
    

    References: