You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"userId": 17// Added if non-Strapi user context provided to identify who made such reaction
286
289
},
287
290
// ...
288
291
]
@@ -297,7 +300,8 @@ _GraphQL equivalent: [Public GraphQL API -> List all reactions associated with p
297
300
298
301
Return all reactions associated with provided user:
299
302
- for logged in user - if call is done with user context via `Authorization` header
300
-
- for specific ID - if you're not providing the user context via `Authorization` header
303
+
- for specific Strapi user ID - if you're not providing the user context via `Authorization` header and you're providing the user context via `user-id` url param
304
+
- for specific non-Strapi user ID - if you're not providing the user context via `Authorization` header and you're providing the user context via `X-Reactions-Author` header
@@ -334,7 +338,8 @@ _GraphQL equivalent: [Public GraphQL API -> List all reactions of kind / type as
334
338
335
339
Return all reactions of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID with following combinations:
336
340
- all - if you're not providing the user context via `Authorization` header
337
-
- all related with user - if call is done with user context via `Authorization` header
341
+
- all related with Strapi user - if call is done with user context via `Authorization` header
342
+
- all related with non-Strapi user - if call is done with user ID via `X-Reactions-Author` header
"userId": 17// Added if non-Strapi user context provided to identify who made such reaction
356
362
// ...
357
363
]
358
364
```
@@ -366,7 +372,8 @@ _GraphQL equivalent: [Public GraphQL API -> List all reactions of kind associate
366
372
367
373
Return all reactions of specific kind associated with provided user:
368
374
- for logged in user - if call is done with user context via `Authorization` header
369
-
- for specific ID - if you're not providing the user context via `Authorization` header
375
+
- for specific Strapi user ID - if you're not providing the user context via `Authorization` header and you're providing the user context via `user-id` url param
376
+
- for specific non-Strapi user ID - if you're not providing the user context via `Authorization` header and you're providing the user context via `X-Reactions-Author` header
@@ -403,7 +410,10 @@ _GraphQL equivalent: [Public GraphQL API -> Set reaction for Content Type](#set-
403
410
404
411
Create reaction of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID.
405
412
406
-
`Authorization` header is required
413
+
To identify the reaction author, you must provide **one** of the following headers:
414
+
415
+
-`Authorization` – use this header if you want to set a reaction for a Strapi user.
416
+
-`X-Reactions-Author` – use this header if you want to set a reaction for a non-Strapi user. The value can be any identifier that uniquely distinguishes the reaction author in your system.
@@ -428,7 +438,10 @@ _GraphQL equivalent: [Public GraphQL API -> Unset reaction for Content Type](#un
428
438
429
439
Delete reaction of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID.
430
440
431
-
`Authorization` header is required
441
+
To identify the reaction author, you must provide **one** of the following headers:
442
+
443
+
-`Authorization` – use this header if you want to set a reaction for a Strapi user.
444
+
-`X-Reactions-Author` – use this header if you want to set a reaction for a non-Strapi user. The value can be any identifier that uniquely distinguishes the reaction author in your system.
@@ -448,7 +461,10 @@ _GraphQL equivalent: [Public GraphQL API -> Toggle reaction for Content Type](#t
448
461
449
462
Toggle reaction of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID.
450
463
451
-
`Authorization` header is required
464
+
To identify the reaction author, you must provide **one** of the following headers:
465
+
466
+
-`Authorization` – use this header if you want to set a reaction for a Strapi user.
467
+
-`X-Reactions-Author` – use this header if you want to set a reaction for a non-Strapi user. The value can be any identifier that uniquely distinguishes the reaction author in your system.
1. No reaction set yet - after`toggle` reaction is set
473
-
2.Single reaction already set - after `toogle` no reaction is set
474
-
3.Multiple reactions already set - after `toggle`just specified reaction stays, rest becomes unset
488
+
1. No reaction set yet - Calling`toggle`for a reaction sets that reaction.
489
+
2.Same reaction already set - Calling `toggle` for a reaction that is already set will **unset** it (result: no reaction).
490
+
3.Different reaction already set - If another reaction is set, calling `toggle`for a new reaction will **switch** to that reaction: the specified reaction becomes set, and any previously set reactions of that type are unset.
475
491
476
492
## 🕸️ Public GraphQL API specification
477
493
@@ -522,8 +538,10 @@ query {
522
538
_REST API equivalent: [Public REST API -> List all reactions associated with Content Type](#list-all-reactions-associated-with-content-type)_
523
539
524
540
Return all reactions associated with provided Collection / Single Type UID and Content Type Document ID with following combinations:
525
-
- Query `reactionsList` - no `Authorization` header provided (open for public)
526
-
- Query `reactionsListPerUser` - an `Authorization` header is mandatory
541
+
- Query `reactionsList` – returns all reactions for the specified document. No `Authorization` header is required (public access).
542
+
- Query `reactionsListPerUser` – returns reactions added by a specific author. One of the following headers is required:
543
+
-`Authorization` – to fetch reactions for a Strapi user.
544
+
-`X-Reactions-Author` – to fetch reactions for a non-Strapi user, identified by any custom author ID.
527
545
528
546
**Example request**
529
547
@@ -600,7 +618,9 @@ query {
600
618
_REST API equivalent: [Public REST API -> List all reactions associated with particular user](#list-all-reactions-associated-with-particular-user)_
601
619
602
620
Return all reactions associated with provided user:
603
-
- Query `reactionsListAllPerUser` - an `Authorization` header is mandatory or `userId` in args
621
+
- Query `reactionsListAllPerUser` – one of the following headers is required:
622
+
-`Authorization` – to fetch reactions for a Strapi user.
623
+
-`X-Reactions-Author` – to fetch reactions for a non-Strapi user, identified by any custom author ID.
604
624
605
625
**Example request**
606
626
@@ -666,8 +686,11 @@ query {
666
686
_REST API equivalent: [Public REST API -> List all reactions of kind / type associated with Content Type](#list-all-reactions-of-kind--type-associated-with-content-type)_
667
687
668
688
Return all reactions of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID with following combinations:
669
-
- Query `reactionsList` - no `Authorization` header provided (open for public)
670
-
- Query `reactionsListPerUser` - an `Authorization` header is mandatory
689
+
- Query `reactionsList` – returns all reactions for the specified document. No `Authorization` header is required (public access).
690
+
- Query `reactionsListPerUser` – returns reactions added by a specific author. One of the following headers is required:
691
+
-`Authorization` – to fetch reactions for a Strapi user.
692
+
-`X-Reactions-Author` – to fetch reactions for a non-Strapi user, identified by any custom author ID.
693
+
671
694
672
695
**Example request**
673
696
@@ -726,7 +749,9 @@ query {
726
749
_REST API equivalent: [Public REST API -> List all reactions of kind associated with particular user](#list-all-reactions-of-kind-associated-with-particular-user)_
727
750
728
751
Return all reactions of specific kind associated with provided user:
729
-
- Query `reactionsListAllPerUser` - an `Authorization` header is mandatory or `userId` in args
752
+
- Query `reactionsListAllPerUser` – one of the following headers is required:
753
+
-`Authorization` – to fetch reactions for a Strapi user.
754
+
-`X-Reactions-Author` – to fetch reactions for a non-Strapi user, identified by any custom author ID.
730
755
731
756
**Example request**
732
757
@@ -784,7 +809,10 @@ _REST API equivalent: [Public REST API -> Set reaction for Content Type](#set-re
784
809
785
810
Create reaction of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID.
786
811
787
-
`Authorization` header is required
812
+
To identify the reaction author, you must provide **one** of the following headers:
813
+
814
+
-`Authorization` – use this header if you want to set a reaction for a Strapi user.
815
+
-`X-Reactions-Author` – use this header if you want to set a reaction for a non-Strapi user. The value can be any identifier that uniquely distinguishes the reaction author in your system.
788
816
789
817
**Example request**
790
818
@@ -821,7 +849,10 @@ _REST API equivalent: [Public REST API -> Unset reaction for Content Type](#unse
821
849
822
850
Delete reaction of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID.
823
851
824
-
`Authorization` header is required
852
+
To identify the reaction author, you must provide **one** of the following headers:
853
+
854
+
-`Authorization` – use this header if you want to set a reaction for a Strapi user.
855
+
-`X-Reactions-Author` – use this header if you want to set a reaction for a non-Strapi user. The value can be any identifier that uniquely distinguishes the reaction author in your system.
825
856
826
857
**Example request**
827
858
@@ -858,7 +889,10 @@ _REST API equivalent: [Public REST API -> Toggle reaction for Content Type](#tog
858
889
859
890
Toggle reaction of specific kind / type associated with provided Collection / Single Type UID and Content Type Document ID.
860
891
861
-
`Authorization` header is required
892
+
To identify the reaction author, you must provide **one** of the following headers:
893
+
894
+
-`Authorization` – use this header if you want to set a reaction for a Strapi user.
895
+
-`X-Reactions-Author` – use this header if you want to set a reaction for a non-Strapi user. The value can be any identifier that uniquely distinguishes the reaction author in your system.
862
896
863
897
**Example request**
864
898
@@ -900,9 +934,9 @@ mutation reactionToggle {
900
934
```
901
935
902
936
### Possible scenarios
903
-
1. No reaction set yet - after`toggle` reaction is set
904
-
2.Single reaction already set - after `toogle` no reaction is set
905
-
3.Multiple reactions already set - after `toggle`just specified reaction stays, rest becomes unset
937
+
1. No reaction set yet - Calling`toggle`for a reaction sets that reaction.
938
+
2.Same reaction already set - Calling `toggle` for a reaction that is already set will **unset** it (result: no reaction).
939
+
3.Different reaction already set - If another reaction is set, calling `toggle`for a new reaction will **switch** to that reaction: the specified reaction becomes set, and any previously set reactions of that type are unset.
0 commit comments