-
Notifications
You must be signed in to change notification settings - Fork 10
/
scripts_scriptID.yml
180 lines (168 loc) · 5.31 KB
/
scripts_scriptID.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
get:
operationId: GetScriptsID
tags:
- Data I/O endpoints
- Invokable Scripts
summary: Retrieve a script
description: |
Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/).
#### Related Guides
- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/)
parameters:
- in: path
name: scriptID
schema:
type: string
required: true
description: |
A script ID.
Retrieves the specified script.
responses:
'200':
description: Success. The response body contains the script.
content:
application/json:
schema:
$ref: '../schemas/Script.yml'
examples:
$ref: '../schemas/ScriptGetResponse.yml'
"401":
$ref: "../../../common/responses/AuthorizationError.yml"
"500":
$ref: "../../../common/responses/InternalServerError.yml"
'404':
description: |
Not found.
content:
application/json:
schema:
$ref: "../../../common/schemas/Error.yml"
examples:
notFound:
summary: |
The requested script was not found.
value: {
"code":"not found",
"message":"script \"09afa3b220fe400\" not found"
}
default:
description: Internal server error.
$ref: '../../../common/responses/ServerError.yml'
patch:
operationId: PatchScriptsID
tags:
- Invokable Scripts
summary: Update a script
description: |
Updates an invokable script.
Use this endpoint to modify values for script properties (`description` and `script`).
To update a script, pass an object that contains the updated key-value pairs.
#### Limitations
- If you send an empty request body, the script will neither update nor
store an empty script, but InfluxDB will respond with an HTTP `200` status
code.
#### Related Guides
- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/)
requestBody:
description: |
An object that contains the updated script properties to apply.
required: true
content:
application/json:
schema:
$ref: '../schemas/ScriptUpdateRequest.yml'
parameters:
- in: path
name: scriptID
schema:
type: string
required: true
description: |
A script ID.
Updates the specified script.
responses:
'200':
description: Success. The response body contains the updated script.
content:
application/json:
schema:
$ref: '../schemas/Script.yml'
examples:
$ref: '../schemas/ScriptUpdateResponse.yml'
"401":
$ref: "../../../common/responses/AuthorizationError.yml"
"500":
$ref: "../../../common/responses/InternalServerError.yml"
'404':
description: |
Not found.
content:
application/json:
schema:
$ref: "../../../common/schemas/Error.yml"
examples:
notFound:
summary: |
The requested script wasn't found.
value: {
"code": "not found",
"message": "script \"09afa3b220fe400\" not found"
}
default:
description: Internal server error
$ref: '../../../common/responses/ServerError.yml'
x-codeSamples:
- lang: Shell
label: cURL
source: |
curl -X 'PATCH' \
"https://cloud2.influxdata.com/api/v2/scripts/SCRIPT_ID" \
--header "Authorization: Token INFLUX_TOKEN" \
--header "Accept: application/json"
--header "Content-Type: application/json"
--data '{
"description": "get last point from new bucket",
"script": "from(bucket: updatedBucket) |> range(start: -7d) |> limit(n:1)", "language": "flux"
}'
delete:
operationId: DeleteScriptsID
tags:
- Invokable Scripts
summary: Delete a script
description: |
Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records.
#### Limitations
- You can delete only one script per request.
- If the script ID you provide doesn't exist for the organization, InfluxDB
responds with an HTTP `204` status code.
#### Related Guides
- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/)
parameters:
- in: path
name: scriptID
schema:
type: string
required: true
description: |
A script ID.
Deletes the specified script.
responses:
'204':
description: |
Success.
The script is queued for deletion.
"401":
$ref: "../../../common/responses/AuthorizationError.yml"
"500":
$ref: "../../../common/responses/InternalServerError.yml"
default:
description: Unexpected error
$ref: '../../../common/responses/ServerError.yml'
x-codeSamples:
- lang: Shell
label: cURL
source: |
curl -X 'DELETE' \
"https://cloud2.influxdata.com/api/v2/scripts/SCRIPT_ID" \
--header "Authorization: Token INFLUX_TOKEN" \
--header 'Accept: application/json'