Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-931] Add External Identities endpoints to docs #25

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions swagger-spec/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,12 @@ paths:
/users/{user_id}/:
$ref: 'users/detail.yaml'

/users/{user_id}/identities/:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the OSF PR, it looks like this URL is /users/{uid}/settings/identities/

$ref: 'users/external_identities_list.yaml'

/users/{user_id}/identities/{identities_id}/:
$ref: 'users/external_identities_detail.yaml'

/users/{user_id}/institutions/:
$ref: 'users/institutions_list.yaml'

Expand Down
2 changes: 1 addition & 1 deletion swagger-spec/users/detail.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
get:
summary: Retrieve a user
description: >-
Retrieves the details of a given users.
Retrieves the details for a given user.


The returned information includes the user's bibliographic information and the date the user was registered.
Expand Down
96 changes: 96 additions & 0 deletions swagger-spec/users/external_identities_detail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
get:
summary: Retrieve user's external identities
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, would suggest "Retrieve an external identity"

description: >-
Retrieves a JSON object of a user's external identity, currently this only includes their ORCID account.

The returned information includes the external identity's name, status and id.

#### Returns

Returns a JSON object with a `data` key containing the representation of the requested
external identities, if the request is successful.

If the request is unsuccessful, an `errors` key containing
information about the failure will be returned. Refer to the [list of error codes](#tag/Errors-and-Error-Codes)
to understand why this request may have failed.


parameters:
- in: path
type: string
name: user_id
required: true
description: 'The unique identifier of the user.'
- in: path
type: string
name: identities_id
required: true
description: "The unique identifier of a user's external identity."
tags:
- Users
operationId: external_identities_detail
responses:
'200':
description: 'OK'
schema:
$ref: definition.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should reference an external identity definition. Currently the response schema implies that a fully serialized user is returned, when it's just the external identity.
screen shot 2018-08-15 at 1 24 56 pm
vs.
screen shot 2018-08-15 at 1 25 08 pm

examples:
application/json:
data:
links:
self: https://api.osf.io/v2/users/q7fts/settings/identities/ORCID/
attributes:
status: VERFIED
external_id: '0000-0001-9143-4652'
id: ORCID
type: users
id: q7fts

delete:
summary: Delete user's external identities
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, would suggest "Remove an external identity"

description: >-
Deletes a user's external identity.

The returns deleted information including the external identity's name, status and id.

#### Returns
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other delete request sections, I think this should be:

#### Returns

If the request is successful, no content is returned.


If the request is unsuccessful, a JSON object with an errors key containing information about the failure will be returned. Refer to the [list of error codes](#tag/Errors-and-Error-Codes) to understand why this request may have failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like other sections, please add a "Permissions" section to explain that users can only delete their own identities.


Returns a JSON object with a `data` key containing the representation of the requested
external identities, if the request is successful.

If the request is unsuccessful, an `errors` key containing
information about the failure will be returned. Refer to the [list of error codes](#tag/Errors-and-Error-Codes)
to understand why this request may have failed.


parameters:
- in: path
type: string
name: user_id
required: true
description: 'The unique identifier of the user.'
- in: path
type: string
name: identities_id
required: true
description: "The unique identifier of a user's external identity."
tags:
- Users
operationId: external_identities_detail
responses:
'200':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this return 200? Shouldn't a delete request return 204 No Content?

description: 'OK'
schema:
$ref: definition.yaml
examples:
application/json:
data:
links:
self: https://api.osf.io/v2/users/q7fts/settings/identities/ORCID/
attributes:
status: VERFIED
external_id: '0000-0001-9143-4652'
id: ORCID
type: users
id: q7fts

43 changes: 43 additions & 0 deletions swagger-spec/users/external_identities_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
get:
summary: List all user's external identities
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, would suggest "List all external identities" (the summary for listing user preprints, for example, is "List all preprints")

description: >-
Retrieves a list of a user's external identities, currently this only includes their ORCID accounts.

The returned information includes the external identity's name, status and id.

#### Returns

Returns a JSON object with a `data` key containing the representation of the requested
external identities, if the request is successful.

If the request is unsuccessful, an `errors` key containing
information about the failure will be returned. Refer to the [list of error codes](#tag/Errors-and-Error-Codes)
to understand why this request may have failed.


parameters:
- in: path
type: string
name: user_id
required: true
description: 'The unique identifier of the user.'
tags:
- Users
operationId: external_identities_list
responses:
'200':
description: 'OK'
schema:
$ref: definition.yaml
examples:
application/json:
data:
- links:
self: https://api.osf.io/v2/users/q7fts/settings/identities/ORCID/
attributes:
status: VERFIED
external_id: '0000-0001-9143-4652'
id: ORCID
type: users
id: q7fts