Trying to fetch data from the ConvertAPI's web to jpg but the program throws an error for a Bad Value. Here's my code :
const url = 'https://v2.convertapi.com/convert/web/to/png?Secret=...'
const prams = [
{
"Name": "Url",
"Value": "..."
}
];
Logger.log(UrlFetchApp.getRequest(url, prams));
I believe your goal is as follows.
From your provided document, you want to convert the following HTTP request to Google Apps Script.
Unfortunately, your
pramscannot be directly used for UrlFetchApp. And,UrlFetchApp.getRequestdoesn't request. And also, yourpramsis different from the sample of the document you provided.When these points are reflected in Google Apps Script, how about the following modification?
Modified script:
Secretand the values ofpramsagain.Note:
In the document, there is a sample curl command of
curl -F "Url=" -F "StoreFile=true" https://v2.convertapi.com/convert/web/to/jpg?Secret=<YOUR SECRET HERE>. When this is converted to Google Apps Script, it becomes as follows.Please test the above 2 patterns.
References: