Skip to content

Commit 8d75d40

Browse files
committed
Modified
1 parent c539733 commit 8d75d40

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ We'll use `curl` as a sample client.
782782
##### Sample curl
783783

784784
```bash
785-
$ curl -L "[https://script.google.com/macros/s/#####/exec?key1=value1&key2=value2&key3=value3](https://script.google.com/macros/s/#####/exec?key1=value1&key2=value2&key3=value3)"
785+
$ curl -L "https://script.google.com/macros/s/#####/exec?key1=value1&key2=value2&key3=value3"
786786
```
787787

788788
##### Result
@@ -811,7 +811,7 @@ $ curl -L "[https://script.google.com/macros/s/#####/exec?key1=value1&key2=value
811811
##### Sample curl
812812

813813
```bash
814-
$ curl -L -d "key1=value1" -d "key2=value2" "[https://script.google.com/macros/s/#####/exec?key3=value3](https://script.google.com/macros/s/#####/exec?key3=value3)"
814+
$ curl -L -d "key1=value1" -d "key2=value2" "https://script.google.com/macros/s/#####/exec?key3=value3"
815815
```
816816

817817
##### Result
@@ -846,7 +846,7 @@ $ curl -L -d "key1=value1" -d "key2=value2" "[https://script.google.com/macros/s
846846
##### Sample curl
847847

848848
```bash
849-
$ curl -L -d '{"key1": "value1", "key2": "value2"}' "[https://script.google.com/macros/s/#####/exec?key3=value3](https://script.google.com/macros/s/#####/exec?key3=value3)"
849+
$ curl -L -d '{"key1": "value1", "key2": "value2"}' "https://script.google.com/macros/s/#####/exec?key3=value3"
850850
```
851851

852852
##### Result
@@ -879,7 +879,7 @@ $ curl -L -d '{"key1": "value1", "key2": "value2"}' "[https://script.google.com/
879879
##### Sample curl
880880

881881
```bash
882-
$ curl -L -H "Content-Type: application/json" -d '{"key1": "value1", "key2": "value2"}' "[https://script.google.com/macros/s/#####/exec?key3=value3](https://script.google.com/macros/s/#####/exec?key3=value3)"
882+
$ curl -L -H "Content-Type: application/json" -d '{"key1": "value1", "key2": "value2"}' "https://script.google.com/macros/s/#####/exec?key3=value3"
883883
```
884884

885885
##### Result
@@ -914,7 +914,7 @@ $ curl -L -H "Content-Type: application/json" -d '{"key1": "value1", "key2": "va
914914
In this pattern, a filename is added to the URL:
915915

916916
```
917-
[https://script.google.com/macros/s/#####/exec/fileName.txt](https://script.google.com/macros/s/#####/exec/fileName.txt)
917+
https://script.google.com/macros/s/#####/exec/fileName.txt
918918
```
919919

920920
**Note that authorization is required in this case.** When using the `curl` command, you must include an access token as follows:
@@ -924,7 +924,7 @@ $ curl -L \
924924
-H "Authorization: Bearer ###" \
925925
-H "Content-Type: application/json" \
926926
-d '{"key1": "value1", "key2": "value2"}' \
927-
"[https://script.google.com/macros/s/#####/exec/fileName.txt?key3=value3](https://script.google.com/macros/s/#####/exec/fileName.txt?key3=value3)"
927+
"https://script.google.com/macros/s/#####/exec/fileName.txt?key3=value3"
928928
```
929929

930930
Alternatively, if you are already logged into a Google account, you can directly access the URL. However, this will use the GET method.
@@ -974,7 +974,7 @@ If you wish to access `https://script.google.com/macros/s/###/exec/sample.txt` u
974974
The sample `curl` command is as follows:
975975

976976
```bash
977-
curl -L "[https://script.google.com/macros/s/###/exec/sample.txt?access_token=###](https://script.google.com/macros/s/###/exec/sample.txt?access_token=###)"
977+
curl -L "https://script.google.com/macros/s/###/exec/sample.txt?access_token=###"
978978
```
979979

980980
This will return the following result:
@@ -1118,8 +1118,8 @@ First, the status code was checked using Google Apps Script. The deployed Web Ap
11181118

11191119
```javascript
11201120
function myFunction() {
1121-
var url_exec = "[https://script.google.com/macros/s/###/exec](https://script.google.com/macros/s/###/exec)";
1122-
var url_dev = "[https://script.google.com/macros/s/###/dev](https://script.google.com/macros/s/###/dev)";
1121+
var url_exec = "https://script.google.com/macros/s/###/exec";
1122+
var url_dev = "https://script.google.com/macros/s/###/dev";
11231123
var res = UrlFetchApp.fetchAll([{ url: url_exec }, { url: url_dev }]);
11241124
res.forEach(function (e) {
11251125
Logger.log(e.getResponseCode());
@@ -1164,7 +1164,7 @@ Why was a status code of `200` returned for both `--include` and `--head` option
11641164
As a test case, when an access token is used for the `dev` endpoint with the following cURL command:
11651165
11661166
```bash
1167-
curl -sL --head -H "Authorization: Bearer ###" -o /dev/null -w "%{http_code}" "[https://script.google.com/macros/s/###/dev](https://script.google.com/macros/s/###/dev)"
1167+
curl -sL --head -H "Authorization: Bearer ###" -o /dev/null -w "%{http_code}" "https://script.google.com/macros/s/###/dev"
11681168
```
11691169
11701170
A status code of `403` was returned. From these results, the following conclusions can be drawn:
@@ -1194,9 +1194,9 @@ By following this flow, the webhook can be successfully used.
11941194
This is a sample Google Apps Script for registering a webhook URL:
11951195
11961196
```javascript
1197-
var url = "[https://api.trello.com/1/tokens/###/webhooks/?key=###](https://api.trello.com/1/tokens/###/webhooks/?key=###)";
1197+
var url = "https://api.trello.com/1/tokens/###/webhooks/?key=###";
11981198
var payload = {
1199-
callbackURL: "[https://script.google.com/macros/s/###/exec](https://script.google.com/macros/s/###/exec)",
1199+
callbackURL: "https://script.google.com/macros/s/###/exec",
12001200
idModel: "###",
12011201
description: "sample",
12021202
};
@@ -1251,7 +1251,7 @@ const doPost = (e) => {};
12511251
12521252
Both `GET` and `POST` requests return the following response, indicating a **CORS error**:
12531253
1254-
> Access to fetch at '[https://script.google.com/macros/s/\#\#\#/exec](https://script.google.com/macros/s/###/exec)' from origin 'https://\#\#\#script.googleusercontent.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
1254+
> Access to fetch at '`https://script.google.com/macros/s/\#\#\#/exec`' from origin '`https://\#\#\#script.googleusercontent.com`' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
12551255
12561256
### Sample Script 2
12571257
@@ -1266,7 +1266,7 @@ const doPost = (e) => HtmlService.createHtmlOutput();
12661266
12671267
Both `GET` and `POST` requests return the same response as Sample Script 1, indicating a **CORS error**:
12681268
1269-
> Access to fetch at '[https://script.google.com/macros/s/\#\#\#/exec](https://script.google.com/macros/s/###/exec)' from origin 'https://\#\#\#script.googleusercontent.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
1269+
> Access to fetch at '`https://script.google.com/macros/s/\#\#\#/exec`' from origin '`https://\#\#\#script.googleusercontent.com`' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
12701270
12711271
### Sample Script 3
12721272
@@ -2164,8 +2164,7 @@ var params = {
21642164
headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() },
21652165
muteHttpExceptions: true,
21662166
};
2167-
var url =
2168-
"https://script.google.com/macros/s/#####/exec?key1=value1&key2=value2&key3=value3";
2167+
var url = "https://script.google.com/macros/s/#####/exec?key1=value1&key2=value2&key3=value3";
21692168
var res = UrlFetchApp.fetch(url, params);
21702169
Logger.log(res);
21712170
```

0 commit comments

Comments
 (0)