-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenAPI.yml
4221 lines (3222 loc) · 117 KB
/
OpenAPI.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
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
openapi: 3.0.3
info:
title: APTRS
description: >-
APTRS (Automated Penetration Testing Reporting System) is a Python and
Django-based automated reporting tool designed for penetration testers and
security organizations. This tool streamlines the report generation process
by enabling users to create PDF and Excel reports directly, eliminating the
need for manual approaches. Additionally, APTRS offers a systematic way to
monitor and manage vulnerabilities within various projects. Keep your
penetration testing projects organized and efficient with APTRS.
version: 1.0.1
contact: {}
servers:
- url: https://live.aptrs.com
description: Local Hosted Server
- url: https://live.aptrs.com
description: APTRS Demo Server
paths:
/api/auth/user/1:
get:
tags:
- Account
- Admin
summary: Get User
description: Get User
operationId: getUser
responses:
'200':
description: ''
/api/auth/adduser:
post:
tags:
- Account
- Admin
summary: Add User
description: >-
### Endpoint Description: Add New User (Admin Only API)
This API endpoint allows you to add a new user to the system. It is an
HTTP POST request to the `{{domainname}}/api/auth/adduser` URL.
#### Request Method
- **Method:** POST
- **Endpoint:** `{{domainname}}/api/auth/adduser`
#### Request Parameters
``` json
{
"first_name": "user1",
"last_name": "user1",
"company": "helloworld",
"number":"+911123334567",
"is_superuser": false,
"is_active": true,
"username": "user1",
"email": "user1@anof.com",
"password": "user1"
}
```
- `username` (string): The username of the new user.
- `email` (string): The email address of the new user.
- `first_name` (string): The first name of the new user.
- `last_name` (string): The last name of the new user.
- `is_superuser` (boolean): Indicates whether the new user is a
superuser or not.
- `is_active` (boolean): Indicates whether the new user is active or
not.
- `number` (string): The contact number of the new user.
- `company` (string): The company name of the new user.
- `username` (string): The unique username of the new user.
#### Note
The API is only for Admin User
#### Example Response
The response to this request will have a status code of 200 if the user
was successfully added. The response body will include the following
parameters:
``` json
{
"id": 5,
"username": "1user1",
"email": "1user1@anof.com",
"first_name": "user1",
"last_name": "user1",
"is_superuser": false,
"is_active": true,
"profile": {
"id": 4,
"profilepic": "http://aptrsapi.souravkalal.tech/media/profile/avatar-1.svg",
"number": "+911613334567",
"company": "AnoF PVT LTD",
"user": 5
},
"message": "User object created successfully.",
"status": "true"
}
```
- `id` (integer): The ID of the newly created user.
- `username` (string): The username of the newly created user.
- `email` (string): The email address of the newly created user.
- `first_name` (string): The first name of the newly created user.
- `last_name` (string): The last name of the newly created user.
- `is_superuser` (boolean): Indicates whether the newly created user is
a superuser or not.
- `is_active` (boolean): Indicates whether the newly created user is
active or not.
- `profile` (object): An object containing additional profile
information for the newly created user.
- `id` (integer): The ID of the profile.
- `profilepic` (string): The profile picture of the newly created user.
- `number` (string): The contact number of the newly created user.
- `company` (string): The company name of the newly created user.
- `message` (string): A message indicating the status of the request.
- `status` (string): The status of the request.
Please note that the values provided in the response example are
placeholders and may not reflect the actual values returned by the API.
The response will have a status code of 400 if there are any errors in
the request. The response body will provide details about the errors,
including specific error messages for each parameter.
For example, if the `username` and `email` parameters are missing or
empty, the response will be:
``` json
{
"username": ["This field is required."],
"email": ["This field is required."]
}
```
operationId: addUser
requestBody:
content:
text/plain:
example: "{\r\n \"full_name\": \"normal user\", \r\n \"username\": \"normaluser\",\r\n \"email\": \"normaluser@anof.com\",\r\n \"is_active\":false,\r\n \"number\":\"+911622445522\",\r\n \"is_superuser\": false,\r\n \"position\":\"Security Engineer\", // text field\r\n \"password\": \"Admin@12345\",\r\n \"groups\":[\r\n \"Manangers\" // Multiple Groups can be selected\r\n ]\r\n}"
responses:
'200':
description: ''
/api/auth/edituser/73:
post:
tags:
- Account
- Admin
summary: Edit User
description: Edit User
operationId: editUser
requestBody:
content:
text/plain:
example: "{\r\n \"full_name\": \"Sourav Kalal\",\r\n \"username\": \"admin\",\r\n \"email\": \"admin@anof.com\",\r\n \"is_active\":true,\r\n \"number\":\"+911122445522\",\r\n \"is_superuser\": false,\r\n \"position\":\"Security Engineer\",\r\n \"password\": \"admin\", // Optional\r\n \"groups\":[\r\n \"User Level Group\" // Multiple Groups can be selected\r\n ]\r\n}"
responses:
'200':
description: ''
/api/auth/deleteuser:
delete:
tags:
- Account
- Admin
summary: Delete User
description: Delete User
operationId: deleteUser
requestBody:
content:
application/json:
schema:
type: array
items:
type: number
example: 73
example:
- 73
example:
- 73
responses:
'200':
description: ''
/api/auth/groups/create/:
post:
tags:
- Account
- Admin
summary: Create Permission Group
description: Create Permission Group
operationId: createPermissionGroup
requestBody:
content:
text/plain:
example: "{\r\n \"name\": \"Manager Groups\",\r\n \"description\": \"Permission for Managers\",\r\n \"list_of_permissions\": [ //multiple permissions can be selected\r\n \"Change Password\",\r\n \"Create Project\"\r\n ]\r\n}"
responses:
'200':
description: ''
/api/auth/groups/update/4/:
post:
tags:
- Account
- Admin
summary: Edit Permission Group
description: Edit Permission Group
operationId: editPermissionGroup
requestBody:
content:
application/json:
schema:
type: object
properties:
description:
type: string
example: Permission for Managers
list_of_permissions:
type: array
items:
type: string
example: Change Password
example:
- Change Password
- Create Project
name:
type: string
example: Managers
example:
description: Permission for Managers
list_of_permissions:
- Change Password
- Create Project
name: Managers
responses:
'200':
description: ''
/api/auth/groups/delete:
delete:
tags:
- Account
- Admin
summary: Delete Group
description: Delete Group
operationId: deleteGroup
requestBody:
content:
application/json:
schema:
type: array
items:
type: number
example: 10
example:
- 10
- 11
- 12
example:
- 10
- 11
- 12
responses:
'200':
description: ''
/api/auth/list/permission/:
get:
tags:
- Account
- Admin
summary: List Available Permissions
description: List Available Permissions
operationId: listAvailablePermissions
responses:
'200':
description: ''
/api/auth/groups/list/:
get:
tags:
- Account
- Admin
summary: List All Permission Group
description: List All Permission Group
operationId: listAllPermissionGroup
responses:
'200':
description: ''
/api/auth/login/:
post:
tags:
- Account
summary: Login
description: >-
### Endpoint Description: User Authentication
#### Endpoint
This API endpoint is used to authenticate a user and obtain access and
refresh tokens for further API calls. Send a POST request to
`{{domainname}}/api/auth/login/` with the required credentials.
#### Request Method
- **Method:** POST
- **Endpoint:** `{{domainname}}/api/auth/login/`
#### Request Body
``` json
{
"email": "admin@anof.com",
"password": "admin"
}
```
### Response
The response will include the following information:
``` json
{
"refresh":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcwMzg2Mzc5NSwiaWF0IjoxNzAyNTY3Nzk1LCJqdGkiOiJhOGE0Y2I5MTZjMTk0ZmUyYmY3NWUxN2I5MDQxZmQ4NSIsInVzZXJfaWQiOjd9.elLzk-U5A_xqte3V2HfrzPkExeJaUX1Xj5WdVJWb_24",
"access":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzA1MTU5Nzk1LCJpYXQiOjE3MDI1Njc3OTUsImp0aSI6IjJkYTgyMTdhODc1YjQ0M2U4NjE2ZWI2NjY3ZWY5MWMzIiwidXNlcl9pZCI6N30.C4kOCx0B4FDrVAEvHreAnv9R7nQ5gSH33FLeWpUKSsU",
"Status": "True",
"username": "admin",
"Pic": "/media/profile/avatar-1.svg",
"isAdmin": true,
"permissions": [
"Create Project",
"Delete Images",
"Add Retest for Projects",
"Change Password",
....
]
}
```
- `refresh`: A refresh token that can be used to obtain a new access
token when it expires.
- `access`: An access token that should be included in the headers of
subsequent requests to authorize the user.
- `Status`: The status of the authentication process.
- `username`: The username of the authenticated user.
- `Pic`: The profile picture of the authenticated user.
- `isAdmin`: A boolean value indicating whether the authenticated user
has admin privileges.
- permissions - List of permissions users have. Each user could have
different sets of permissions.
> _**NOTE:**_ Admin user is not restricted with permission. The admin
user is not part of the permission group and has all access irrespective
of what permissions are assigned.
operationId: login
requestBody:
content:
application/json:
schema:
type: object
properties:
email:
type: string
example: sourav.kalal@aptrs.com
password:
type: string
example: I-am-Weak-Password-Please-Change-Me
example:
email: sourav.kalal@aptrs.com
password: I-am-Weak-Password-Please-Change-Me
responses:
'200':
description: ''
/api/auth/token/refresh/:
post:
tags:
- Account
summary: Refresh Token
description: >
### Endpoint Description: User Refresh Token
#### Endpoint
This endpoint allows the user to refresh the access token. Send a POST
request to `{{domainname}}/api/auth/token/refresh/` with the required
credentials.
#### Request Method
- **Method:** POST
- **Endpoint:** `{{domainname}}/api/auth/token/refresh/`
#### Request Body
``` json
{
"refresh":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcwMzQxMjYxNCwiaWF0IjoxNzAyMTE2NjE0LCJqdGkiOiJlNzQyZDFjMTQxZWI0OGQwYjlkOTg5NzViZWE1OGM3ZCIsInVzZXJfaWQiOjF9.MKSr0X-x2m6HZoZUQ4qBhOZVPUiBoC9vP8z9c4-91zw"
}
```
### Response
The response will include the following information:
``` json
{
"access":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzA1MTYwMjgyLCJpYXQiOjE3MDIxMTY2MTQsImp0aSI6IjZjY2I4YTY1MmYzNjRkN2Q4NzIxOWVmZGE2NTdiYzUwIiwidXNlcl9pZCI6MX0.UI-4vmDQYIPs1YObzxmeXh-QgqqFSkxGkRDAAwZWbwE",
"refresh":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcwMzg2NDI4MiwiaWF0IjoxNzAyNTY4MjgyLCJqdGkiOiIyOGViZWQ2OGZlYmE0YjZmYjg5ODM5ZjVhMmFkZDczYiIsInVzZXJfaWQiOjF9.LrYKjte1KUszcEq7Bd5742BUzP3ECT7S659GEqn-uzE"
}
```
- `refresh`: An updated refresh token that can be used to obtain a new
access token when it expires.
- `access`: An updated access token that should be included in the
headers of subsequent requests to authorize the user.
operationId: refreshToken
requestBody:
content:
application/json:
schema:
type: object
properties:
refresh:
type: string
example: '{{refreshToken}}'
example:
refresh: '{{refreshToken}}'
responses:
'200':
description: ''
/api/auth/users:
get:
tags:
- Account
summary: Get All User
description: >+
### Endpoint Description: Retrieve All Users
#### Endpoint
This API endpoint allows you to retrieve a list of users from the
server. Send a POST request to `{{domainname}}/api/auth/users` with the
required credentials.
#### Request Method
- **Method:** GET
- **Endpoint:** `{{domainname}}/api/auth/users`
### Response
The response will include the following information:
``` json
[
{
"id": 1,
"username": "sourav",
"full_name": "Sourav Kalal",
"email": "admin2@anof.com",
"is_staff": true,
"is_active": true,
"is_superuser": true,
"profilepic": "/media/profile/avatar-1.svg",
"number": "+911122345522",
"company": "AnoF PVT LTD",
"position": "Security Engineer",
"groups": [
"User Permission Group",
"Manager Permission Group"
]
},
{
"id": 7,
"username": "admin",
"full_name": "Sourav Kalal",
"email": "admin@anof.com",
"is_staff": true,
"is_active": true,
"is_superuser": true,
"profilepic": "/media/profile/avatar-1.svg",
"number": "+911122445522",
"company": "AnoF PVT LTD",
"position": "Security Engineer",
"groups": [
"User Permission Group"
]
}
]
```
operationId: getAllUser
responses:
'200':
description: ''
/api/auth/users/filter:
get:
tags:
- Account
summary: Get All User Filter
description: Get All User Filter
operationId: getAllUserFilter
parameters:
- name: username
in: query
schema:
type: string
example: ''
- name: full_name
in: query
schema:
type: string
example: ''
- name: email
in: query
schema:
type: string
example: ''
- name: position
in: query
schema:
type: string
example: ''
- name: is_active
in: query
schema:
type: string
example: ''
- name: limit
in: query
schema:
type: string
example: '5'
description: upto 50
- name: offset
in: query
schema:
type: string
example: '0'
- name: sort
in: query
schema:
type: string
example: full_name
- name: order_by
in: query
schema:
type: string
example: desc
responses:
'200':
description: ''
/api/auth/myprofile:
get:
tags:
- Account
summary: Profile
description: >-
This API endpoint allows users to retrieve their own profile
information. It is an HTTP GET request to
`{{domainname}}/api/auth/myprofile`.
### Request
The request does not require any parameters or headers. This request
allows users to retrieve their own profile information.
### Response
The response will have a status code of 200 if the request is
successful. The response body will contain the following information:
``` json
{
"id": 1,
"username": "admin",
"email": "admin1@example.com",
"first_name": "Sourav",
"last_name": "Kalal",
"is_superuser": true,
"profile": {
"id": 1,
"profilepic": "/media/profile/avatar-1.svg",
"number": "+911234564674",
"company": "Example Inc.",
"user": 1
}
}
```
- `id` (integer): The unique identifier of the user.
- `username` (string): The username of the user.
- `email` (string): The email address of the user.
- `first_name` (string): The first name of the user.
- `last_name` (string): The last name of the user.
- `is_superuser` (boolean): Indicates whether the user has superuser
privileges.
- `profile` (object): An object containing additional profile
information.
- `id` (integer): The unique identifier of the profile.
- `profilepic` (string): The URL of the user's profile picture.
- `number` (string): The contact number of the user.
- `company` (string): The name of the company associated with the user.
- `user` (integer): The ID of the user associated with the profile.
Please note that the response may contain empty or default values for
some fields if the user has not provided the information.
operationId: profile
responses:
'200':
description: ''
/api/auth/editprofile:
post:
tags:
- Account
summary: Edit Profile
description: >-
### Endpoint Description: Edit User Profile
#### Endpoint
This API endpoint allows users to edit their profile information. It is
an HTTP POST request that should be sent to
`{{domainname}}/api/auth/editprofile`.
#### Request Method
- **Method:** POST
- **Endpoint:** `{{domainname}}/api/auth/editprofile`
#### Request Parameters
- `id` (integer): The unique identifier of the user.
- `username` (string): The username of the user.
- `email` (string): The email address of the user.
- `first_name` (string): The first name of the user.
- `last_name` (string): The last name of the user.
- `is_superuser` (boolean): Indicates whether the user is a superuser or
not.
- `profile` (object): An object containing additional profile
information.
- `id` (integer): The unique identifier of the profile.
- `profilepic` (string): The URL of the user's profile picture.
- `number` (string): The contact number of the user.
- `company` (string): The company name of the user.
- `user` (integer): The user ID associated with the profile.
#### Note
Please send this request using form data, not JSON. Additionally, ensure
to include the necessary information to update the desired profile
fields.
#### Response
The response to this request will have a status code of `200`,
indicating a successful operation. The response body will contain the
updated profile information of the user.
#### Example Response
``` json
{
"id": 1,
"username": "admin",
"email": "admin@aptrs.com",
"first_name": "sourav11",
"last_name": "kalal",
"is_superuser": true,
"profile": {
"id": 1,
"profilepic": "http://aptrsapi.souravkalal.tech/media/profile/avatar-1.svg",
"number": "+911234567891",
"company": "AnoF PVT LTD",
"user": 1
}
}
```
operationId: editProfile
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
company:
type: string
example: test
email:
description: // read only cannot be edited
type: string
example: admin@aptrs.com
full_name:
type: string
example: user person
is_superuser:
type: string
example: 'true'
number:
type: string
example: '+911234567891'
profilepic:
description: Optional
type: string
format: binary
username:
type: string
example: admin
responses:
'200':
description: ''
/api/auth/changepassword:
post:
tags:
- Account
summary: Change Password
description: >-
### Endpoint Description: Change Password
This API endpoint is used to change the password of a user. It is an
HTTP POST request that should be sent to
`{{domainname}}/api/auth/changepassword`.
#### Request Method
- **Method:** POST
- **Endpoint:** `{{domainname}}/api/auth/changepassword`
#### Request Parameters
- `old_password` (string): The current password of the user.
- `new_password` (string): The new password to be set.
``` json
{
"newpassword": "admin",
"oldpassword": "admin"
}
```
### Response
In case of a successful password change, the API will return a response
with a status code of `200` and a message in the following format:
``` json
{
"message": "Password updated."
}
```
If there is an error in the request, the API will respond with a status
code of `400` and an error message in the following format:
``` json
{
"non_field_errors": [""]
}
```
Please note that the error message may contain additional information if
there are specific errors related to the request parameters.
operationId: changePassword
requestBody:
content:
application/json:
schema:
type: object
properties:
newpassword:
type: string
example: PE#5GZ29PTZMSE
oldpassword:
type: string
example: PE#5GZ29PTZMSE
example:
newpassword: PE#5GZ29PTZMSE
oldpassword: PE#5GZ29PTZMSE
responses:
'200':
description: ''
/api/auth/users-active:
get:
tags:
- Account
summary: Get All Active User
description: Get All Active User
operationId: getAllActiveUser
responses:
'200':
description: ''
/api/auth/logout/:
post:
tags:
- Account
summary: Logout
description: Logout