-
Notifications
You must be signed in to change notification settings - Fork 1
/
apiary.apib
1078 lines (782 loc) · 48 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://calamusapi.herokuapp.com/
# Calamus API
Blog API that handles your blog applications ;D
This is an open source project that can be found here https://github.com/Wyvarn/calamus
## Health [/health]
Checks the health of the application
### Health [GET]
+ Response 200 (application/json)
+ Body
{
'status': 'I am OK! :)'
}
## Register a new user [/api/v1/register]
### Registration [POST]
This allows creation of a new user for your blogging platform. Roles could either be _writer_, _admin_, or _editor_
+ Request (application/json)
+ Attributes
+ name: Dredd (required)
+ email: drdredd@calamus.com (required)
+ password: guns-and-knives (required)
+ profilePicUrl: https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg (required)
+ role: writer (required)
+ Response 201 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Registration successful",
"data": {
"user": {
"_id": "5e972acd31687238d00c4754",
"name": "Dredd",
"email": "drdredd@calamus.com",
"roles": [
"5e96f312daf769d5681cd7cd"
],
"profilePicUrl": "https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg"
},
"tokens": {
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw",
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1OTczMzMxOTcsInBybSI6IjM1Mjg1NzhhY2FmN2JiMjE3ZGFjMGNmYzhlMTgxNjBlZGMyNzBmMWJmOTc0NDI2NGM1Y2IwODdiMWYwMWUxNjg0ZWRjMzY4MjJhYzcwOWJmYjZkYmVmNGI0ZDQyNzYxYmJiYTBkM2YxNTlkYWM4MjY3YWNmZmUwNGQ5ZTY2Mjk5In0.CgoEtalmCglEldEWq_2ERsqekOYNUUUihnyn_-iuKLpxrTmXrfR2q52n8LQcWs7HyfVuanj0-nIkcLzzR1_X8A"
}
}
}
## Deregister a user [/api/v1/deregister]
### DeRegistration [POST]
This allows deregistration a user from your blogging platform. As long as the token is valid and is for the particular user. This user will be removed from the platform.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "User deegistered"
}
## Token Refresh [/api/v1/token/refresh]
### Refresh expired Access Token [POST]
This is used to issue new tokens when the access token has expired. In the body of the request, ensure you have the correct refresh token that was
issued alongside the expired access token.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Body
{
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwYjQxNDYyZDUyODMyNDI2NDMzODNiNzZhY2Q5OTE4MzQ1YzJiMWU0YWRkMmMwMTM3Y2YxMjU4OWQ5MjkxNzUzM2FlZjJiZDk5NjZjZmYxNWUzZGM3MDIzYzg5Njg5NWJlNDc3ZmEwMjA2OTFkZDE0N2Q4OTg5NzRkMWRmYmY4OCIsImlzcyI6ImNhbGFtdXMuY29tIiwiYXVkIjoiY2FsYW11cy5jb20iLCJzdWIiOiI1ZTljMWI0M2IzZGY2NjY3ZDE1YzVmMjUiLCJpYXQiOjE1ODc0MDY3NTUsImV4cCI6MTU4NzY2NTk1NSwibmJmIjoxNTg3NDA2NzU1LCJuYW1lIjoibHVzaW5hIiwidHlwIjoiQmVhcmVyIiwicm9sZXMiOlt7Il9pZCI6IjVlOTZmMzEyZGFmNzY5ZDU2ODFjZDdjZiIsImNvZGUiOiJBRE1JTiJ9XX0.Ul4fIa6U9kGodd5FFKoDxKuxL7sfj3bug7h64WfogH5FUaq8WJJ5b10sFzC_qe7BllaM9hlthoo4trOmyAI3PQ",
}
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Token Issued",
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4ODYzNGM4ZGMyNmYxNzZlMDU4OWIwMTk0OTFkZmZlZGMwZjg1YTY5NDlhNDUzNjlkZDEwZDYxNjZmYmZkNDI0MWE3YTQzZWQwMThjNGQwMjI4MjYxZjhkMTFkOGI2NjYzMGM1ODRkZTkxMzc4MmJmNWUzNTg5ZTdjZmI1YzJhOCIsImlzcyI6ImNhbGFtdXMuY29tIiwiYXVkIjoiY2FsYW11cy5jb20iLCJzdWIiOiI1ZTljMWI0M2IzZGY2NjY3ZDE1YzVmMjUiLCJpYXQiOjE1ODc0MDY3NTgsImV4cCI6MTU4NzQ5MzE1OCwibmJmIjoxNTg3NDA2NzU4LCJuYW1lIjoibHVzaW5hIiwidHlwIjoiQmVhcmVyIiwicm9sZXMiOlt7Il9pZCI6IjVlOTZmMzEyZGFmNzY5ZDU2ODFjZDdjZiIsImNvZGUiOiJBRE1JTiIsInN0YXR1cyI6dHJ1ZX1dfQ.jLC5ilEKKVm7-qa6edZ7adFQeWYA0RkjxYafO3ZiwKzT5q1tiHzpscPQvc2blpURqWNOHPjV2pr9leda02VMPA",
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0MzExOGNkY2Y4N2M4Nzc2ZjZkYWU3YmMxMDkzMTBkNDgyOWE0ZjhiZmY4Yzc4MmMyZmRlMDdlMTVmNjA1YTM0YzExNjJhNDdiNTgyMDhjYTY4ZWZhYzU5MDUwZGEzOWUxM2ZmMDE0ZjRmMzNlOTE4Njc4MGRlMWJjOTFmOGM1NyIsImlzcyI6ImNhbGFtdXMuY29tIiwiYXVkIjoiY2FsYW11cy5jb20iLCJzdWIiOiI1ZTljMWI0M2IzZGY2NjY3ZDE1YzVmMjUiLCJpYXQiOjE1ODc0MDY3NTgsImV4cCI6MTU4NzY2NTk1OCwibmJmIjoxNTg3NDA2NzU4LCJuYW1lIjoibHVzaW5hIiwidHlwIjoiQmVhcmVyIiwicm9sZXMiOlt7Il9pZCI6IjVlOTZmMzEyZGFmNzY5ZDU2ODFjZDdjZiIsImNvZGUiOiJBRE1JTiIsInN0YXR1cyI6dHJ1ZX1dfQ.hgMr5ob2ZNWgs1quNrCwOi9ZCFKxs1R5--ShHtreKEyZC6q3ObbV1fFJB2V4COY3YebTW2bN1ufBwh3E-CH9Yg"
}
## Public Profile by ID [/api/v1/profile/public/id/{id}]
### Get a user's profile by their ID [GET]
Allows getting a users public profile given that we have their ID
+ Request (application/json)
+ Parameters
+ id (string) - ID of registered user. This will be available in the response when registering a user
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"name": "Dredd",
"profilePicUrl": "https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg"
}
}
## Public Profile by name [/api/v1/profile/public/u/{name}]
### Get a user's profile by their NAME [GET]
Allows getting a users public profile given that we have their name
+ Request (application/json)
+ Parameters
+ name (string) - Name of registered user. This will be the registered user's name
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"name": "Dredd",
"profilePicUrl": "https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg"
}
}
## Private Profile [/api/v1/profile/my]
### Get a user's private profile [GET]
Allows getting a users private profile. This is a secured endpoint and requires an access token.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"name": "Dredd",
"profilePicUrl": "https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg",
"roles": [
{
"_id": "5e96f312daf769d5681cd7cf",
"code": "ADMIN"
}
]
}
}
## Update a user profile [/api/v1/profile]
### Updates a user profile [PATCH]
Allows a user to update their profile with name and profilePicUrl
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Body
{
"name": "Judge Dredd",
"profilePicUrl": "https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg",
}
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Profile updated",
"data": {
"name": "Judge Dredd",
"profilePicUrl": "https://images-na.ssl-images-amazon.com/images/I/81tSRSR1JGL._AC_SL1500_.jpg",
"roles": [
{
"_id": "5e96f312daf769d5681cd7cf",
"code": "ADMIN"
}
]
}
}
## Writer create a blog [/api/v1/writer/blog]
### Creates a new blog post [POST]
Allows users with writer roles to create blogs
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Body
{
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"text": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"tags": [
"NODEJS",
"BACKEND"
]
}
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog created successfully",
"data": {
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": false,
"isDraft": true,
"isPublished": false,
"status": true,
"_id": "5ea726929ae1e474030bd9cb",
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": "5ea71cfe8bdc2c55032755d2",
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2",
"createdAt": "2020-04-27T18:38:10.295Z",
"updatedAt": "2020-04-27T18:38:10.295Z"
}
}
## Writer get/update/delte a blog [/api/v1/writer/blog/{ID}]
### Updates an existing blog [PATCH]
Allows users with writer roles to update *THEIR* already created blog post. This example demonstrates updating only the title.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ ID (string) - id of the blog to update
+ Body
{
"title": "How NodeJS works."
}
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog updated successfully",
"data": {
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": false,
"isDraft": true,
"isPublished": false,
"status": true,
"_id": "5ea726929ae1e474030bd9cb",
"title": "How NodeJS works.",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": "5ea71cfe8bdc2c55032755d2",
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2",
"createdAt": "2020-04-27T18:38:10.295Z",
"updatedAt": "2020-04-27T18:38:10.295Z"
}
}
### Deletes an existing blog [DELETE]
Allows users with writer roles to delete *THEIR* already created blog post.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ ID (string) - id of the blog to delete
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog deleted successfully"
}
### Get an existing blog [GET]
Allows users with writer roles to get *THEIR* already created blog post.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ ID (string) - id of the blog to retrieve
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": false,
"isPublished": false,
"status": true,
"_id": "5ea726929ae1e474030bd9cb",
"title": "How NodeJS works.",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": "5ea71cfe8bdc2c55032755d2",
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2",
"createdAt": "2020-04-27T18:38:10.295Z",
"updatedAt": "2020-04-27T18:38:10.295Z"
}
}
## Writer submit a blog [/api/v1/writer/blog/submit/{ID}]
### Submits an existing blog [PATCH]
Allows users with writer roles to submit *THEIR* already created blog post.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ ID (string) - id of the blog to update
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog submitted successfully",
"data": {
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": false,
"isPublished": false,
"status": true,
"_id": "5ea726929ae1e474030bd9cb",
"title": "How NodeJS works.",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": "5ea71cfe8bdc2c55032755d2",
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2",
"createdAt": "2020-04-27T18:38:10.295Z",
"updatedAt": "2020-04-27T18:38:10.295Z"
}
}
## Writer withdraws a blog [/api/v1/writer/blog/withdraw/{ID}]
### Updates an existing blog [PATCH]
Allows users with writer roles to withdraw *THEIR* already submitted blog post.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ ID (string) - id of the blog to update
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog withdrawn successfully",
"data": {
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": false,
"isDraft": true,
"isPublished": false,
"status": true,
"_id": "5ea726929ae1e474030bd9cb",
"title": "How NodeJS works.",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": "5ea71cfe8bdc2c55032755d2",
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2",
"createdAt": "2020-04-27T18:38:10.295Z",
"updatedAt": "2020-04-27T18:38:10.295Z"
}
}
## Writer gets all submitted blogs [/api/v1/writer/blog/submitted/all]
### Get all submitted blogs [GET]
Allows users with writer roles to get all *THEIR* submitted blogs.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Attributes (object)
+ statusCode: 10000 (string,required) - Status code
+ message: success (string, required) - Message from Server
+ data: (array[Blog]) - Array of submitted blogs
## Writer gets all published blogs [/api/v1/writer/blog/published/all]
### Get all published blogs [GET]
Allows users with writer roles to get all *THEIR* published blogs.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Attributes (object)
+ statusCode: 10000 (string,required) - Status code
+ message: success (string, required) - Message from Server
+ data: (array[Blog]) - Array of published blogs
## Writer gets all draft blogs [/api/v1/writer/blog/drafts/all]
### Get all draft blogs [GET]
Allows users with writer roles to get all *THEIR* draft blogs.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Attributes (object)
+ statusCode: 10000 (string,required) - Status code
+ message: success (string, required) - Message from Server
+ data: (array[Blog]) - Array of draft blogs
## Editor publish a blog [/api/v1/writer/blog/publish/{id}]
### Publish a blog [PATCH]
Allows users with editor roles to publish a blog
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ id (string) - id of the blog to publish
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog published successfully"
}
## Editor UnPublish a blog [/api/v1/writer/blog/unpublish/{id}]
### UnPublish a blog [PATCH]
Allows users with editor roles to unpublish a blog
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ id (string) - id of the blog to publish
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog unpublished"
}
## Editor Get/Delete a blog [/api/v1/writer/blog/{id}]
### Delete a blog [DELETE]
Allows users with editor roles to delete a blog
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ id (string) - id of the blog to delete
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "Blog deleted successfully"
}
### Get a blog [GET]
Allows users with editor roles to get a blog
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Parameters
+ id (string) - id of the blog to get
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": true,
"isPublished": false,
"status": true,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2"
}
}
## Editor get all published blogs [/api/v1/editor/blog/published/all]
### Get all published blog [GET]
Allows users with editor roles to get all published blogs
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": [
{
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": true,
"isPublished": false,
"status": true,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2"
}
]
}
## Editor get all submitted blogs [/api/v1/editor/blog/submitted/all]
### Get all submitted blogs [GET]
Allows users with editor roles to get all submitted blogs
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": [
{
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": true,
"isPublished": false,
"status": true,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2"
}
]
}
## Editor get all draft blogs [/api/v1/editor/blog/drafts/all]
### Get all draft blogs [GET]
Allows users with editor roles to get all draft blogs
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYWxhbXVzLmNvbSIsImF1ZCI6ImNhbGFtdXMuY29tIiwic3ViIjoiNWU5NzJhY2QzMTY4NzIzOGQwMGM0NzU0IiwiaWF0IjoxNTg2OTY1MTk3LCJleHAiOjE1ODk1NTcxOTcsInBybSI6ImMzMzdhYTJhYmYwYjkwODYyZWIyMWFlNzJiNWUwODFhNDlhNmVhZmU2NzIyODZlNDdjM2NiMDI4YTM1ODFjYWM0ZDEzZmIxM2QyYmIzODM1N2NlMjE3ZThmZWVmYmMyZTg0MTQ1MWQ0NDg5OWJlNDY5ZGZmYWQ0NjZmODJhNDk0In0.iPEAdmZ7VDWHjR--KIzc9NI5NcoyXFQGeE_ZyohofMxC4M3H9qIVmqdRNZyDKQc1mtsgYysk_Q6wmXUdkpKySw
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": [
{
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": true,
"isPublished": false,
"status": true,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2"
}
]
}
## Get a blog by id [/api/v1/blog/{id}]
### Get a single blog [GET]
Allows client to get a blog by its id
+ Request (application/json)
+ Parameters
+ id (string) - id of the blog to get
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": true,
"isPublished": false,
"status": true,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2"
}
}
## Get a Blog by slug [/api/v1/blog?slug={slug}]
### Get a blog by slug [GET]
Allows clients to request for a blog with a slug
+ Request (application/json)
+ Parameters
+ slug (string) - slug of the blog to get
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": {
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"isSubmitted": true,
"isDraft": true,
"isPublished": false,
"status": true,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"draftText": "<p>This will depend on how you render the blog. It can be html text or plain text.</p>",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg",
"createdBy": "5ea71cfe8bdc2c55032755d2",
"updatedBy": "5ea71cfe8bdc2c55032755d2"
}
}
## Get all blogs by given tag [/api/v1/blogs/tags/{tag}?pageNumber={pageNumber}&pageItemCount={pageItemCount}]
### Get blogs by the given tags [GET]
Allows clients to request for a blogs with a given tag and specifiy the page number and the count per page. Note, this will only list
published blogs
+ Request (application/json)
+ Parameters
+ tag (string, required) - tag used to filter blogs
+ pageNumber (number, required) - page number
+ pageItemCount (number, required) - items per page
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": [
{
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"author": {
"_id": "5ea71cfe8bdc2c55032755d2",
"name": "lusina",
"profilePicUrl": "https://avatars1.githubusercontent.com/u/11065002?s=460&u=1e8e42bda7e6f579a2b216767b2ed986619bbf78&v=4"
},
"slug": "introduction-to-node-js-and-how-node-js-works",
"imgUrl": "https://s3.ap-south-1.amazonaws.com/afteracademy-server-uploads/introduction-to-node-js-how-node-js-works-cover.jpg"
}
]
}
## Get all latest blogs [/api/v1/blogs/latest?pageNumber={pageNumber}&pageItemCount={pageItemCount}]
### Get all the latest [GET]
Allows clients to request for all latest blogs and specifiy the page number and the count per page. Note, this will only list
published blogs
+ Request (application/json)
+ Parameters
+ pageNumber (number, required) - page number
+ pageItemCount (number, required) - items per page
+ Response 200 (application/json)
+ Body
{
"statusCode": "10000",
"message": "success",
"data": [
{
"_id": "5eb8eb592529f059b20ef536",
"tags": [
"NODEJS",
"BACKEND"
],
"likes": 0,
"title": "Introduction to Node.js and How Node.js works?",
"description": "Node.js is a popular framework for building backend systems (network applications) which can scale very well. Node.js is a Javascript runtime i.e. it runs the javascript codes.",
"author": {