I have a number of JavaScript functions that I am using in Google Sheets to perform various webpage speed tracking and archiving steps.
Would like to leverage the Internet Wayback Archive to store pages when the page score shifts +/- a particular score range.
The challenge that I'm having is that I'm not sure how (if it's possible) to execute a converted curl command from within the Google Sheets script editor interface.
If I understand things correctly, I would need to convert the following curl code:
curl -X POST -H "Content-Type: application/json" -d '{"url": "google.com"}' https://pragma.archivelab.org
to the following format:
$.ajax({
url: "https://pragma.archivelab.org",
type: 'POST',
dataType: 'json',
contentType: 'application/json',
processData: false,
data: '{"url": "google.com"}',
success: function (data) {
alert(JSON.stringify(data));
},
error: function(){
alert("Cannot get data");
}
});
Am I approaching this the correct way? Will this type of call work in the Google Sheets scripting toolset?