-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp-examples.http
More file actions
340 lines (258 loc) · 9.67 KB
/
Copy pathhttp-examples.http
File metadata and controls
340 lines (258 loc) · 9.67 KB
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
###############################################################################
# NexFlow Pulse - HTTP Examples
#
# This file contains example HTTP requests for the NexFlow Pulse API.
# You can use these with:
# - VS Code REST Client extension
# - JetBrains HTTP Client
# - curl (see comments below each request)
# - HTTPie
#
# Replace YOUR_API_KEY with your actual API key.
###############################################################################
@baseUrl = https://api.nexflowapp.app/v1/pulse
@apiKey = YOUR_API_KEY
###############################################################################
# HEALTH CHECK
# Check API status (no authentication required)
###############################################################################
### Health Check
# curl https://api.nexflowapp.app/v1/pulse/health
GET {{baseUrl}}/health
###############################################################################
# CREATE JOBS
###############################################################################
### Create an Interval Job (runs every 60 seconds)
# curl -X POST https://api.nexflowapp.app/v1/pulse/jobs \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"name":"Health Check","targetUrl":"https://httpbin.org/get","method":"GET","scheduleType":"interval","intervalSeconds":60}'
POST {{baseUrl}}/jobs
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"name": "Health Check",
"targetUrl": "https://httpbin.org/get",
"method": "GET",
"scheduleType": "interval",
"intervalSeconds": 60,
"maxRetries": 3,
"timeoutMs": 10000
}
### Create a POST Job with Headers and Body
# curl -X POST https://api.nexflowapp.app/v1/pulse/jobs \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"name":"Webhook Notification","targetUrl":"https://httpbin.org/post","method":"POST","scheduleType":"interval","intervalSeconds":300,"headers":{"X-Webhook-Secret":"my-secret"},"body":{"event":"scheduled_ping","source":"nexflow"}}'
POST {{baseUrl}}/jobs
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"name": "Webhook Notification",
"targetUrl": "https://httpbin.org/post",
"method": "POST",
"scheduleType": "interval",
"intervalSeconds": 300,
"headers": {
"X-Webhook-Secret": "my-secret",
"X-Custom-Header": "custom-value"
},
"body": {
"event": "scheduled_ping",
"source": "nexflow",
"timestamp": "{{$timestamp}}"
},
"maxRetries": 5,
"retryBackoffSeconds": 60,
"timeoutMs": 15000
}
### Create a Cron Job (runs daily at 9 AM UTC)
# curl -X POST https://api.nexflowapp.app/v1/pulse/jobs \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"name":"Daily Report","targetUrl":"https://api.example.com/generate-report","method":"POST","scheduleType":"cron","cronExpression":"0 9 * * *","body":{"type":"daily"}}'
POST {{baseUrl}}/jobs
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"name": "Daily Report Generator",
"targetUrl": "https://httpbin.org/post",
"method": "POST",
"scheduleType": "cron",
"cronExpression": "0 9 * * *",
"body": {
"reportType": "daily",
"format": "pdf"
}
}
### Create a High-Frequency Job (every 10 seconds)
# Note: High-frequency jobs will incur more charges
POST {{baseUrl}}/jobs
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"name": "Real-time Monitor",
"targetUrl": "https://httpbin.org/get",
"method": "GET",
"scheduleType": "interval",
"intervalSeconds": 10,
"timeoutMs": 5000
}
###############################################################################
# LIST JOBS
###############################################################################
### List All Jobs
# curl https://api.nexflowapp.app/v1/pulse/jobs \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs
Authorization: Bearer {{apiKey}}
### List Active Jobs Only
# curl "https://api.nexflowapp.app/v1/pulse/jobs?status=active" \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs?status=active
Authorization: Bearer {{apiKey}}
### List Jobs with Pagination
# curl "https://api.nexflowapp.app/v1/pulse/jobs?limit=10&offset=0" \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs?limit=10&offset=0
Authorization: Bearer {{apiKey}}
### List Errored Jobs
# curl "https://api.nexflowapp.app/v1/pulse/jobs?status=error" \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs?status=error
Authorization: Bearer {{apiKey}}
###############################################################################
# GET SINGLE JOB
# Replace {jobId} with an actual job ID
###############################################################################
@jobId = 550e8400-e29b-41d4-a716-446655440000
### Get Job Details
# curl https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs/{{jobId}}
Authorization: Bearer {{apiKey}}
###############################################################################
# UPDATE JOB
###############################################################################
### Pause a Job
# curl -X PATCH https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"status":"paused"}'
PATCH {{baseUrl}}/jobs/{{jobId}}
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"status": "paused"
}
### Resume a Job
# curl -X PATCH https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"status":"active"}'
PATCH {{baseUrl}}/jobs/{{jobId}}
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"status": "active"
}
### Update Job Schedule
# curl -X PATCH https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"intervalSeconds":120}'
PATCH {{baseUrl}}/jobs/{{jobId}}
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"intervalSeconds": 120,
"maxRetries": 5
}
### Update Job Name and Target
# curl -X PATCH https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_API_KEY" \
# -d '{"name":"Updated Job Name","targetUrl":"https://new-endpoint.example.com/webhook"}'
PATCH {{baseUrl}}/jobs/{{jobId}}
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"name": "Updated Job Name",
"targetUrl": "https://httpbin.org/anything"
}
###############################################################################
# DELETE JOB
###############################################################################
### Delete a Job
# curl -X DELETE https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# -H "Authorization: Bearer YOUR_API_KEY"
DELETE {{baseUrl}}/jobs/{{jobId}}
Authorization: Bearer {{apiKey}}
###############################################################################
# JOB RUNS (Execution History)
###############################################################################
### List Recent Job Runs
# curl https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID/runs \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs/{{jobId}}/runs
Authorization: Bearer {{apiKey}}
### List Runs with Pagination
# curl "https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID/runs?limit=50&offset=0" \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/jobs/{{jobId}}/runs?limit=50&offset=0
Authorization: Bearer {{apiKey}}
###############################################################################
# TEST RUN
###############################################################################
### Trigger Immediate Test Execution
# curl -X POST https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID/test-run \
# -H "Authorization: Bearer YOUR_API_KEY"
POST {{baseUrl}}/jobs/{{jobId}}/test-run
Authorization: Bearer {{apiKey}}
###############################################################################
# RESET RETRIES
# Resume an errored job by resetting its retry count
###############################################################################
### Reset Job Retries
# curl -X POST https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID/reset-retries \
# -H "Authorization: Bearer YOUR_API_KEY"
POST {{baseUrl}}/jobs/{{jobId}}/reset-retries
Authorization: Bearer {{apiKey}}
###############################################################################
# BILLING
###############################################################################
### Get Billing Statistics
# curl https://api.nexflowapp.app/v1/pulse/billing \
# -H "Authorization: Bearer YOUR_API_KEY"
GET {{baseUrl}}/billing
Authorization: Bearer {{apiKey}}
###############################################################################
# HTTPie Examples (alternative to curl)
###############################################################################
#
# # Health check
# http GET https://api.nexflowapp.app/v1/pulse/health
#
# # Create job
# http POST https://api.nexflowapp.app/v1/pulse/jobs \
# Authorization:"Bearer YOUR_API_KEY" \
# name="My Job" \
# targetUrl="https://httpbin.org/post" \
# method="POST" \
# scheduleType="interval" \
# intervalSeconds:=60
#
# # List jobs
# http GET https://api.nexflowapp.app/v1/pulse/jobs \
# Authorization:"Bearer YOUR_API_KEY"
#
# # Get job
# http GET https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# Authorization:"Bearer YOUR_API_KEY"
#
# # Pause job
# http PATCH https://api.nexflowapp.app/v1/pulse/jobs/JOB_ID \
# Authorization:"Bearer YOUR_API_KEY" \
# status="paused"
#
###############################################################################