Home>

This is an attempt to send a still image to LINE Bot using GAS from a network camera called QWatch whose API is open to the public.

The API specifications are as follows

Authority: User or administrator (admin)
Method: GET
URL: /snapshot.jpg
Parameter: None


command
curl --digest -o test.jpg -u:http: //:/snapshot.jpg
Return value
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length:
Date:

The code written in GAS is as follows.

function getDataFromCamera () {
  const auth_data = Utilities.base64Encode (`${"user "}: ${"password "}`);
  var options = {
        "headers": {"Authorization": `Basic ${auth_data}`}
  }
  Logger.log (response)
}


When I run the code, I get the following error message:

The API specification says that no parameters are required, but I thought that it was necessary to break through basic authentication, so I wrote this code, but I feel like I have overlooked something fundamentally. I asked you a question.