Medigo second-opinions API

Professional review of a diagnosis or treatment already suggested by a doctor

OpenAPI Specification

medigo-second-opinions-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  description: 'Welcome to the official documentation for MEDIGO REST API. Your are seeing the documentation for **version 2**, the latest.

    [Click here](../v1/) for V1 documentation.


    ### Debug Info for Reporting Bugs


    If you need some support for the API usage or wish to report a bug in MEDIGO API, we include the additional `Trace-Id`

    header in every response that you should send along when interacting with MEDIGO support team.

    '
  version: 2.0.0
  title: MEDIGO attachments second-opinions API
  contact:
    name: the API Support
    email: itops@medigo.com
basePath: /v2
consumes:
- application/json
produces:
- application/json
tags:
- name: second-opinions
  description: Professional review of a diagnosis or treatment already suggested by a doctor
paths:
  /second-opinions:
    post:
      tags:
      - second-opinions
      summary: Create a Second Opinion request
      description: ''
      operationId: createSecondOpinion
      parameters:
      - in: body
        name: body
        description: New second opinion to be created
        schema:
          $ref: '#/definitions/SecondOpinion'
      security:
      - partner_token: []
      responses:
        201:
          description: The second opinion request was successfully created
          schema:
            $ref: '#/definitions/SecondOpinion'
  /second-opinions/{id}:
    get:
      tags:
      - second-opinions
      summary: Get a second opinion request
      description: ''
      operationId: getSecondOpinion
      parameters:
      - in: path
        name: id
        type: string
        required: true
        description: Id of second opinion to be fetched
      security:
      - partner_token: []
      responses:
        200:
          description: The second opinion request was found
          schema:
            $ref: '#/definitions/SecondOpinion'
    patch:
      tags:
      - second-opinions
      summary: Update a second opinion request
      description: "Please note the following:\n  - You only need to provide the updated fields, the previously input data will remain\n  - The response will contain the entire new state of the second opinion object\n"
      operationId: updateSecondOpinion
      parameters:
      - in: path
        name: id
        type: string
        required: true
        description: Id of second opinion to be updated
      - in: body
        name: body
        description: Partial Second opinion object to be updated
        schema:
          $ref: '#/definitions/SecondOpinion'
      security:
      - partner_token: []
      responses:
        200:
          description: The second opinion request was successfully updated
          schema:
            $ref: '#/definitions/SecondOpinion'
  /second-opinions/{id}/messages:
    post:
      tags:
      - second-opinions
      summary: Add a message to a second opinion request
      description: ''
      operationId: postSecondOpinionMessage
      parameters:
      - in: path
        name: id
        type: string
        required: true
        description: Id of related second opinion
      - in: body
        name: body
        description: New second opinion to be added. The direction should logically be set to outbound
        schema:
          $ref: '#/definitions/SecondOpinionMessage'
      security:
      - partner_token: []
      responses:
        201:
          description: The new message was added
          schema:
            $ref: '#/definitions/SecondOpinionMessage'
    get:
      tags:
      - second-opinions
      summary: List messages of a second opinion request
      description: ''
      operationId: listSecondOpinionMessages
      parameters:
      - in: path
        name: id
        type: string
        required: true
        description: Id of related second opinion
      security:
      - partner_token: []
      responses:
        200:
          description: 'Request was successful. Note that if the second opinion doesn''t have any messages, the status *200* will still be returned with an empty array in the body.

            '
          schema:
            type: array
            items:
              $ref: '#/definitions/SecondOpinionMessage'
  /second-opinions/{id}/attachments:
    get:
      tags:
      - second-opinions
      summary: List attachments of a second opinion request
      description: 'Use this endpoint to see a list of attachments''s **metadata**. If you want to download the actual files, see [download attachment](#/second-opinions/getSecondOpinionAttachmentContent) instead.

        '
      operationId: listSecondOpinionAttachments
      parameters:
      - in: path
        name: id
        type: string
        required: true
        description: Id of second opinion to be updated
      security:
      - partner_token: []
      responses:
        200:
          description: 'Request was successful. Note that if the second opinion doesn''t have any attachments, the status *200* will still be returned with an empty array in the body.

            '
          schema:
            type: array
            items:
              $ref: '#/definitions/Attachment'
  /second-opinions/{id}/attachments/{uuid}/content:
    get:
      tags:
      - second-opinions
      summary: Download second opinion attachments
      description: 'Use this endpoint to download an attachment. The content will be returned.

        **Caution**, this endpoint doesn''t return JSON but the raw file content (binary or text according to attachment''s MIME type)

        '
      operationId: getSecondOpinionAttachmentContent
      produces:
      - application/octet-stream
      parameters:
      - in: path
        name: id
        type: string
        required: true
        description: Id of second opinion object
      - in: path
        name: uuid
        type: string
        required: true
        description: UUID of the desired attachment
      security:
      - partner_token: []
      responses:
        200:
          description: File was found and data is sent.
          schema:
            type: file
