forked from samesystem/api_docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
samesystem.apib
1366 lines (1073 loc) · 49 KB
/
samesystem.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://in.samesystem.com/api/v1
# SameSystem API v1 (test)
Welcome to SameSystem public API documentation.
In case of any questions, please feel free to contact <[email protected]>
### Important notes
* All *communications* are available through JSON, so please pass the correct content-type header or append .json to each URL to API call.
* All *numbers* are passed and returned in floating point number format "%g", for example 123.12. Localized number formatting is not allowed!
* All *dates* are passed and returned in international date format: YYYY-MM-DD, for example 2013-12-01.
* In request URL always reference correct *ctx_token* where needed.
### What is {ctx_token} and how to use it
* Context token is a "c\d+d\d+" formatted string, that refers which department information you're trying to reach. Example: c1d10.
* Your context token is not available via API for security reasons, please copy-paste it from SameSystem. It is in URL address when you're logged in, right after domain, for example "https://in.samesystem.com/c1d10/..."
### Request status
* Each time request is made, API always respons with exact content or `status` node. If `status` contents equals to `fail`, then `description` node is specified also.
### Permissions
* If API call is made where current user doesn't have access in Samesystem, request will fail with HTTP status of 401 (not allowed), and `status` of "unauthorized"
### Database version on test server
* **2015-10-19**
# Group Authorization and authentication
To use SameSystem API, please create a new user using SameSystem's web interface and check "For API usage". Grant all necessary permissions for this particular user to accomplish
given tasks, because API permissions works exactly the same as permissions in web based SameSystem.
## Login [/login]
Login to get token for API authentication. Received token should be encoded to HTTP_AUTHORIZATION header as token for all further API requests.
**Token is valid for 10 minutes.** After this amount of time, please re-login to gain new token.
### Login to the system [POST]
+ Request
+ Headers
Content-Type: 'application/json'
+ Body
{
"email": "[email protected]",
"password": "apitestingpwd"
}
+ Response 201 (application/json)
{
"status": "ok",
"token": "7NV1ycL2DxSXjH9OEvRlxg"
}
## Logout [/logout]
Logout to invalidate your token. This action must be called after all calls to API has been finished (and you consider your security as seriously as we do).
### Logout [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{}
+ Response 200 (application/json)
{
"status": "ok"
}
# Group Departments
Group of all department-related resources.
## List departments [/departments]
Perform a GET request to get full list of available departments for your account with corresponding `ctx_token`. Please keep in mind, that for the same department `ctx_token` never changes, however, name can be changed by your administrator.
### Get list of departments [GET]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"departments": [
{ "name": "Shoes", "ctx_token": "c1205d5258", "dpt_no": "1" },
{ "name": "T-Shirts", "ctx_token": "c1205d6595", "dpt_no": null }
]
}
## Create department [/departments/create]
Create a department on SameSystem. You can send the attributes that are exposed here in the example below. Choose appropriate programing language from menu "Show code sample" to see details.
'name' and 'email' nodes are must be set. For manager email use 'manager_email' node. If you don't provide manager's email, then manager's email will be set for the user which is used for this API call.
### Create a new department [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"name": "Your Shop",
"email": "[email protected]",
"manager_email": "[email protected]",
"phone": "0123345667",
"dpt_nr": "324",
"abbr": "department abbriviation",
"salary_dpt_nr": "12",
"salary_dpt_nr2": "13",
"address": "Same Str. 1",
"fax": "0033389993",
"postal_code": "2344",
"city": "City",
"inactive": "false",
"non_lendable": "false"
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "Department has been successfully created",
"department_id": 100
}
## Update department [/departments/update/{department_id}]
Update a department on SameSystem. You can send the same attributes as described in create department API call except that nodes are free of choice.
For manager's email use 'manager_email' node.
+ Parameters
+ department_id (required, number) - ID of the department
### Update a department [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"name": "Your updated Shop",
"email": "[email protected]",
"manager_email": "[email protected]",
"phone": "0123345667",
"dpt_nr": "324",
"abbr": "department abbriviation",
"salary_dpt_nr": "12",
"salary_dpt_nr2": "13",
"address": "Same Str. 1",
"fax": "0033389993",
"postal_code": "2344",
"city": "City",
"inactive": "false",
"non_lendable": "false"
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "Shop #11 has been successfully updated"
}
# Group Weekly balance
Weekly balance is used for daily accounting. Multiple cash registers can be used in shop, in this case "register_count" variable returns count of cash registers in the department.
## List fields [/{ctx_token}/weekly_balance/fields]
Get all weekly balance fields. Field ids must be referenced on saving request.
Explanations for some attributes:
| Attribute | Explanation |
|-----------|-------------|
| field_type | `number/text/expense/deposit` - number, expense and deposit type of field a is *Float*, text is a *String*. Expense and deposit are special kind of fields which must be detailed with exact entries when saving. |
| summable | If `false`, numbers mathematically cannot be summed up for total. |
| calculated | If `true`, this field is calculated from other fields, therefore there's no need to submit this with `save` request. |
| mandatory | If `true`, this field must be present before confirming the day. The only exception is when all fields are empty in given date (closed day situation). |
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
### List all fields [GET]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"fields": [
{ "field_id": 1, "name": "Sales", "field_type": "number", "summable": true,
"code": "A1", "calculated": false, "mandatory": true },
{ "field_id": 2, "name": "Sales (without VAT)", "field_type": "number", "summable": true,
"code": "A1.1", "calculated": true, "mandatory": false },
{ "field_id": 3, "name": "Returned items", "field_type": "number", "summable": true,
"code": "A2", "calculated": false, "mandatory": false },
{ "field_id": 4, "name": "Bank person", "field_type": "text", "summable": false,
"code": "A3", "calculated": false, "mandatory": true },
{ "field_id": 5, "name": "Expenses", "field_type": "expense", "summable": true,
"code": "B1", "calculated": false, "mandatory": false },
{ "field_id": 6, "name": "Transfered to bank", "field_type": "number", "summable": true,
"code": null, "calculated": false, "mandatory": true },
{ "field_id": 7, "name": "Difference", "field_type": "number", "summable": true,
"code": null, "calculated": true, "mandatory": false }
],
"expense_groups": [
{ "group_id": 1, "name": "Local expenses" },
{ "group_id": 2, "name": "Outsource" }
],
"deposit_groups": []
}
## Getting numbers [/{ctx_token}/weekly_balance/{date}]
Get all numbers, comments and confirmation information for the specified week. **Register count can be different for each week**.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ date (required, string) - For details refer to the section "Important notes"
### Get all weekly balance numbers [GET]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"register_count": 2,
"registers": [
{ "register_number": 1,
"week_approved": false,
"unavailable_fields": [],
"confirmed": {
"2013-07-01": { "datetime": "2013-07-01 21:00:00", "user": "Adriana Laursen" },
"2013-07-02": { "datetime": "2013-07-02 20:30:00", "user": "Adriana Laursen" }
},
"comments": {
"2013-07-01": "All good, sir",
"2013-07-02": "All good, sir"
},
"lines": {
"2013-07-01": [
{ "field_id": 1, "value": 10000.0 },
{ "field_id": 2, "value": 8000.0 },
{ "field_id": 3, "value": 3 },
{ "field_id": 5, "value": 200.0 },
{ "field_id": 6, "value": 10002.0 },
{ "field_id": 7, "value": -2.0 },
{ "field_id": 4, "value": "Adriana" }
],
"2013-07-02": [
{ "field_id": 1, "value": 12000.0 },
{ "field_id": 2, "value": 9600.0 },
{ "field_id": 3, "value": 1 },
{ "field_id": 5, "value": 0.0 },
{ "field_id": 6, "value": 11990.0 },
{ "field_id": 7, "value": 10.0 },
{ "field_id": 4, "value": "Adriana" }
]
},
"expenses": {
"2013-07-01": [
{ "group_id": 1, "title": "Printing paper", "value": 150.0 },
{ "group_id": 2, "title": "Fuel", "value": 50.0 }
]
},
"deposits": {}
},
{ "register_number": 2,
"week_approved": false,
"unavailable_fields": [3],
"confirmed": {
"2013-07-01": { "datetime": "2013-07-01 21:01:00", "user": "Adriana Laursen" },
"2013-07-02": { "datetime": "2013-07-02 20:31:00", "user": "Adriana Laursen" }
},
"comments": {
"2013-07-01": "All good, sir",
"2013-07-02": "All good"
},
"lines": {
"2013-07-01": [
{ "field_id": 1, "value": 1000.0 },
{ "field_id": 2, "value": 800.0 },
{ "field_id": 5, "value": 0.0 },
{ "field_id": 6, "value": 1000.5 },
{ "field_id": 7, "value": -0.5 },
{ "field_id": 4, "value": "Adriana" }
],
"2013-07-02": [
{ "field_id": 1, "value": 1200.0 },
{ "field_id": 2, "value": 960.0 },
{ "field_id": 5, "value": 0.0 },
{ "field_id": 6, "value": 1199.0 },
{ "field_id": 7, "value": 1.0 },
{ "field_id": 4, "value": "John" }
]
},
"expenses": {},
"deposits": {}
}
]
}
## Saving Numbers [/{ctx_token}/weekly_balance/save/{date}/{register_number}]
Save daily numbers. Expenses/deposits must be referenced with correct groups. **Please note that you must confirm the day for ALL REGISTERS after saving all numbers**, otherwise these numbers won't be used for any other calculations in the system! Please check the next action how to do it.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ date (required, string) - For details refer to the section "Important notes"
+ register_number (required, number) - Number of the register; for details ask your administrator
### Save daily Numbers [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{ "comments": "No issues today",
"lines": [
{ "field_id": 1, "value": 100.0 },
{ "field_id": 2, "value": 80.0 },
{ "field_id": 3, "value": 1 },
{ "field_id": 5, "value": 20.0 },
{ "field_id": 6, "value": 99.9 },
{ "field_id": 7, "value": 0.1 },
{ "field_id": 4, "value": "Josh" }
],
"expenses": [
{ "group_id": 1, "title": "Towels", "value": 2.0 },
{ "group_id": 2, "title": "Tickets", "value": 18.0 }
],
"deposits": []
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "Weekly balance numbers for 2013-07-03 register #1 has been saved."
}
## Confirming Numbers [/{ctx_token}/weekly_balance/confirm/{date}/{register_number}]
Confirm daily numbers. Confirming for specified date might fail if:
* mandatory field is not present
* comment must be filled in on balance overrun, overrun is detected but no comment is present
In both cases, exact fail reason will be specified in `description` node and HTTP status will be `412 (precondition failed)`.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ date (required, string) - For details refer to the section "Important notes"
+ register_number (required, number) - Number of the register; for details ask your administrator
### Confirm daily Numbers [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"status": "ok",
}
## Unconfirming day [/{ctx_token}/weekly_balance/unconfirm/{date}/{register_number}]
Unconfirm the day in weekly balance. You need to do this if you need to correct numbers for already confirmed day. Please note that a separate permission for unapproving the day is necessary.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ date (required, string) - For details refer to the section "Important notes"
+ register_number (required, number) - Number of the register; for details ask your administrator
### Unconfirm the day in weekly balance [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"status": "ok",
}
## Approving week [/{ctx_token}/weekly_balance/approve_week/{date}/{register_number}]
Approve whole weekly balance report. Confirming for specified week might fail if some days in this week are not confirmed. Exact fail reason will be specified in `description` node.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ date (required, string) - For details refer to the section "Important notes"
+ register_number (required, number) - Number of the register; for details ask your administrator
### Approve weekly balance [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"status": "ok",
}
## Unapproving week [/{ctx_token}/weekly_balance/unapprove_week/{date}/{register_number}]
Unapprove whole weekly balance report. Please note that this action requires additional permissions to do that.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ date (required, string) - For details refer to the section "Important notes"
+ register_number (required, number) - Number of the register; for details ask your administrator
### Unapprove weekly balance [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"status": "ok",
}
# Group Personal Turnover
Turonver is used for meassurement of performance on the employees.
In order to find a user on SameSystem, one of the attributes must be sent with each request:
| Attribute | Type | Explanation |
|-----------|-------------|-------------|
| user_id | number | User's Id on SameSystem
| salesman_number | string | If client has enabled option to have salesman_numbers for users
In order to find a department on SameSystem, one of the attributes must be sent with each request:
| Attribute | Type |Explanation |
|-----------|-------------|-------------|
| shop_id | number | Department's Id on SameSystem
| shop_name | string | Department's name on SameSystem
| dpt_no | string | Department's number (`Dpt. no.`) on SameSystem
## Create Turnover record [/{ctx_token}/turnover/create]
Successful responses are sent without body, only with HTTP Status code 201.
If errors occur, responses are sent as json with 'errors' node in response payload.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
### Create turnover record request [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"user_id": 1,
"dpt_no": "11",
"date": "2016-09-01",
"amount": 100.01
}
+ Response 201 (application/json)
## Update Turnover record [/{ctx_token}/turnover/update]
Successful responses are sent without body, only with HTTP Status code 200.
If errors occur, responses are sent as json with 'errors' node in response payload.
If you want to sum up amount, then you can send 'add_to_existing' node:
| Attribute | Type |Explanation |
|-----------|-------------|-------------|
| add_to_existing | boolean | `true` as a value, if addition for existing record is needed. `amount` with negative values will be deducted in this case.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
### Update turnover record request [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"user_id": 1,
"dpt_no": "11",
"date": "2016-09-01",
"add_to_existing": true,
"amount": 100.01
}
+ Response 200 (application/json)
## Delete Turnover record [/{ctx_token}/turnover/delete]
Successful responses are sent without body, only with HTTP Status code 200.
If errors occur, responses are sent as json with 'errors' node in response payload.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
### Delete turnover record request [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"user_id": 1,
"dpt_no": "11",
"date": "2016-09-01"
}
+ Response 200 (application/json)
# Group Budgets
You can get daily, monthly sales or salary budgets that are already saved on SameSystem. Saving is possible for monthly sales and monthly salary budgets **ONLY**.
## Daily sales budgets [/{ctx_token}/budget/daily/{year}/{month}]
### Get daily sales budgets [GET]
Get daily turnover (sales) budgets. Returns numbers for whole month.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ month (required, number) - Format MM - two-digit month
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"daily_budgets": [
{ "date": "2013-08-01", "amount": 18000.0 },
{ "date": "2013-08-02", "amount": 17000.50 },
{ "date": "2013-08-03", "amount": 17000.50 },
{ "date": "2013-08-04", "amount": 17000.50 },
{ "date": "2013-08-05", "amount": 17000.50 },
{ "date": "2013-08-06", "amount": 17000.50 },
{ "date": "2013-08-07", "amount": 17000.50 },
{ "date": "2013-08-08", "amount": 17000.50 },
{ "date": "2013-08-09", "amount": 17000.50 },
{ "date": "2013-08-10", "amount": 17000.50 },
{ "date": "2013-08-11", "amount": 17000.50 },
{ "date": "2013-08-12", "amount": 17000.50 },
{ "date": "2013-08-13", "amount": 17000.50 },
{ "date": "2013-08-14", "amount": 17000.50 },
{ "date": "2013-08-15", "amount": 17000.50 },
{ "date": "2013-08-16", "amount": 17000.50 },
{ "date": "2013-08-17", "amount": 17000.50 },
{ "date": "2013-08-18", "amount": 17000.50 },
{ "date": "2013-08-19", "amount": 17000.50 },
{ "date": "2013-08-20", "amount": 17000.50 },
{ "date": "2013-08-21", "amount": 17000.50 },
{ "date": "2013-08-22", "amount": 17000.50 },
{ "date": "2013-08-23", "amount": 17000.50 },
{ "date": "2013-08-24", "amount": 17000.50 },
{ "date": "2013-08-25", "amount": 17000.50 },
{ "date": "2013-08-26", "amount": 17000.50 },
{ "date": "2013-08-27", "amount": 17000.50 },
{ "date": "2013-08-28", "amount": 17000.50 },
{ "date": "2013-08-29", "amount": 17000.50 },
{ "date": "2013-08-30", "amount": 17000.50 },
{ "date": "2013-08-31", "amount": 17000.50 }
]
}
### Save daily sales budgets [POST]
Save daily turnover (sales) budgets. JSON structure to post is exactly the same as you get from the system via *GET* request.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ month (required, number) - Format MM - two-digit month
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"daily_budgets": [
{ "date": "2013-08-01", "amount": 18000.0 },
{ "date": "2013-08-02", "amount": 17000.50 },
{ "date": "2013-08-03", "amount": 17000.50 },
{ "date": "2013-08-04", "amount": 17000.50 },
{ "date": "2013-08-05", "amount": 17000.50 },
{ "date": "2013-08-06", "amount": 17000.50 },
{ "date": "2013-08-07", "amount": 17000.50 },
{ "date": "2013-08-08", "amount": 17000.50 },
{ "date": "2013-08-09", "amount": 17000.50 },
{ "date": "2013-08-10", "amount": 17000.50 },
{ "date": "2013-08-11", "amount": 17000.50 },
{ "date": "2013-08-12", "amount": 17000.50 },
{ "date": "2013-08-13", "amount": 17000.50 },
{ "date": "2013-08-14", "amount": 17000.50 },
{ "date": "2013-08-15", "amount": 17000.50 },
{ "date": "2013-08-16", "amount": 17000.50 },
{ "date": "2013-08-17", "amount": 17000.50 },
{ "date": "2013-08-18", "amount": 17000.50 },
{ "date": "2013-08-19", "amount": 17000.50 },
{ "date": "2013-08-20", "amount": 17000.50 },
{ "date": "2013-08-21", "amount": 17000.50 },
{ "date": "2013-08-22", "amount": 17000.50 },
{ "date": "2013-08-23", "amount": 17000.50 },
{ "date": "2013-08-24", "amount": 17000.50 },
{ "date": "2013-08-25", "amount": 17000.50 },
{ "date": "2013-08-26", "amount": 17000.50 },
{ "date": "2013-08-27", "amount": 17000.50 },
{ "date": "2013-08-28", "amount": 17000.50 },
{ "date": "2013-08-29", "amount": 17000.50 },
{ "date": "2013-08-30", "amount": 17000.50 },
{ "date": "2013-08-31", "amount": 17000.50 }
]
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "Daily turnover budgets have been saved."
}
## Monthly sales budgets [/{ctx_token}/budget/monthly/{year}]
### Get monthly sales budgets [GET]
Get monthly sales budget numbers. Returns numbers for whole financial year.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"monthly_budgets": [
{"year": 2013, "month": 8, "amount": 558489.0},
{"year": 2013, "month": 9, "amount": 558490.0},
{"year": 2013, "month": 10, "amount": 558491.0},
{"year": 2013, "month": 11, "amount": 558492.0},
{"year": 2013, "month": 12, "amount": 558493.0},
{"year": 2014, "month": 1, "amount": 558494.0},
{"year": 2014, "month": 2, "amount": 558495.0},
{"year": 2014, "month": 3, "amount": 558496.0},
{"year": 2014, "month": 4, "amount": 558497.0},
{"year": 2014, "month": 5, "amount": 558498.0},
{"year": 2014, "month": 6, "amount": 558499.0},
{"year": 2014, "month": 7, "amount": 558500.0}
]
}
### Save monthly sales budgets [POST]
Save monthly sales budgets. JSON structure is exactly the same as you get from the system via *GET* request.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"monthly_budgets" : [
{"year": 2013, "month": 8, "amount": 958489.0},
{"year": 2013, "month": 9, "amount": 958490.0},
{"year": 2013, "month": 10, "amount": 958491.0},
{"year": 2013, "month": 11, "amount": 958492.0},
{"year": 2013, "month": 12, "amount": 958493.97},
{"year": 2014, "month": 1, "amount": 958494.0},
{"year": 2014, "month": 2, "amount": 958495.0},
{"year": 2014, "month": 3, "amount": 958496.0},
{"year": 2014, "month": 4, "amount": 958497.0},
{"year": 2014, "month": 5, "amount": 958498.0},
{"year": 2014, "month": 6, "amount": 958499.0},
{"year": 2014, "month": 7, "amount": 958500.0}
]
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "Monthly turnover budgets have been saved."
}
## Getting daily salary [/{ctx_token}/salary_budget/daily/{year}/{month}]
Get daily salary budgets. Returns numbers for whole month.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ month (required, number) - Format MM - two-digit month
### Get daily salary budgets [GET]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"daily_salary_budgets": [
{ "date": "2013-08-01", "amount": 2000.0 },
{ "date": "2013-08-02", "amount": 3000.0 },
{ "and so on for whole calendar month" }
]
}
## Monthly salary budgets [/{ctx_token}/salary_budget/monthly/{year}]
### Get monthly salary budgets [GET]
Get monthly salary budget numbers. Returns numbers for whole financial year.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"monthly_salary_budgets": [
{"year": 2013, "month": 8, "amount": 60000.0},
{"year": 2013, "month": 9, "amount": 60000.0},
{"year": 2013, "month": 10, "amount": 60000.0},
{"year": 2013, "month": 11, "amount": 60000.0},
{"year": 2013, "month": 12, "amount": 60000.0},
{"year": 2014, "month": 1, "amount": 60000.0},
{"year": 2014, "month": 2, "amount": 60000.0},
{"year": 2014, "month": 3, "amount": 60000.0},
{"year": 2014, "month": 4, "amount": 60000.0},
{"year": 2014, "month": 5, "amount": 60000.0},
{"year": 2014, "month": 6, "amount": 60000.0},
{"year": 2014, "month": 7, "amount": 60000.0}
]
}
### Save monthly salary budgets [POST]
Save monthly salary budgets. JSON structure is exactly the same as you get from the system via *GET* request.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ year (required, number) - Format YYYY - four-digit year
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"monthly_salary_budgets" : [
{"year": 2013, "month": 8, "amount": 3008.0},
{"year": 2013, "month": 9, "amount": 3000.0},
{"year": 2013, "month": 10, "amount": 3010.0},
{"year": 2013, "month": 11, "amount": 3000.0},
{"year": 2013, "month": 12, "amount": 3012.0},
{"year": 2014, "month": 1, "amount": 4001.0},
{"year": 2014, "month": 2, "amount": 3000.0},
{"year": 2014, "month": 3, "amount": 3000.0},
{"year": 2014, "month": 4, "amount": 4004.0},
{"year": 2014, "month": 5, "amount": 3000.0},
{"year": 2014, "month": 6, "amount": 3000.0},
{"year": 2014, "month": 7, "amount": 4007.0}
]
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "Monthly salary budgets have been saved."
}
# Group Users
You can get information about user creation or update in the system. With some exceptions, it is possible to edit any information about the user via POST request. Fields are customizable via "User changes export settings" in SameSystem - only fields in "Exported columns" list will be in API response. Below is only one of the possible examples.
## Getting users [/{ctx_token}/users]
Get all current users for the in the `ctx_token` specified department.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
### Get users for department [GET]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"users": [
{
"user_id": 50236,
"wage_earner_no": "000258",
"role": "Elev",
"civil_no": "123456-1234",
"first_name": "John",
"last_name": "Doe",
"address_line1": "Oxford str. 5C",
"postal_code": "05251",
"city": "London",
"mobile": "450254826",
"email": "[email protected]",
"salary_dpt_no": "15",
"start_date": "2014-01-01",
"employee_type": "Fulltime"
},
{
"user_id": 50237,
"wage_earner_no": "000259",
"role": "Butikchef",
"civil_no": "123457-1234",
"first_name": "Adriana",
"last_name": "Laursen",
"address_line1": "Oxford str. 5D",
"postal_code": "05251",
"city": "London",
"mobile": "450254827",
"email": "[email protected]",
"salary_dpt_no": "15",
"start_date": "2014-01-01",
"employee_type": "Hourly"
}
]
}
## Showing user [/{ctx_token}/users/{user_id}]
Get exact user by SameSystem user's id.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ user_id (required, number) - ID of the user from SameSystem
### Show user's details [GET]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Response 200 (application/json)
{
"user_id": 50236,
"wage_earner_no": "000258",
"role": "Elev",
"civil_no": "123456-1234",
"first_name": "John",
"last_name": "Doe",
"address_line1": "Oxford str. 5C",
"postal_code": "05251",
"city": "London",
"mobile": "450254826",
"email": "[email protected]",
"salary_dpt_no": "15",
"start_date": "2014-01-01",
"employee_type": "Fulltime"
}
## Updating user [/{ctx_token}/users/update/{user_id}]
Update users' information on the system. Update only specified fields from the date of "change_date". If another change on that date exists, it will patch with the information specified. Specify extra fields in the same way as SameSystem returns for information retrieval above.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
+ user_id (required, number) - ID of the user from SameSystem
### Update the user [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"change_date": "2014-02-28",
"wage_earner_no": "111258",
"kon_704": "1"
}
+ Response 200 (application/json)
{
"status": "ok",
"description": "User #50236 has been sucessfully updated."
}
## Creating user [/{ctx_token}/users/create]
Create user on SameSystem. You can send the same attributes as you get in created/updated response. However, first & last name, payroll number, start date, role, civil number, shop name, hours week are mandatory to provide.
In case some requirements are failed to be fullfilled, you will get response with descriptive error message and "errors" node which explains which fields were problematic.
If user creation was successful you will receive 'password' node with new user password and 'user_id' node with created user's id from SameSystem.
+ Parameters
+ ctx_token (required, string) - For details refer to the section "What is ctx token and how to use it"
### Create user [POST]
+ Request
+ Headers
AUTHORIZATION: Token token="7NV1ycL2DxSXjH9OEvRlxg"
Content-Type: 'application/json'
+ Body
{
"role": "Fulltime",
"civil_no": "010387-2222",
"first_name": "Jonas",
"last_name": "Jonka",
"address_line1": "Kooperatyvinis butas Kalvarijų g.",
"postal_code": "LT-2000",
"city": "Vilnius",