-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathopenapi.json
746 lines (746 loc) · 22.5 KB
/
openapi.json
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
{
"swagger": "2.0",
"schemes": [
"https"
],
"host": "identity.api.npr.org",
"info": {
"contact": {
"email": "[email protected]",
"name": "NPR One Enterprise Team",
"url": "https://dev.npr.org",
"x-twitter": "NPR"
},
"description": "The entry point to user-specific information",
"termsOfService": "https://dev.npr.org/guide/prerequisites/terms-of-use",
"title": "NPR Identity Service",
"version": "2",
"x-apisguru-categories": [
"entertainment"
],
"x-logo": {
"url": "https://api.apis.guru/v2/cache/logo/https_twitter.com_NPR_profile_image.jpeg"
},
"x-origin": [
{
"format": "swagger",
"url": "https://identity.api.npr.org/v2/swagger.json",
"version": "2.0"
}
],
"x-preferred": true,
"x-providerName": "npr.org",
"x-serviceName": "identity",
"x-datafire": {
"name": "npr_identity",
"type": "openapi"
}
},
"externalDocs": {
"description": "Learn more at the NPR One Developer Center",
"url": "https://dev.npr.org/guide/services/identity"
},
"consumes": [
"application/json",
"application/vnd.collection.doc+json"
],
"produces": [
"application/json",
"application/vnd.collection.doc+json"
],
"securityDefinitions": {
"oauth2": {
"authorizationUrl": "https://authorization.api.npr.org/v2/authorize",
"flow": "accessCode",
"scopes": {
"identity.readonly": "See your personal information, such as your first name, last name, and favorite station.",
"identity.write": "Update your personal information, such as your favorite station(s) or program(s) you follow, on your behalf.",
"listening.readonly": "See your NPR One listening history and get audio recommendations.",
"listening.write": "Record that you have heard, marked as interesting, and/or skipped NPR One stories in order to personalize future audio recommendations.",
"localactivation": "Connect you with your local NPR member station for communication purposes."
},
"tokenUrl": "https://authorization.api.npr.org/v2/token",
"type": "oauth2"
}
},
"parameters": {
"Authorization": {
"description": "Your access token from the Authorization Service. Should start with `Bearer`, followed by a space, followed by the token.",
"in": "header",
"name": "Authorization",
"required": true,
"type": "string"
},
"X-Advertising-ID": {
"description": "A device-specific advertising identifier, if possible. Apple's IDFA is an example.",
"in": "header",
"name": "X-Advertising-ID",
"required": false,
"type": "string"
}
},
"responses": {
"400WithDocument": {
"description": "A bad request; generally, one or more parameters passed in were incorrect or missing",
"headers": {
"X-RateLimit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-RateLimit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
},
"schema": {
"$ref": "#/definitions/ErrorDocument"
}
},
"401WithDocument": {
"description": "The client is not authorized to complete this request. Check to ensure a valid access token was passed in the headers.",
"schema": {
"$ref": "#/definitions/ErrorDocument"
}
},
"404WithDocument": {
"description": "The resource with the requested ID could not be found, and the server was unable to complete the request.",
"headers": {
"X-RateLimit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-RateLimit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
},
"schema": {
"$ref": "#/definitions/ErrorDocument"
}
},
"429WithDocument": {
"description": "The client has exceeded the number of daily calls as per their rate limit. For now, this only applies to prototype applications and untrusted clients. Trusted clients will never be rate-limited, nor will any production apps.",
"headers": {
"X-RateLimit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-RateLimit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
},
"schema": {
"$ref": "#/definitions/ErrorDocument"
}
},
"500WithDocument": {
"description": "A server error",
"headers": {
"X-RateLimit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-RateLimit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
},
"schema": {
"$ref": "#/definitions/ErrorDocument"
}
},
"503WithDocument": {
"description": "The system is undergoing maintenance and we are unable to fulfill this request. Look for a `Retry-After` header to see the predicted time the system will be back up.",
"headers": {
"Retry-After": {
"description": "The predicted time the system will be back up",
"format": "date-time",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/ErrorDocument"
}
},
"IdentitySuccess": {
"description": "The request was successful",
"headers": {
"X-RateLimit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-RateLimit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
},
"schema": {
"$ref": "#/definitions/UserDocument"
}
}
},
"paths": {
"/v2/following": {
"post": {
"consumes": [
"application/json"
],
"description": "After a successful call, this returns a User document with an updated list of affiliations.",
"operationId": "postFollowing",
"parameters": [
{
"$ref": "#/parameters/Authorization"
},
{
"description": "A JSON-serialized object which contains data about a user affiliation such as the aggregation ID, affiliation rating, aggregation URL, days since last listen, and following status.",
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Affiliation"
}
}
],
"responses": {
"201": {
"$ref": "#/responses/IdentitySuccess"
},
"400": {
"$ref": "#/responses/400WithDocument"
},
"401": {
"$ref": "#/responses/401WithDocument"
},
"429": {
"$ref": "#/responses/429WithDocument"
},
"500": {
"$ref": "#/responses/500WithDocument"
},
"503": {
"$ref": "#/responses/503WithDocument"
}
},
"security": [
{
"oauth2": [
"identity.write"
]
}
],
"summary": "Update the following status of the logged-in user for a particular aggregation",
"tags": [
"identity"
]
}
},
"/v2/stations": {
"put": {
"description": "Right now, only the primary station can be changed. Previously selected stations will not be deleted, but the new station will be moved to first in the array.",
"operationId": "updateStations",
"parameters": [
{
"$ref": "#/parameters/Authorization"
},
{
"description": "A JSON-serialized array of station IDs",
"in": "body",
"name": "body",
"required": false,
"schema": {
"items": {
"type": "integer"
},
"type": "array"
}
}
],
"responses": {
"201": {
"$ref": "#/responses/IdentitySuccess"
},
"400": {
"$ref": "#/responses/400WithDocument"
},
"401": {
"$ref": "#/responses/401WithDocument"
},
"429": {
"$ref": "#/responses/429WithDocument"
},
"500": {
"$ref": "#/responses/500WithDocument"
},
"503": {
"$ref": "#/responses/503WithDocument"
}
},
"security": [
{
"oauth2": [
"identity.write"
]
}
],
"summary": "Update the logged-in user's favorite station(s)",
"tags": [
"identity"
]
}
},
"/v2/user": {
"get": {
"description": "After a successful login, the client should send a `GET` call approximately once an hour to refresh the user data.",
"operationId": "getUser",
"parameters": [
{
"$ref": "#/parameters/Authorization"
}
],
"responses": {
"200": {
"$ref": "#/responses/IdentitySuccess"
},
"401": {
"$ref": "#/responses/401WithDocument"
},
"429": {
"$ref": "#/responses/429WithDocument"
},
"500": {
"$ref": "#/responses/500WithDocument"
},
"503": {
"$ref": "#/responses/503WithDocument"
}
},
"security": [
{
"oauth2": [
"identity.readonly"
]
}
],
"summary": "Get the latest state information about the logged-in user",
"tags": [
"identity"
]
}
},
"/v2/user/inherit": {
"post": {
"description": "This can and should only be used by clients who have access to the `temporary_user` grant type.\n Third-party developers do not have access to this grant type by default, and will not need this endpoint.",
"operationId": "inheritFromTempUser",
"parameters": [
{
"$ref": "#/parameters/Authorization"
},
{
"description": "The temporary user's ID before the user registered or logged in",
"in": "query",
"name": "temp_user",
"required": true,
"type": "integer"
}
],
"responses": {
"202": {
"$ref": "#/responses/IdentitySuccess"
},
"400": {
"$ref": "#/responses/400WithDocument"
},
"429": {
"$ref": "#/responses/429WithDocument"
},
"500": {
"$ref": "#/responses/500WithDocument"
},
"503": {
"$ref": "#/responses/503WithDocument"
}
},
"security": [
{
"oauth2": [
"identity.write"
]
}
],
"summary": "Copy listening data from a temporary user account to the logged-in user's account",
"tags": [
"identity"
]
}
}
},
"definitions": {
"AbstractCDocLink": {
"allOf": [
{
"$ref": "#/definitions/AbstractLink"
},
{
"properties": {
"content-type": {
"description": "The MIME type of the response of this link",
"type": "string"
}
},
"required": [
"content-type"
]
}
]
},
"AbstractLink": {
"properties": {
"href": {
"description": "The link to be followed",
"format": "uri",
"type": "string"
}
},
"required": [
"href"
]
},
"Affiliation": {
"description": "A program (aggregation) that a given user has shown an affiliation with",
"properties": {
"daysSinceLastListen": {
"description": "The number of days since a user last listened to a story from this aggregation. Absent if user never listened to the aggregation.",
"format": "int32",
"type": "integer"
},
"following": {
"default": false,
"description": "Whether or not the user is following the aggregation. When changing affiliation status, the client is expected to toggle this value and then send the entire object back.",
"type": "boolean"
},
"href": {
"description": "A link to more details about the program from the NPR Story API",
"type": "string"
},
"id": {
"description": "A unique identifier for the aggregation (program)",
"type": "string"
},
"notif_following": {
"description": "The topic in Firebase Cloud Messaging to which the device should subscribe if it supports notifications and the user wants notifications about the podcasts they follow.",
"items": {
"type": "string"
},
"type": "array"
},
"notif_rated": {
"description": "The topic in Firebase Cloud Messaging to which the device should subscribe if it supports notifications and the user wants notifications about the podcasts they have highly rated.",
"items": {
"type": "string"
},
"type": "array"
},
"rating": {
"description": "The user's average rating for this affiliation on a scale of 0-1. Absent if user never listened to the aggregation.",
"format": "float",
"type": "number"
},
"title": {
"description": "The title for the aggregation (program)",
"type": "string"
}
},
"required": [
"id",
"href",
"following"
]
},
"Algolia": {
"description": "Parameters for querying the Algolia Search SDK for content",
"properties": {
"apiKey": {
"description": "A search API key for this user",
"type": "string"
}
},
"required": [
"apiKey"
]
},
"Cohort": {
"description": "An experimental grouping for User Experience A/B Testing",
"properties": {
"id": {
"description": "A short ID for this cohort; ignored on a PUT",
"type": "string"
},
"name": {
"description": "A text string identifying the cohort, useful for metrics; ignored on a PUT",
"type": "string"
},
"public": {
"description": "For internal use only; represents the current configuration file being used by the Listening Service",
"type": "string"
},
"test": {
"description": "For internal use only; represents the test configuration file being used by the Listening Service",
"type": "string"
}
},
"required": [
"id",
"name"
]
},
"CollectionDocument": {
"description": "Base Collection.Doc+JSON output",
"properties": {
"attributes": {
"type": "object"
},
"errors": {
"description": "A list of encountered errors, ignored on POST, PUT",
"items": {
"type": "object"
},
"type": "array"
},
"href": {
"description": "A URL representation of the resource; should generally be ignored by clients unless noted otherwise",
"type": "string"
},
"items": {
"items": {
"type": "object"
},
"type": "array"
},
"links": {
"type": "object"
},
"version": {
"default": "1.0",
"description": "The version of the Collection.Doc+JSON spec being used",
"type": "string"
}
},
"required": [
"version",
"href",
"attributes",
"items",
"links",
"errors"
]
},
"Error": {
"description": "A serialized version of any error encountered when processing this request",
"properties": {
"code": {
"description": "The error code",
"format": "int32",
"type": "integer"
},
"debug": {
"description": "Additional debug information if debug mode is turned on",
"type": "string"
},
"text": {
"description": "The error description",
"type": "string"
}
},
"required": [
"code"
]
},
"ErrorDocument": {
"allOf": [
{
"$ref": "#/definitions/CollectionDocument"
},
{
"properties": {
"attributes": {
"description": "Ignore; will be empty for errors",
"type": "object"
},
"errors": {
"description": "A list of encountered errors, ignored on POST, PUT",
"items": {
"$ref": "#/definitions/Error"
},
"type": "array"
},
"items": {
"description": "Ignore; will be empty for errors",
"items": {
"type": "object"
},
"type": "array"
},
"links": {
"description": "Ignore; will be empty for errors",
"type": "object"
}
}
}
],
"description": "A Collection.doc+JSON representation of an error result from an API call"
},
"Organization": {
"description": "A station that a user has an affiliation with",
"properties": {
"call": {
"description": "Station call letters",
"type": "string"
},
"city": {
"description": "A short description of the station's main market city",
"type": "string"
},
"displayName": {
"description": "A short displayable text field for the end user, strictly text; ignored on PUT",
"type": "string"
},
"donationUrl": {
"description": "Station donation page URL",
"type": "string"
},
"id": {
"description": "Some unique identifier for the organization for the user",
"type": "string"
},
"logo": {
"description": "Station logo image url",
"type": "string"
},
"notif_org": {
"description": "The topic in Firebase Cloud Messaging to which the device should subscribe if it supports notifications and the user wants notifications about their localized station.",
"items": {
"type": "string"
},
"type": "array"
},
"serviceId": {
"description": "Some unique identifier for the user's organization's primary service, or null if the org has no services",
"type": "string"
},
"smallLogo": {
"description": "Station logo image url",
"type": "string"
}
},
"required": [
"id",
"displayName",
"call",
"city"
]
},
"UserData": {
"description": "Object; see description of a user object below",
"properties": {
"affiliations": {
"description": "Program(s) that the user has positively interacted with",
"items": {
"$ref": "#/definitions/Affiliation"
},
"type": "array"
},
"algolia": {
"description": "Use this information to search Algolia for stories",
"items": {
"$ref": "#/definitions/Algolia"
},
"type": "array"
},
"cohort": {
"$ref": "#/definitions/Cohort",
"description": "Experimental groupings for User Experience A/B Testing"
},
"email": {
"description": "The user's email address",
"type": "string"
},
"firstName": {
"description": "The user's first name",
"type": "string"
},
"id": {
"description": "Some unique identifier for the user",
"type": "string"
},
"lastName": {
"description": "The user's last name",
"type": "string"
},
"organizations": {
"description": "User's chosen NPR Member Station(s)",
"items": {
"$ref": "#/definitions/Organization"
},
"type": "array"
},
"totalListeningTime": {
"description": "Internal use only. User's total listening time across all platforms.",
"type": "string"
}
},
"required": [
"id",
"cohort",
"organizations",
"algolia"
]
},
"UserDocument": {
"allOf": [
{
"$ref": "#/definitions/CollectionDocument"
},
{
"properties": {
"attributes": {
"$ref": "#/definitions/UserData",
"description": "Object; see description of a user object below"
},
"items": {
"description": "Not used, ignored on a PUT",
"items": {
"type": "object"
},
"type": "array"
},
"links": {
"description": "A list of links, not used by the Identity Service; ignored on a PUT",
"type": "object"
}
}
}
]
}
}
}