definitions:
  Attachment:
    type: object
    properties:
      uuid:
        type: string
        format: uuid
        readOnly: true
        description: Generated attachment's UUID
        example: ead5dc24-e37f-4e2e82jss4db3f7574dd
      name:
        type: string
        description: File name
        example: my-attachment.pdf
      mime_type:
        type: string
        description: 'File''s [mime type](https://www.sitepoint.com/mime-types-complete-list/)

          only some types are allowed to be uploaded

          '
        example: application/pdf
      size:
        type: integer
        format: int64
        readOnly: true
        description: File size in bytes
        example: 57995
  SecondOpinion:
    type: object
    required:
    - email
    - name
    - condition
    properties:
      id:
        type: integer
        format: int64
        readOnly: true
      external_id:
        type: string
        description: Free reference usually related to consumer data
        example: '123'
      email:
        type: string
        format: email
        description: Patient's email
        example: john.doe@private.me
      name:
        type: string
        description: Patient's full name
        example: John Doe
      condition:
        type: string
        description: Description about the patient's condition
        example: I have been feeling terrible pain on my right foot for months
      sex:
        type: string
        description: Patient's sex
        enum:
        - female
        - male
        example: male
      birthdate:
        type: string
        format: date
        description: Patient's date of birth in `YYYY-MM-DD` format
        example: '1989-02-14'
      language:
        type: string
        description: Patient's language as a [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
        example: it
      phone_number:
        type: string
        description: Patient's phone number
      icd_code:
        type: string
        description: Optional [disease identifier](http://www.icd9data.com/)
        example: R51
      custom_fields:
        type: object
        description: Map of custom fields that you want to add to your request
        items:
          type: string
        example:
          my_custom_field: val
          my_other_field: another val
      payment_amount:
        type: number
        format: float
        description: Amount of money paid by the user
        example: 459.0
      payment_currency:
        type: string
        description: Payment currency (format [ISO 4217](https://www.iban.com/currency-codes.html))
        example: EUR
      status:
        type: string
        readOnly: true
        description: 'Current status of the second opinion request


          - *NEW*: Default value when a second opinion entity is created. The second opinion remains NEW until the first message is added to it

          - *PROCESSING*: MEDIGO is currently handling the case

          - *AWAITING*: MEDIGO is expecting some action from the partner. (eg providing more information)

          - *CLOSED*: The process has been entirely handled and no further changes are expected on the case


          Note that the status is **read-only**. It is not necessary to provide it when querying the API as only MEDIGO will update this field. It will however always be sent back as part of the response.

          '
        enum:
        - NEW
        - PROCESSING
        - AWAITING
        - CLOSED
  SecondOpinionMessage:
    type: object
    properties:
      id:
        type: string
        format: uuid
        readOnly: true
        description: Generated message UUID
        example: fasd823fdd44jksd-fesfjs-asfdh
      second_opinion_id:
        type: integer
        format: int64
        readOnly: true
        description: id of related second opinion object
      created_at:
        type: string
        format: date-time
        readOnly: true
        description: Date and time at which the message was created in [ISO 8601](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) format
        example: 2017-09-05T15:14.000Z
      direction:
        type: string
        enum:
        - inbound
        - outbound
        description: 'Can take two values: `inbound` if the message is sent to you, or `outbound` if you sent the message

          '
        example: outbound
      text:
        type: string
        description: Message content
        example: Do you think that hip replacement is the right thing to do?
      attachments:
        type: array
        description: A list of UUIDs of files uploaded along with the message. See [attachments](#/attachments)
        items:
          type: string
          format: uuid
        example:
        - fdsfds-afsdh-fasd823fdd44jksd
        - dsj23o-i83hs-53453gfddjsfsddf
securityDefinitions:
  partner_token:
    type: apiKey
    in: header
    name: Authorization
    description: "Authentication done is via an *API token* provided by MEDIGO. The token should be provided as a bearer in the *Authorization* header of every request\nNote that the string *Bearer* followed by a whitespace should be prepended to the token.\nExample:\n\n    GET /v2/ HTTP/1.1\n    Host: https://api.medigo.com\n    Authorization: Bearer <your-api-token>\n"