-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiary.apib
1113 lines (912 loc) · 38 KB
/
apiary.apib
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
FORMAT: 1A
HOST: https://www.truecron.com/api/v1
# TrueCron API
TrueCron is an *enterprise strength cloud based cron service*.
TrueCron provides a REST-style API with defined resources URIs, HTTP verbs and response codes. The API is accessible
via `https://www.truecron.com/api/v1`. HTTPS is the only supported transport.
## API versions
Current version is `v1` and it is encoded as a part of URI: https://www.truecron.com/api/v1.
This endpoint is guaranteed to be compatible with all `v1` clients. New endpoints will be introduced
(`v2`, `v3`, etc.) for breacking changes.
## Data Encoding
The API returns resources and collection of resources in JSON format,
with a ContentType `application/json` and UTF-8 encoding.
There are two ways to pass parameters to API:
- For `GET` requests parameters are passed as part of a query string: `/api/v1/jobs?archived`.
- For `POST`, `PUT` requests parameters are passed as JSON objects.
```
POST /jobs
ContentType: `application/json`
{
"job": {
"name": "My test job",
"active": false,
...
}
}
```
## Actions
The API maps resource actions to HTTP verbs, when possible.
- `GET` - Return a resource of a resource collection.
- `POST` - Create a new resource.
- `PUT` - Replace a resource.
- `PUT` - Update certain fields of the resource.
- `DELETE` - Delete a resource.
## Return codes and errors
The API uses HTTP response codes to indicate success or failures. Generally, 2xx codes indicate success,
4xx - API errors, 5xx - server errors.
Code | Description
-----|-------------
200 | Request succeeded
201 | A resource was created, a typical response to a `POST` request
204 | Request succeeded, no content returned, typical for `DELETE` requests
400 | Invalid parameters
401 | User is not authenticated
403 | Access is denied
404 | Resource not found
5xx | Server failure. The client should retry the request later.
The API ignores unknown parameters. Invalid values result in the error code 400.
For 4xx codes an error object may be returned with additional error details.
{
"error" : {
"message": "Human-readable error description"
}
}
There could be an `errors` field with an array of detailed errors. These are used to report validation errors
in specific fields.
{
"error" : {
"message": "Human-readable error description",
"errors": [
{
"message": "Job name cannot be empty.",
"type": "required",
"field": "job_name"
},
{
"message": "Cannot edit Last Run time.",
"type": "invalid",
"field": "last_run"
}
]
}
}
Possible values for the `type` field are `required` (a field value is required) and `invalid`
(invalid value, read-only field, non-unique value, etc.). New types can be added later, the client
should ignore unknown types.
## Authentication
TBD
## Time handling
All timestamps accepted or returned from the API must be in UTC in `YYYY-MM-DDTHH:MM:SSZ` format.
## Partial results
When you query a resource collection, in many cases the API returns "partial" objects,
i.e. with a subset of fields. The API excludes only the most expensive fields in terms of CPU and data size.
To get a "full" object, follow the `self` link.
## I18N
The API returns human-readable strings, like error messages, change log messages, etc.
Use the `Accept-Language` HTTP header to specify your preferred language.
The API falls back to US English if the specified language is not supported.
## Common collection parameters
There are several common parameters that can be used with `GET` requests returning collections:
Name | Description | Details
---------|----------------------------------|---------
offset | Number of objects to skip. | number, optional, default: 0. Valid range: [1;maxint]
limit | Page size. | number, optional, default: 30. Valid range: [10;100]
q | Search query. | string, optional. Maximum length: 100.
sort | A field name to sort by. | string, optional. Check API documentation for valid field names.
direction| Sort direction: `asc` or `desc`. | string, optional. Valid values: `asc` or `desc`
For example, `GET /users?offset=20&limit=10&q=ping&sort=updatedAt&direction=desc`.
# Group Jobs
The *Job* resource represents a unit-of-work that can be scheduled for execution.
To make *TrueCron* execute anything, one needs to create a *Job* object, fill it
with *Tasks*, set the schedule and activate the *Job*.
## Job [/jobs/{id}]
A single *Job* object. The Job has the following fields:
Name | Type |Description
-------------|--------|---
id | string | Unique ID of the Job. Generated automaticaly when a job is created. Read-only, not null.
name | string | Job name. Cannot be empty.
tags | array | A list of string tags attached to the job. Used for searching, grouping.
active | boolean| Gets or sets wheither the job is enabled, i.e. is scheduled for execution. Default: `false`.
archived | boolean| `true` for jobs moved to the archive, i.e. are not used anymore. Default: `false`.
createdAt | string | Creation timestamp (UTC). Read-only. Set automatically when a job is created.
owner | [User][]| An owner of the job. Set to the requestor when a job is created.
updatedAt | string | Modification timestamp (UTC). Read-only. Updated automatically when a job is modified.
updatedBy | [User][]| The last user updated the job. Read-only. Set automatically when a job is modified.
starts_at | string | A timestamp (UTC) when a job should run for the first time. See a note below.
rrule | string | A recurrence rule that defines times the job should run. See a note below.
last_run | [Result][]| An object with information about the last job execution. Read-only, nullable.
next_run_at | string | A timestamp (UTC) when a job is executing next time. Read-only, nullable.
_links | links | The job provides links to self, a task collection, results collection.
### Execution schedule
Job execution schedule is defined by two fields: `starts_at` and `rrule`.
TrueCron uses a Recurrence Rule format as defined in iCalendar [RFC 2445](http://www.ietf.org/rfc/rfc2445.txt).
(refer to section 4.3.10). The `starts_at` field plays the same role as the `DTSTART` field in iCalendar.
### Execution result
The `last_run` field of the *Job* object provides information about last execution of the job.
The embedded objects has only a subset of the fields: `started_at`, `status`, `elapsed_msec`.
To get a full object follow the `self` link.
+ Parameters
+ id (string) ... ID of the *Job* object.
+ Model (application/json)
+ Body
{
"id": "1",
"name": "My first job",
"tags": ["test", "tag1"],
"starts_at": "2014-08-21T10:00:11Z",
"rrule": "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;BYHOUR=6;BYMINUTE=0;BYSECOND=0",
"active": true,
"archived": false,
"createdAt": "2014-08-21T10:00:11Z",
"owner": {
"login": "[email protected]",
"id": "123",
"name": "Alice",
"avatar_url": "https://static.truecron.com/i/ASjdwfh3.png",
"_links": {
"self": "https://www.truecron.com/v1/users/123"
}
},
"updatedAt": "2014-08-21T11:20:34Z",
"updatedBy": {
"login": "[email protected]",
"id": "124",
"name": "Bob",
"_links": {
"self": "https://www.truecron.com/v1/users/124"
}
},
"last_run": {
"id": "865D765S654236457Fhjgjg",
"started_at": "2014-08-25T06:00:00Z",
"status": "succeeded",
"elapsed_msec": 7000,
"_links": {
"self": "https://api/truecron.com/v1/job/1/results/865D765S654236457Fhjgjg"
}
}
"next_run_at": "2014-09-01T06:00:00Z",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1",
"tasks": "https://www.truecron.com/v1/jobs/1/tasks",
"history": "https://www.truecron.com/v1/jobs/1/history",
"results": "https://www.truecron.com/v1/jobs/1/results"
}
}
### Retrieve a Job [GET]
+ Response 200
[Job][]
### Update a Job [PUT]
+ Request (application/json)
{
"starts_at": "2015-01-01T00:00:00Z",
"rrule": "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;BYHOUR=12;BYMINUTE=0;BYSECOND=0"
}
+ Response 200
[Job][]
### Delete a Job [DELETE]
+ Response 204
## Jobs Collection [/jobs{?archived,active,tags,offset,limit,q,sort,direction}]
### Create a Job [POST]
Only the `name` field is required to create a new *Job*.
+ Request (application/json)
{
"name": "My first job",
"tags": ["edi", "production"],
"start_time": "2014-08-21T10:00:11Z",
"rrule": "FREQ=DAILY;INTERVAL=1;BYDAY=MO;BYHOUR=12;BYMINUTE=0;BYSECOND=0"
}
+ Response 201 (application/json)
[Job][]
### List all Jobs visible to the authenticated user [GET]
+ Parameters
+ archived = `false` (optional, boolean) ... Show archived jobs.
+ active = `true` (optional, boolean) ... Active filter of jobs collection.
+ tags (optional, string, `edi,production`) ... Tags filter of jobs collection.
+ offset = `0` (optional, number) ... Number of resources to skip.
+ limit = `30` (optional, number) ... Page size.
+ q (optional, string, `American`) ... Search query.
+ sort = `name` (optional, string, `updatedAt`) ... A field name to sort by.
+ direction = `asc` (optional, string) ... Sort direction: `asc` or `desc`.
+ Response 200
+ Headers
Link: <https://www.truecron.com/v1/jobs?page=2>; rel="next",
<https://www.truecron.com/v1/jobs?page=4>; rel="last"
+ Body
[{
"id": "1",
"name": "My first job",
"tags": ["production"],
"active": true,
"archived": false,
"updatedAt": "2014-08-21T11:20:34Z",
"updatedBy": {
"login": "[email protected]",
"id": "124",
"name": "Bob",
"_links": {
"self": "https://www.truecron.com/v1/users/124"
}
},
"last_run": {
"id": "865D765S654236457Fhjgjg",
"started_at": "2014-08-25T06:00:00Z",
"status": "succeeded",
"elapsed_msec": 7000,
"_links": {
"self": "https://api/truecron.com/v1/jobs/1/results/865D765S654236457Fhjgjg"
}
}
"next_run_at": "2014-09-01T06:00:00Z",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1"
}
},
[{
"id": "2",
"name": "My second job",
"tags": [],
"active": true,
"archived": false,
"updatedAt": "2014-08-22T11:22:00Z",
"updatedBy": {
"login": "[email protected]",
"id": "123",
"name": "Alice",
"_links": {
"self": "https://www.truecron.com/v1/users/123"
}
},
"last_run": {
"id": "5346456534535345",
"started_at": "2014-08-26T10:00:00Z",
"status": "failed",
"elapsed_msec": 3500,
"_links": {
"self": "https://api/truecron.com/v1/jobs/2/results/5346456534535345"
}
}
"next_run_at": "2014-09-01T06:00:00Z",
"_links": {
"self": "https://www.truecron.com/v1/jobs/2"
}
},
}]
# Group Tasks
*Tasks* define execution steps of *Job* objects, like copy files, execute an application, ping a host, etc.
## Task [/jobs/{job_id}/tasks/{id}]
A *Task* object has the following fields:
Name | Type |Description
-------------|--------|---
id | string | Unique ID of the Task within a Job. Generated automaticaly when a task is created. Read-only, not null.
name | string | Name of the task. Required.
active | boolean| Gets or sets wheither the task is enabled. If disabled it will be skipped during execution. Default: `true`.
position | number | Position of the task in the list of job's task. Change position to reorder the tasks. If not specified, set to MAX(position within tasks)+1.
type | string | Type of the task. See *Task Types* section for a list of supported types. Required.
settings | object | Task-type specific settings.
timeout_sec | number | Abort task execution if it takes more than the value specified. Valid range: 1 to 86400 (one day). Default: 1800 (30 minutes).
updatedAt | string | Modification timestamp (UTC). Read-only. Updated automatically when an object is modified.
updatedBy | [User][]| The last user updated the job. Read-only. Set automatically when an object is modified.
_links | links | Links to self and a parent job. Read-only.
+ Model (application/json)
+ Body
{
"id": "1",
"name": "Ping mycompany.com",
"active": true,
"position": 1,
"type": "network_ping",
"settings": {
"target": "mycompany.com",
"connection": null,
"count": 5,
"ttl": null,
"timeout": null,
"size": null
},
"timeout_sec": "10",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1/tasks/1",
"job": "https://www.truecron.com/v1/jobs/1"
}
}
+ Parameters
+ job_id (required, string) ... ID of the *Job* object the task is a member of.
+ id (required, string) ... ID of the *Task* object.
### Retrieve a Task [GET]
+ Response 200
[Task][]
### Modify a Task [PUT]
+ Request
{
"position": 1
}
+ Response 200
[Task][]
### Replace a Task [PUT]
+ Request
{
"name": "Ping mycompany.com",
"active": true,
"position": 1,
"type": "network_ping",
"settings": {
"target": "mycompany.com",
"connection": null,
"count": 5,
"ttl": null,
"timeout": null,
"size": null
},
"timeout_sec": "10",
}
}
+ Response 200
[Task][]
### Remove a Task [DELETE]
+ Response 204
## Tasks Collection [/jobs/{job_id}/tasks]
+ Parameters
+ job_id (required, string) ... ID of a *Job*.
### List of Tasks [GET]
+ Response 200
[{
"id": "1",
"name": "Ping mycompany.com",
"active": true,
"position": 1,
"type": "network_ping",
"settings": {
"target": "mycompany.com",
"connection": null,
"count": 5,
"ttl": null,
"timeout": null,
"size": null
},
"timeout_sec": "10",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1/tasks/1",
"job": "https://www.truecron.com/v1/jobs/1"
}
},
{
"id": "2",
"name": "Copy files to FTP",
"active": true,
"position": 2,
"type": "ftp_copy",
"settings": {
"source-connection": {
"id": "999",
"name": "Local",
"_links": {
"self": "https://www.truecron.com/v1/connections/999"
}
},
"target_connection": {
"id": "888",
"name": "MyCompany sFTP",
"_links": {
"self": "https://www.truecron.com/v1/connections/888"
}
},
"source_directory": "D:\data\export",
"target_directory": "",
"file-mask": "*.csv",
"overwrite": false
},
"timeout_sec": "600",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1/tasks/2",
"job": "https://www.truecron.com/v1/jobs/1"
}
}]
### Create a Task [POST]
Only `name` and `type` are required to create a new task. If `position` is not specified,
the task will be added to the end of the task lisk.
+ Request (application/json)
{
"name": "Ping mycompany.com",
"active": true,
"position": 1,
"type": "network_ping",
"settings": {
"target": "mycompany.com",
"connection": null,
"count": 5,
"ttl": null,
"timeout": null,
"size": null
},
"timeout_sec": "10",
}
}
+ Response 201 (application/json)
[Task][]
# Group Result
Job execution results.
## Result [/jobs/{job_id}/results/{id}]
Information about execution of the job.
Name | Type |Description
-------------|--------|-------
id | string | Execution ID.
started_at | string | A timestamp (UTC) when a job was started.
status | string | Status of execution: `succeeded`, `failed`, `in-progress`.
elapsed_msec | number | Duration of job execution in milliseconds.
message | string | Error message. Nullable.
tasks | TaskResult | An array of task execution results
_links | links | Provides links to self, the job.
+ Parameters
+ id (string) ... ID of the *Result* object.
+ Model (application/json)
+ Body
{
"id": "10",
"started_at": "2015-0101T00:00:00Z",
"status": "failed",
"elapsed_msec": 7500,
"message": "Task 'Copy files to FTP' failed",
"tasks": [
{
"id": "1",
"name": "Execute SQL",
"type": "sql_execute",
"elapsed_msec": 7000,
"status": "succeeded",
"message": "",
"log_id": "84576656576235gdghasfd653",
"_links": {
"log": "https://api.truecron/v1/logs/84576656576235gdghasfd653"
}
},
{
"id": "2",
"name": "Copy files to FTP",
"type": "ftp_copy",
"elapsed_msec": 500,
"status": "failed",
"message": "Cannot connect to FTP server ftp.example.com. Unknown host.",
"log_id": "22232335555555544",
"_links": {
"log": "https://api.truecron/v1/logs/22232335555555544"
}
}
]
"_links": {
"self": "https://www.truecron.com/v1/jobs/1/results/10"
}
}
### Retrieve a Result [GET]
+ Parameters
+ job_id (string) ... ID of the *Job* object.
+ id (string) ... ID of the *Result* object.
+ Response 200
[Result][]
## Result Collection [/jobs/{job_id}/results{?offset,limit,q,sort,direction}]
+ Parameters
+ job_id (required, string) ... ID of the *Job*.
+ offset = `0` (optional, number) ... Number of resources to skip.
+ limit = `30` (optional, number) ... Page size.
+ q (optional, string, `FTP`) ... Search query.
+ sort = `started_at` (optional, string, `updatedAt`) ... A field name to sort by.
+ direction = `desc` (optional, string) ... Sort direction: `asc` or `desc`.
### Get recent results of the job [GET]
+ Response 200
+ Headers
Link: <https://www.truecron.com/v1/jobs/1/results?page=2>; rel="next",
<https://www.truecron.com/v1/jobs/1/results?page=10>; rel="last"
+ Body
[
{
"id": "10",
"started_at": "2015-01-01T00:00:00Z",
"status": "failed",
"elapsed_msec": 7500,
"message": "Task 'Copy files to FTP' failed",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1/results/10"
}
},
{
"id": "9",
"started_at": "2014-12-31T00:00:00Z",
"status": "succeeded",
"elapsed_msec": 10000,
"message": "",
"_links": {
"self": "https://www.truecron.com/v1/jobs/1/results/9"
}
}
]
# Group History
An audit journal of changes of resources or resource collections.
The journal is populated automatically when a user creates, modifies or deletes a resource:
a job, a task, an organizaion, etc.
You can get an audit journal of the specific object or a collection by adding `/history` to the URL.
A record has the following fields:
Name | Type |Description
-------------|---------|---
id | string | Change ID.
createdAt | string | Change timestamp (UTC).
createdBy | [User][]| A user who made the change.
resourceUrl | string | An URL of the changed resource.
operation | string | A string representing the operation performed (`updated`, `email-added`, etc).
change | string | JSON object with changed attributes.
oldValue | string | Old value of the resource in JSON format.
## History Collection [/{+path}/history{?offset,limit,q,sort,direction}]
+ Parameters
+ path (required, string) ... Path of the resource or resource collection to get history for.
+ offset = `0` (optional, number) ... Resources to skip.
+ limit = `30` (optional, number) ... Page size.
+ q (optional, string, `American`) ... Search query.
+ sort = `at` (optional, string, `updatedAt`) ... A field name to sort by.
+ direction = `desc` (optional, string) ... Sort direction: `asc` or `desc`.
### List journal entries [GET]
+ Response 200
+ Body
{ "entries": [{
"entry": {
"id": "923",
"createdAt": "2015-01-01T00:10:00Z",
"resourceUrl": "/jobs/1",
"createdBy": {
"id": "123",
"name": "Alice",
"_links": {
"self": "/users/123"
}
},
"operation": "updated",
"change": { "count": 5 },
"oldValue": {},
"_links": {
"self": "/history/923"
}
}
},
{
"entry": {
"id": "922",
"createdAt": "2015-01-01T00:00:00Z",
"resourceUrl": "/jobs/1",
"createdBy": {
"id": "123",
"name": "Alice",
"_links": {
"self": "/users/123"
}
},
"operation": "created-task",
"change": { "task": { "name": "task1" },
"_links": {
"self": "https://www.truecron.com/v1/history/922"
}
}
}]
}
# Group User
A *User* has the following fields:
Name | Type |Description
-------------|--------|---
id | string | Unique ID of the user. Generated automaticaly when an instance is created. Read-only, not null.
name | string | User name.
password | string | User password. Write-only.
passwordHash | string | Hash of the password.
avatar_url | string | Absolute URL to user's avatar.
extensionData| object | Google authentication data.
createdAt | string | Creation timestamp (UTC). Read-only.
updatedAt | string | Modification timestamp (UTC). Read-only. Updated automatically when the object is modified.
updatedBy | [User][]| The last user updated the object. Read-only. Set automatically when the object is modified.
_links | links | Links to self, collections of organizations, and history.
## User [/v1/users/{user_id}]
+ Parameters
+ user_id (string) ... ID of the *User* object or an email address.
+ Model (application/json)
+ Body
{
"user":
{
"id": "1",
"name": "Alice",
"passwordHash": "sdgjdslgkdjfglkdfjgdslfgjsdlgkdsfjgldfjg",
"avatar_url": "https://static.truecron.com/i/ASjdwfh3.png",
"createdAt": "2014-08-21T10:00:11Z",
"updatedAt": "2014-08-21T11:20:34Z",
"updatedBy": {
"id": "124",
"name": "Bob",
"_links": {
"self": "/users/124"
}
},
"_links": {
"self": "/users/1",
"organizations": "/users/1/organizations",
"history": "/users/1/history",
"emails": "/users/1/emails"
}
}
}
### Retrieve an user by ID [GET]
+ Response 200
[User][]
### Update the user [PUT]
+ Request (application/json)
{
"name": "Alice",
"password": "P@ssw0rd"
}
+ Response 200
[User][]
### Delete the user [DELETE]
+ Response 204
## Current authenticated user [/v1/user]
The `/v1/user` URL is used to get or update current authenticated user.
### Retrieve the authenticated user [GET]
+ Response 200
[User][]
### Update the authenticated user [PUT]
+ Request (application/json)
{
"name": "Alice"
}
+ Response 200
[User][]
## Users Collection [/v1/users{?offset,limit,q,sort,direction}]
### Create a new user [POST]
`name` and `password` are required parameters.
+ Request (application/json)
{
"name": "Alice",
"password": "P@ssw0rd"
}
+ Response 201
[User][]
### List all users visible to the authenticated user [GET]
+ Parameters
+ offset = `0` (optional, number) ... Number of resources to skip.
+ limit = `30` (optional, number) ... Page size.
+ q (optional, string, `American`) ... Search query.
+ sort = `login` (optional, string, `updatedAt`) ... A field name to sort by.
+ direction = `asc` (optional, string) ... Sort direction: `asc` or `desc`.
+ Response 200
{
"users":
[
{
"user" : {
"id": "1",
"name": "Alice",
"avatar_url": "https://static.truecron.com/i/ASjdwfh3.png",
"extensionData": {},
"createdAt": "2014-08-21T10:00:11Z",
"updatedAt": "2014-08-21T11:20:34Z",
"updatedBy": {
"id": "124",
"name": "Bob",
"_links": {
"self": "https://www.truecron.com/v1/users/124"
}
},
"_links": {
"self": "https://www.truecron.com/v1/users/1",
"organizations": "https://www.truecron.com/v1/users/1/organizations",
"history": "https://www.truecron.com/v1/users/1/history",
"emails": "https://www.truecron.com/v1/users/1/emails"
}
}
}
],
"meta": {
"total": 1
}
}
# Group Organization
An *Organization* has the following fields:
Name | Type |Description
-------------|--------|---
id | string | Unique ID of the Job. Generated automaticaly when an instance is created. Read-only, not null.
name | string | Organization name. Cannot be empty.
email | string | Organization email.
active_jobs | number | Number of jobs (not archived) in all workspaces.
total_jobs | number | Number of jobs in all workspaces.
total_workspaces|number| Number of workspaces.
total_connections|number| Number of connections to external systems.
plan | object | Current subscription plan.
createdAt | string | Creation timestamp (UTC). Read-only.
owner | [User][]| An owner of the organization. Initially set to the creator user.
updatedAt | string | Modification timestamp (UTC). Read-only. Updated automatically when the object is modified.
updatedBy | [User][]| The last user updated the object. Read-only. Set automatically when the object is modified.
_links | links | Links to self, collections of workspaces, members, collections, and history.
TODO: Add a currect plan information.
## Organization [/v1/organizations/{org_id}]
+ Parameters
+ org_id (string) ... ID of the *Organization* object.
+ Model (application/json)
+ Body
{
"id": "1",
"name": "My Company",
"email": "[email protected]",
"active_jobs": 5,
"total_jobs": 6,
"total_workspaces": 2,
"total_connections": 1,
"plan": "todo",
"createdAt": "2014-08-21T10:00:11Z",
"owner": {
"login": "[email protected]",
"id": "123",
"name": "Alice",
"avatar_url": "https://static.truecron.com/i/ASjdwfh3.png",
"_links": {
"self": "https://www.truecron.com/v1/users/123"
}
},
"updatedAt": "2014-08-21T11:20:34Z",
"updatedBy": {
"login": "[email protected]",
"id": "124",
"name": "Bob",
"_links": {
"self": "https://www.truecron.com/v1/users/124"
}
},
"_links": {
"self": "https://www.truecron.com/v1/organizations/1",
"members": "https://www.truecron.com/v1/organizations/1/members",
"workspaces": "https://www.truecron.com/v1/organizations/1/workspaces",
"connections": "https://www.truecron.com/v1/organizations/1/connections",
"history": "https://www.truecron.com/v1/organizations/1/history",
}
}
### Retrieve an organization by ID [GET]
+ Response 200
[Organization][]
### Update the organization [PUT]
+ Request (application/json)
{
"email": "[email protected]"
}
+ Response 200
[Organization][]
### Remove the organization [DELETE]
+ Response 204
## Organizations Collection [/v1/organizations{?offset,limit,q,sort,direction}]
### Create a new organization [POST]
`name` is a required parameter.
+ Request (application/json)
{
"name": "My Company",
"email": "[email protected]",
}
+ Response 201 (application/json)
[Organization][]
### List all organizations authenticated user is a member of [GET]
+ Parameters
+ offset = `0` (optional, number) ... Number of resources to skip.
+ limit = `30` (optional, number) ... Page size.
+ q (optional, string, `American`) ... Search query.
+ sort = `at` (optional, string, `updatedAt`) ... A field name to sort by.
+ direction = `desc` (optional, string) ... Sort direction: `asc` or `desc`.
+ Response 200
[
{
"id": "1",
"name": "My Company",
"email": "[email protected]",
"active_jobs": 5,
"total_jobs": 6,
"total_workspaces": 2,
"plan": "todo",
"createdAt": "2014-08-21T10:00:11Z",
"owner": {
"login": "[email protected]",
"id": "123",
"name": "Alice",
"avatar_url": "https://static.truecron.com/i/ASjdwfh3.png",
"_links": {
"self": "https://www.truecron.com/v1/users/123"
}
},
"updatedAt": "2014-08-21T11:20:34Z",
"updatedBy": {
"login": "[email protected]",
"id": "124",
"name": "Bob",
"_links": {
"self": "https://www.truecron.com/v1/users/124"
}
},
"_links": {
"self": "https://www.truecron.com/v1/organizations/1",
"members": "https://www.truecron.com/v1/organizations/1/members",
"workspaces": "https://www.truecron.com/v1/organizations/1/workspaces",