This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
openapi-user.yaml
1856 lines (1827 loc) · 66 KB
/
openapi-user.yaml
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.0
info:
title: MCCS Alpha User API
description: |
## Introduction
The MCCS Alpha User API v1 exposes all of the end user functionality currently available in the [alpha version of the MCCS API](https://github.com/ic3network/mccs-alpha-api).
By providing an API, developers who want to create their own front-end user interface for MCCS will have significant flexibility to implement it in whatever way they choose. This means developers can present MCCS in any language, setup their own signup flow, optimize it for whatever devices their users prefer, develop a mobile app, integrate other services such as chat, etc.
Importantly, an API enables developers to integrate MCCS functionality directly into their own apps (e.g., import transfer data into an accounting application, instruct mutual credit transfers from an e-wallet application, interact with MCCS data via a chat bot, etc.).
## Background
To understand how the MCCS Alpha API works, please read the following design documents:
- [MCCS Alpha Data Model](https://github.com/ic3network/mccs/blob/master/alpha-data-model.md)
- [MCCS Alpha Functionality](https://github.com/ic3network/mccs/blob/master/alpha-functionality.md)
## Test Server
These API docs assume you are running the API server on your local machine using Docker & Docker Compose. See the [How to Start](https://github.com/ic3network/mccs-alpha-api#how-to-start) instructions in the project's GitHub repo for more details.
## License
license:
name: MIT License
url: https://github.com/ic3network/mccs-alpha-api/blob/dev/LICENSE
version: '1'
servers:
- url: http://localhost:8080/api/v1
tags:
- name: Manage Account
description: Create and manage a user and its linked entity
- name: Find Entities
description: Search and filter entities
- name: Transfer Credits
description: Initiate and authorize mutual credit transfers
- name: Review Transfer Activity
description: View pending and completed mutual credit transfers
paths:
/signup:
post:
tags:
- Manage Account
summary: Create a new account - a user resource and associated entity resource
description: |
Individual users can create an account in MCCS by providing an email address, creating a password and adding some other details about themselves and their "business". A "business" need not be a formally established business; it could simply be a list of their skills that they are willing to offer to other participants in the network, or another type of entity such as an association, not-for-profit, NGO, etc.
We use the term **entity** to generically identify businesses, non-profits, NGOs, sole proprietorships, limited companies, etc.
The `POST /signup` API call creates a user resource and an entity (e.g., a business) resource and links the two together. The user resource references its associated entity, and the entity resource references its associated user. These two related resources make up what is referred to as an account.
An account can be created with only a unique email address and a password, enabling a new user to get started quickly. The `userID` and `entityID` are returned in the response body, along with a [JSON Web Token](https://jwt.io) to authorize the user of the account for further API calls related to the user and entity resources just created.
All other details (entity name, user first/last names, goods/services offered or wanted, etc.) are optional and can be added later. The decision about customer data requirements for signup can be determined by developers implementing a front end to the API, since they will be working with the organizations implementing MCCS. If other information is collected during the initial registration process, these extra details can be passed immediately in this `POST /signup` API endpoint or later using the `PATCH /user` and/or `PATCH /user/entities/{entityID}` API endpoints.
The current (v1) implementation of the API has a one-to-one relationship between the user and the entity. This will be changed to a many-to-many relationship in a future implementation.
requestBody:
description: Signup request body
required: true
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/SignupRequiredFields'
- $ref: '#/components/schemas/SignupAllFields'
examples:
requiredFields:
value:
userEmail: jdoe@dev.null
password: 1TrulySecurePassword!!
allFields:
value:
userEmail: jdoe@dev.null
password: 1TrulySecurePassword!!
firstName: Jane
lastName: Doe
userPhone: "+442010203040"
entityEmail: nwcltd@dev.null
entityName: New World Consulting Limited
incType: ltd
companyNumber: A12345
entityPhone: "+442090807060"
website: https://neworco.null
declaredTurnover: 20000
description: "We show you how good things can be and what you need to do to make them happen."
address: "123 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
showTagsMatchedSinceLastLogin: true
receiveDailyMatchNotificationEmail: true
offers:
- consulting
- system-design
wants:
- it-services
- accounting
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
userID:
type: string
entityID:
type: string
token:
type: string
example:
data:
userID: "5eec78f4a880b7c235f66e80"
entityID: "5eec78f4a880b7c235f66e7c"
token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTI2NDIxNjQsInVzZXJJRCI6IjVlZWM3OGY0YTg4MGI3YzIzNWY2NmU4MCIsImFkbWluIjpmYWxzZX0.WhPMfV9S-xgOHcuMT_K-fBhR_K6MpXiJ15GYn4Jz7im1dvhwnV2bEnwuWeFUockl45StxguvIOA5qJ-_3xA14CuP0wJbZa3hVH4jnYXonHlCyHDB8w67RLN9IMFGnSEshhh4D3RjQVpEpBm7jLhQcHKOSQIqUU_RfPkiNxpUkDI6t1RW_-rhY4UsTTuxnC5SOeajzOgiDFM4NwJfjebys8xDGTqYoi4dpCJZEtD_U_X9BuEOovRRJo0TY6m76XxUB9J5U_Hfjm7k_A3aLv3WgDScRv_k-LSsOvviGk1A2ct0nQ2RaVY1udA-76rv1xbvSd26Xds2XtrPb_SzUL-J8A"
400:
$ref: '#/components/responses/BadRequest'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
/login:
post:
tags:
- Manage Account
summary: Login and receive an authorization token
description: |
A user will need to authenticate with an email/password combination which, if successful, will result in a JSON Web Token (JWT) being passed to the user to use with each API request that requires authorization.
The JWT will expire after 24 hours, or as soon as the user calls the `/logout` API.
requestBody:
$ref: '#/components/requestBodies/loginUser'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
example:
data:
token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTI5ODU0MzcsInVzZXJJRCI6IjVlZjFiNWQ5NTA2ODQ3ZWE5MTRkYjA2NiIsImFkbWluIjpmYWxzZX0.E3YJWpUN0h2LS3IfE2niYclTnhKUGXDay7SR_VeVzaq4a_lZPs2w4yxFUWbbeAcPeMgtcd3bEoX6PtDhW3hjJ8XVbqmkJQRmh3uw5ULfgzkIzrQw3twaG8TO6ARM4UvKJWz2Wqb6czd5SesJmM2htIuY3DBJ_u4r9x3hshM5_0kHalfEZtQvae0KrJ2_eBjPmFOdON62QungzStkjTKTfqsvystwFSdfOwAltg0Nri1Z6q-E9AZMTnAxzKNqjp4Ja3hX1IoZXPiV8F0-yl1PhrKI_YzP57pOt84T72_WK3z1_hofHAOwby5-2qvtoKWSmxqzKsIYUYeG89W7h4TvBQ"
400:
$ref: '#/components/responses/BadRequest'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
/logout:
post:
tags:
- Manage Account
summary: Logout and expire the authorization token
description: Logging out will immediately expire the JWT currently associated to the user's account.
responses:
200:
description: OK
401:
$ref: '#/components/responses/Unauthorized'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/password-reset:
post:
tags:
- Manage Account
summary: Request a password reset token
description: When a password is lost by the user, a new one can be requested by providing the email address associated with the user's account. A password reset token will then be sent to that email address.
requestBody:
$ref: '#/components/requestBodies/resetPassword'
responses:
200:
description: OK
400:
$ref: '#/components/responses/BadRequest'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
/password-reset/{token}:
post:
tags:
- Manage Account
summary: Reset a password
description: The new password can be set by providing it along with the password reset token that was received at the user's email address.
parameters:
- $ref: '#/components/parameters/token'
requestBody:
$ref: '#/components/requestBodies/updatePassword'
responses:
200:
description: OK
400:
$ref: '#/components/responses/BadRequest'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
/password-change:
post:
tags:
- Manage Account
summary: Change the password
description: A logged-in user can change the password by sending the new password along with the JWT.
requestBody:
$ref: '#/components/requestBodies/updatePassword'
responses:
200:
description: OK
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/user:
get:
tags:
- Manage Account
summary: View a user's own details
description: Logged-in users can request their details as recorded in the MCCS database.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/User'
example:
data:
id: 5eec78f4a880b7c235f66e80
email: jdoe@dev.null
firstName: Jane
lastName: Doe
telephone: "+442010203040"
lastLoginIP: 192.168.12.34
lastLoginDate: "2020-06-19T23:59:59.999Z"
401:
$ref: '#/components/responses/Unauthorized'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
patch:
tags:
- Manage Account
summary: Modify a user's own details
description: |
Users can change their details in MCCS' database, except for the `email` field which can only be changed by an administrator.
The `id`, `lastLoginIP` and `lastLoginDate` fields are system-generated and therefore are not changeable by either users or administrators.
requestBody:
$ref: '#/components/requestBodies/updateUser'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/User'
example:
data:
id: 5eec78f4a880b7c235f66e80
email: jdoe@dev.null
firstName: Jane K.
lastName: Doer
telephone: "+442012345678"
lastLoginIP: 192.168.12.34
lastLoginDate: "2020-06-19T23:59:59.999Z"
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/user/entities:
get:
tags:
- Manage Account
summary: View an entity's details
description: Users can request the details of their linked entity as recorded in the MCCS database.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Entity'
example:
data:
- id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Consulting Limited
email: nwcltd@dev.null
telephone: "+442090807060"
incType: ltd
companyNumber: A12345
website: https://neworco.null
declaredTurnover: 20000
description: "We show you how good things can be and what you need to do to make them happen."
address: "123 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: true
receiveDailyMatchNotificationEmail: true
offers:
- consulting
- system-design
wants:
- it-services
- accounting
categories:
- consulting
balance: 0
maxPositiveBalance: 500
maxNegativeBalance: 0
pendingTransfers:
- id: 1dimEdDxOJYjDeaP6HEy4cIhLdD
transfer: in
isInitiator: false
accountNumber: "5211115451222517"
entityName: "Hipster Brews"
amount: 157.80
description: "Payment of inv. 1234"
status: transferInitiated
dateProposed: "2020-06-23T12:42:57.786628Z"
401:
$ref: '#/components/responses/Unauthorized'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/user/entities/{entityID}:
patch:
tags:
- Manage Account
summary: Modify an entity's details
description: |
Users can change their entity's details in the MCCS database, except for the `status` field which can only be changed by an administrator. The `id` and `accountNumber` fields are system-generated and therefore are not changeable by either users or administrators.
Changes to the `offers` and `wants` array fields must include all relevant tags because they will overwrite the arrays already stored in the database.
The `email` for an entity is separate from the linked user's email, although the user email address is set for the entity's email as well when the account is first created, but only if an entity email is not specified when creating an account at the `POST /signup` endpoint. The entity email, which receives notifications, can be changed by the user.
parameters:
- $ref: '#/components/parameters/entityID'
requestBody:
$ref: '#/components/requestBodies/updateEntity'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/Entity'
example:
data:
id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
email: nwpplc@dev.null
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- consulting
balance: 0
maxPositiveBalance: 500
maxNegativeBalance: 0
pendingTransfers:
- id: 1dimEdDxOJYjDeaP6HEy4cIhLdD
transfer: in
isInitiator: false
accountNumber: "5211115451222517"
entityName: "Hipster Brews"
amount: 157.80
description: "Payment of inv. 1234"
status: transferInitiated
dateProposed: "2020-06-23T12:42:57.786628Z"
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/categories:
get:
tags:
- Find Entities
summary: Get a full or partial list of entity categories
description: |
The directory of entities is split up into categories that are manually assigned to each entity by an administrator. The entire list or just a subset of it by first letter(s) (`prefix`) and/or partial match (`fragment`) can be requested.
Searching for prefix "t" or "tr" returns all categories that begin with "t" or "tr" (e.g., "Teas" & "Transport" for "t", or only "Transport" for "tr").
Searching for fragment "tr" returns all categories that have "tr" anywhere in their name, including the beginning (e.g., "Transport" & "Carpentry").
parameters:
- name: prefix
in: query
schema:
type: string
description: first letter of a category
example:
c
- name: fragment
in: query
schema:
type: string
description: partial match of word/characters
example:
sport
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/pageSize'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Category'
example:
data:
id: 5e86ee4ec3a20c3113aa9e2d
name: a-new-category
meta:
$ref: '#/components/schemas/Meta'
examples:
fullList:
value:
data:
- id: 5ef1b5ccd35791b2dc384425
name: agriculture
- id: 5ef1b5ccd35791b2dc384426
name: cafes
- id: 5ef1b5ccd35791b2dc384427
name: cleaning-services
- id: 5ef1b5ccd35791b2dc384428
name: professional-services
- id: 5ef1b5ccd35791b2dc384429
name: restaurant
- id: 5ef1b5ccd35791b2dc384430
name: restaurant-supplies
- id: 5ef1b5ccd35791b2dc384431
name: sports-equipment
- id: 5ef1b5ccd35791b2dc384432
name: transport
meta:
numberOfResults: 8
totalPages: 1
withPrefixC:
value:
data:
- id: 5ef1b5ccd35791b2dc384426
name: cafes
- id: 5ef1b5ccd35791b2dc384427
name: cleaning-services
meta:
numberOfResults: 2
totalPages: 1
withFragmentSport:
value:
data:
- id: 5ef1b5ccd35791b2dc384431
name: sports-equipment
- id: 5ef1b5ccd35791b2dc384432
name: transport
meta:
numberOfResults: 2
totalPages: 1
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
/tags:
get:
tags:
- Find Entities
summary: Get a full or partial list of tags used for offers and wants
description: |
Tags are words or short phrases that describe the goods or services an entity can provide (`offers`) to other entities or needs (`wants`) from other entities, in order to facilitate trades with them. For example, a Chinese restaurant might use offer tags such as "restaurant", "chinese", "take-out", "dim-sum", "delivery" to describe its service.
Up to 10 offer tags and 10 want tags can be specified per entity. A list of tags that are fuzzy, partial or exact matches to the input (`fragment`) provided can be requested. If no fragment is provided all tags are returned.
parameters:
- name: fragment
in: query
schema:
type: string
description: partial match of word/characters
example:
be
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/pageSize'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Tag'
example:
data:
id: 5e86ee4ec3a20c3113aa9ccb5
name: a-new-tag
meta:
$ref: '#/components/schemas/Meta'
examples:
fullList:
value:
data:
- id: 5ef1b5ccd35791b2dc384410
name: art-supplies
- id: 5ef1b5ccd35791b2dc384411
name: catering
- id: 5ef1b5ccd35791b2dc384412
name: computer-repair
- id: 5ef1b5ccd35791b2dc384413
name: dog-sitting
- id: 5ef1b5ccd35791b2dc384414
name: micro-brewed-beer
- id: 5ef1b5ccd35791b2dc384415
name: organic-vegetables
- id: 5ef1b5ccd35791b2dc384416
name: piano-tuning
- id: 5ef1b5ccd35791b2dc384417
name: pizza
- id: 5ef1b5ccd35791b2dc384418
name: van-rental
- id: 5ef1b5ccd35791b2dc384419
name: well-being
meta:
numberOfResults: 10
totalPages: 1
withFragmentBe:
value:
data:
- id: 5ef1b5ccd35791b2dc384414
name: micro-brewed-beer
- id: 5ef1b5ccd35791b2dc384419
name: well-being
meta:
numberOfResults: 2
totalPages: 1
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
/entities:
get:
tags:
- Find Entities
summary: Get a list of entities
description: |
Entities can be searched based on (1) their offers and wants tags, (2) the category they are listed under, (3) the date the offers and wants tags were added to their profile, (4) their entity name, and/or (5) an entity's selection of favorites.
If the request does not contain a JWT along with a `querying_entity_id` specified, the search for favorites functionality will not work (e.g., all results will show the `isFavorite` flag as false).
If a `querying_entity_id` is specified and both the requesting entity and the entity returned in the search are `tradingAccepted` status, the email address of the searched entity will also be included.
parameters:
- $ref: '#/components/parameters/offers'
- $ref: '#/components/parameters/wants'
- $ref: '#/components/parameters/category'
- $ref: '#/components/parameters/taggedSince'
- $ref: '#/components/parameters/entityName'
- $ref: '#/components/parameters/favoritesOnly'
- $ref: '#/components/parameters/queryingEntityID'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/pageSize'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Entity'
meta:
$ref: '#/components/schemas/Meta'
examples:
withoutAuth:
value:
data:
- id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- restaurant
isFavorite: false
meta:
numberOfResults: 1
totalPages: 1
withAuth:
value:
data:
- id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- restaurant
isFavorite: true
meta:
numberOfResults: 1
totalPages: 1
withAuthTradingAccepted:
value:
data:
- id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
email: nwpplc@dev.null
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- restaurant
isFavorite: true
meta:
numberOfResults: 1
totalPages: 1
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
# Allow optional Authorizations: https://github.com/OAI/OpenAPI-Specification/issues/14
- {}
- jwt: []
/entities/{entityID}:
get:
tags:
- Find Entities
summary: Get a single entity
description: Returns a single entity's details using its ID. Requests can be made without a JWT from an authenticated user (see `GET /entities` above for more information).
parameters:
- $ref: '#/components/parameters/entityID'
- $ref: '#/components/parameters/queryingEntityID'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/Entity'
examples:
withoutAuth:
value:
data:
id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- restaurant
isFavorite: false
withAuth:
value:
data:
id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- restaurant
isFavorite: true
withAuthTradingAccepted:
value:
data:
id: 5eec78f4a880b7c235f66e7c
accountNumber: "6838115832533278"
name: New World Pizza PLC
email: nwpplc@dev.null
telephone: "+442098765432"
incType: plc
companyNumber: B67890
website: https://nwpizza.null
declaredTurnover: 10000
description: "We show you how good things can taste and where you need to go to eat them!"
address: "456 Yellow Brick Road"
city: "London"
region: "Greater London"
postalCode: "UK1 2ENG"
country: "England"
status: "pending"
showTagsMatchedSinceLastLogin: false
receiveDailyMatchNotificationEmail: false
offers:
- pizza
- wine
wants:
- flour
- mozarella
- tomato
categories:
- restaurant
isFavorite: true
400:
$ref: '#/components/responses/BadRequest'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
# Allow optional Authorizations: https://github.com/OAI/OpenAPI-Specification/issues/14
- {}
- jwt: []
/favorites:
post:
tags:
- Find Entities
summary: Create and manage a list of favorite entities
description: A user can toggle any entity as a favorite, which makes it easy to retrieve using the `favorites_only` search parameter described above (see `GET /entities`).
requestBody:
$ref: '#/components/requestBodies/setFavorite'
responses:
200:
description: OK
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/send-email:
post:
tags:
- Find Entities
summary: Send a message to an entity
description: |
A user can send a message by email to an entity without seeing the email address of the receiving entity. This enables the receiving entity to keep its email private until the entity operator decides to reply to the sender and continue the conversation by email.
Entities with status `accepted`, `tradingPending`, `tradingAccepted` and `tradingRejected` can send an email to other entities with these same 4 statuses.
Entities with status `pending` or `rejected` cannot send an email to any other entity. They also cannot receive emails because there is no way to find their ID since they do not show up in search results because of their `pending`/`rejected` status.
requestBody:
$ref: '#/components/requestBodies/sendEmail'
responses:
200:
description: OK
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
/transfers:
post:
tags:
- Transfer Credits
summary: Initiate a transfer
description: |
A user can initiate a transfer out of or into the account of its entity, which must then be approved or rejected by the user operating the receiving entity, whose account will be credited or debited accordingly. Both entities must have `tradingAccepted` status in order to set up a transfer between them.
If the `transfer` parameter is set to `out`, the initiator will create a transfer that will debit funds from the initiator's entity's account. If `transfer` is `in`, the initiator will create a transfer that results in funds being credited to the initiator's entity's account. Either way, the transfer must be approved by the receiver (see `PATCH /transfers/{transferID}`) in order for the inbound or outbound transfer to move to or from the receiver's entity's account.
requestBody:
$ref: '#/components/requestBodies/initiateTransfer'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/TransferInitiated'
example:
id: 1ZceiVuQyGqeUYlC6UIKgEnaBkD
from: "7132460355005184"
to: "0382855564717143"
amount: 177.5
description: Payment of your invoice number 12345
status: transferInitiated
dateProposed: "2020-05-05T14:09:17.446965528Z"
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
429:
$ref: '#/components/responses/TooManyRequests'
500:
$ref: '#/components/responses/ServerError'
security:
- jwt: []
get:
tags:
- Review Transfer Activity
summary: Get a list of transfers
description: |
A user can request a list of mutual credit transfers for the account of the entity. Transfers can be filtered by `status` (`all`, `initiated`, `completed` or `cancelled`).
The `querying_entity_id` is the ID of the entity whose account the information is being requested for. The user requesting must be associated with that entity or no information will be returned.
parameters:
- $ref: '#/components/parameters/transferStatus'
- $ref: '#/components/parameters/queryingEntityIDRequired'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/pageSize'
responses:
200:
description: OK