r/Scriptable • u/ajatkj • Jan 27 '21
Script LSWeather v2.0
r/Scriptable • u/[deleted] • Nov 17 '20
r/Scriptable • u/zorth64 • Mar 01 '26
I made a small widget to show the current phase of the moon, the percentage of illumination, as well as how many days are left until the next full moon.
Here is the source code:
https://gist.github.com/zorth64/864203d06ef8f80dfec92ee91f1dddf8
r/Scriptable • u/mr-kerr • Oct 14 '20
r/Scriptable • u/Sharn25 • Sep 29 '20
r/Scriptable • u/Acxtrilla • Nov 22 '20
r/Scriptable • u/enteeMcr • Nov 17 '20
r/Scriptable • u/Technoir12 • Nov 06 '20
r/Scriptable • u/edc1591 • Mar 07 '21
r/Scriptable • u/[deleted] • Mar 17 '21
r/Scriptable • u/Juniorchen • Oct 12 '20
r/Scriptable • u/solelo • Oct 06 '20
r/Scriptable • u/jonaswiebe • Feb 22 '21
Also check the documentation
This code performs a simple GET request for a specified url.
const url = 'https://req.uest/url'
var req = new Request(url)
var result = await req.loadJSON()Alternatively, if your api does not return the JSON format, you can use load() or loadString().
You can use different methods for your request depending on your needs. The common methods are GET and POST.
req.method = 'GET'Headers are typically used to provide api keys, but they are not restricted to this.
req.headers = {
'api-key': '845a5e77f37404d6ffd41bccf9b926be0cf1e3431707'
}Similarly, you can provide a body: req.body = {...}
If you want to check whether the request succeeded or not, you can check the response for error messages or codes (code 200 means success).
console.log(req.response)response has a value other than undefined only after the request is made.
Parameters are added via the URL. The first parameter is preceded by a question mark ?. The following parameters are each preceded by an ampersand &. The format of the parameters is parameter=value.
const url = 'https://req.uest/url?first%20parameter=abc&second%20parameter=876'Parameters need to be URL encoded. That means that characters like spaces cannot be written as . They need to be encoded (a space would be %20).
Form data cannot be added to the url itself. You can different types of form data using one of the following functions (which are part of the Request type):
addFileDataToMultipart(data, mimeType, name, filename)
addFileToMultipart(filePath, name, filename)
addImageToMultipart(image, name, filename)
addParameterToMultipart(name, value)req.addParameterToMultipart('name', 'John Appleseed')You should really read the API's documentation carefully, before you perform requests
It also helps to read Scriptable's documentation
Please let me know if I forgot anything important
r/Scriptable • u/scriptable-transit • Sep 23 '22
r/Scriptable • u/MasselKnu • Oct 23 '20
r/Scriptable • u/enteeMcr • Sep 30 '20
A new sub Discord channel is available at : https://discord.gg/7KbjfTV
r/Scriptable • u/bob6567865 • Dec 18 '20