RWTH Aachen University SelfApiToken API

Endpoints for the api tokens of a user.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

rwth-aachen-university-selfapitoken-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Coscine Web Admin SelfApiToken API
  description: Coscine (short for <b>CO</b>llaborative <b>SC</b>ientific <b>IN</b>tegration <b>E</b>nvironment) is the research data management platform for your research project.
  termsOfService: https://about.coscine.de/en/termsofuse/
  contact:
    name: Coscine Team
    email: servicedesk@rwth-aachen.de
  version: '2.0'
servers:
- url: https://coscine.rwth-aachen.de/coscine
security:
- Bearer: []
tags:
- name: SelfApiToken
  description: Endpoints for the api tokens of a user.
paths:
  /api/v2/self/api-tokens/{apiTokenId}:
    get:
      tags:
      - SelfApiToken
      summary: Retrieves an API token for the current authenticated user.
      operationId: GetApiToken
      parameters:
      - name: apiTokenId
        in: path
        description: The ID of the token.
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Returns the API token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTokenDtoResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ApiTokenDtoResponse'
        '404':
          description: API token does not exist.
    delete:
      tags:
      - SelfApiToken
      summary: Revokes an API token for the current authenticated user.
      operationId: RevokeToken
      parameters:
      - name: apiTokenId
        in: path
        description: The ID of the token.
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '204':
          description: API token revoked/deleted.
        '400':
          description: Provided input has a bad format.
        '404':
          description: Provided input refers to entries that do not exist or have been deleted.
  /api/v2/self/api-tokens:
    get:
      tags:
      - SelfApiToken
      summary: Retrieves all API tokens for the current authenticated user.
      operationId: GetAllApiTokens
      parameters:
      - name: PageNumber
        in: query
        description: Gets or sets the desired page number. Should be greater than or equal to 1. Default is 1.
        schema:
          type: integer
          format: int32
      - name: PageSize
        in: query
        description: Gets or sets the desired page size. Should be between 1 and the maximum allowed page size (50). Default is 10.
        schema:
          type: integer
          format: int32
      - name: OrderBy
        in: query
        description: "Gets or sets the field name used for ordering the results.\r\nThe order is constructed by an order string.\r\nUse the property followed by \"asc\" or \"desc\" and separate properties by commas. Default is asc.\r\nCan be used like this: \"propertyA asc, propertyB desc\"."
        schema:
          type: string
      responses:
        '200':
          description: Returns the API tokens of the current user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTokenDtoPagedResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ApiTokenDtoPagedResponse'
    post:
      tags:
      - SelfApiToken
      summary: Creates an API token for the current authenticated user.
      operationId: CreateApiToken
      requestBody:
        description: The API token data for creation.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiTokenForCreationDto'
          text/json:
            schema:
              $ref: '#/components/schemas/ApiTokenForCreationDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ApiTokenForCreationDto'
      responses:
        '201':
          description: API token created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTokenDtoResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/ApiTokenDtoResponse'
        '400':
          description: Provided input has a bad format.
        '404':
          description: Provided input refers to entries that do not exist or have been deleted.
    options:
      tags:
      - SelfApiToken
      summary: Responds with the HTTP methods allowed for the endpoint.
      responses:
        '200':
          description: OK
components:
  schemas:
    ApiTokenDtoResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ApiTokenDto'
        isSuccess:
          type: boolean
          readOnly: true
        statusCode:
          type: integer
          format: int32
          nullable: true
        traceId:
          type: string
          nullable: true
      additionalProperties: false
    ApiTokenDto:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the API token.
          format: uuid
        name:
          type: string
          description: The name associated with the API token.
        creationDate:
          type: string
          description: The date when the API token was created.
          format: date-time
        expiryDate:
          type: string
          description: The expiry date of the API token.
          format: date-time
        token:
          type: string
          description: The actual token used for authentication.
          nullable: true
        owner:
          $ref: '#/components/schemas/UserMinimalDto'
      additionalProperties: false
      description: Represents an API token used for authentication.
    Pagination:
      type: object
      properties:
        currentPage:
          type: integer
          description: Gets or sets the current page number.
          format: int32
        totalPages:
          type: integer
          description: Gets or sets the total number of pages.
          format: int32
        pageSize:
          type: integer
          description: Gets or sets the number of items per page.
          format: int32
        totalCount:
          type: integer
          description: Gets or sets the total count of items across all pages.
          format: int64
        hasPrevious:
          type: boolean
          description: Gets a value indicating whether there is a previous page.
          readOnly: true
        hasNext:
          type: boolean
          description: Gets a value indicating whether there is a next page.
          readOnly: true
      additionalProperties: false
      description: Represents pagination information for a collection of items.
    ApiTokenForCreationDto:
      required:
      - expiresInDays
      - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
          description: Gets or sets the name of the API token.
        expiresInDays:
          maximum: 370
          minimum: 1
          type: integer
          description: Gets or sets the expiration duration of the token in days.
          format: int32
      additionalProperties: false
      description: Data transfer object (DTO) representing the creation of an API token.
    UserMinimalDto:
      required:
      - id
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for the user.
          format: uuid
      additionalProperties: false
      description: Represents a minimal Data Transfer Object (DTO) for user information.
    ApiTokenDtoPagedResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ApiTokenDto'
          nullable: true
        isSuccess:
          type: boolean
          readOnly: true
        statusCode:
          type: integer
          format: int32
          nullable: true
        traceId:
          type: string
          nullable: true
        pagination:
          $ref: '#/components/schemas/Pagination'
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: apiKey
      description: JWT Authorization header using the Bearer scheme.
      name: Authorization
      in: header