Skip to content

Instantly share code, notes, and snippets.

@tyanko1
Last active May 17, 2019 17:22
Show Gist options
  • Save tyanko1/bd015a7be1f165aa7c614db36a887092 to your computer and use it in GitHub Desktop.
Save tyanko1/bd015a7be1f165aa7c614db36a887092 to your computer and use it in GitHub Desktop.
Central Rest API updated
swagger: '2.0'
info:
title: Central Repository API
version: 1.0.0
description: API for interfacing with Maven Central
paths:
/groups:
get:
description: Returns groups for which the user has a role
produces:
- application/json
parameters:
- in: query
name: loadmembers
description: The boolean value to indicate whether to load members as part of the group record.
type: boolean
responses:
'200':
description: array of groups
schema:
$ref: '#/definitions/Groups'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
post:
description: Creates the organization by the groupId provided.
consumes:
- application/json
parameters:
- in: body
name: body
schema:
type: object
required:
- name
properties:
groupId:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
responses:
'201':
description: organization
schema:
$ref: '#/definitions/Group'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'/groups/{groupId}':
get:
description: Returns a single group by id
parameters:
- in: path
name: groupId
required: true
description: The unique identifier of the group.
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
responses:
'200':
description: organization
schema:
$ref: '#/definitions/Group'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
put:
description: Updates the organization's name or image.
consumes:
- application/json
parameters:
- in: path
name: groupId
required: true
description: The guid of the organization resource to update.
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
- in: body
name: name
schema:
type: object
properties:
name:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
image:
type: string
format: uri
minLength: 2
maxLength: 250
responses:
'200':
description: organization
schema:
$ref: '#/definitions/Group'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
/users/me:
get:
description: Returns profile information for the current user.
responses:
'200':
description: User
schema:
$ref: '#/definitions/User'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
put:
description: Returns profile information for the current user.
consumes:
- application/json
parameters:
- in: body
name: body
schema:
type: object
properties:
firstName:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
lastName:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
email:
type: string
format: email
minLength: 2
maxLength: 250
image:
type: string
format: uri
minLength: 2
maxLength: 250
responses:
'200':
description: User
schema:
$ref: '#/definitions/User'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'/groups/{groupId}/members':
post:
description: Adds a user to an groupId and assigns them a role of member.
parameters:
- in: path
name: groupId
required: true
description: The groupId resource to update.
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
- in: body
name: body
schema:
type: object
properties:
email:
type: string
format: email
minLength: 2
maxLength: 250
responses:
'200':
description: Member
schema:
$ref: '#/definitions/GroupMember'
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
'/groups/{groupId}/members/{userName}':
put:
description: Updates a member role's status or role for an organization.
parameters:
- in: path
name: groupId
required: true
description: The guid of the organization.
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
- in: path
name: userName
required: true
description: The guid of the user.
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
- in: body
name: body
schema:
type: object
properties:
status:
type: integer
enum:
- 0
- 1
- 2
role:
type: string
enum:
- admin
- owner
- member
responses:
'204':
description: The member role was updated successfully.
'304':
description: The member role failed to update.
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
delete:
description: Removes a member from an organization.
parameters:
- in: path
name: groupId
required: true
description: The guid of the organization.
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
- in: path
name: userName
required: true
description: The guid of the user.
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
responses:
'204':
description: The member role was deleted successfully.
'304':
description: The member role failed to delete.
'400':
$ref: '#/definitions/BadRequestError'
'401':
$ref: '#/definitions/Unauthorized'
'403':
$ref: '#/definitions/Forbidden'
'404':
$ref: '#/definitions/NotFound'
definitions:
ErrorResponse:
type: object
required:
- message
properties:
errors:
type: array
items:
$ref: '#/definitions/Error'
message:
type: string
Error:
type: object
required:
- code
properties:
resource:
type: string
field:
type: string
code:
type: string
message:
type: string
Group:
required:
- groupId
properties:
groupId:
type: string
image:
type: string
role:
type: string
status:
type: integer
provisioningStatus:
type: string
enum:
- new
- validating
- validated
- provisioning
- enabled
- disabled
members:
type: array
items:
$ref: '#/definitions/GroupMember'
Groups:
type: object
required:
- groups
properties:
groups:
type: array
items:
$ref: '#/definitions/Group'
GroupMember:
type: object
properties:
email:
type: string
firstName:
type: string
lastName:
type: string
username:
type: string
provisioningStatus:
type: string
enum:
- new
- provisioning
- enabled
- disabled
example: new
User:
type: object
required:
- email
- firstName
- lastName
- username
properties:
email:
type: string
firstName:
type: string
lastName:
type: string
username:
type: string
image:
type: string
role:
type: string
status:
type: integer
groups:
type: array
items:
$ref: '#/definitions/Group'
Unauthorized:
description: Unauthorized
allOf:
- $ref: '#/definitions/ErrorResponse'
BadRequestError:
description: Bad Request
allOf:
- $ref: '#/definitions/ErrorResponse'
ConflictError:
description: Conflict
allOf:
- $ref: '#/definitions/ErrorResponse'
Forbidden:
description: Forbidden
allOf:
- $ref: '#/definitions/ErrorResponse'
InternalServerError:
description: Internal Server Error
allOf:
- $ref: '#/definitions/ErrorResponse'
NotFound:
description: Not Found
allOf:
- $ref: '#/definitions/ErrorResponse'
tags: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment