openapi: 3.0.3
info:
  title: Mass Observation Project COVID-19 Database API - OpenAPI 3.0
  description: |-
    <h4>Licence</h4>		<p>This database contains narratives written for the Mass-Observation Archive and to be used by those researching everyday life in Britain. The material is made available under a Creative Commons Attribution-Non Commercial 4.0 International (CC BY-NC 4.0) licence. Visit the Creative Common's website for more information [<a href="https://creativecommons.org/licenses/by-nc/4.0/">https://creativecommons.org/licenses/by-nc/4.0/</a>]. 		<p>By downloading these narratives, you are agreeing to uphold the nature of this licence. </p>		<p>The narratives may be used for non-commercial activities, such as teaching, student essays and private research as long as it is credited to the Mass-Observation Archive with the documents' reference. For all other usages please contact the Mass-Observation Archive for more details (<a href="mailto:moa@sussex.ac.uk">moa@sussex.ac.uk</a>). </p>		<p>Permission to use third-party material found in the documents needs to be sought separately.</p>		<br /> <p xmlns:cc="http://creativecommons.org/ns#" >This work is licensed under <a href="http://creativecommons.org/licenses/by-nc/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY-NC 4.0</a><br /><br /><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1"></p> 
  termsOfService: http://swagger.io/terms/
  contact:
    email: apiteam@swagger.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.11
externalDocs:
  description: Find out more about Swagger
  url: http://swagger.io
servers:
  - url: https://database.massobs.org.uk/api
tags:
  - name: Mass Obs COVID-19 Database
    description: Explore material collected by Mass Observation during the COVID-19 pandemic (2020-2021)
    externalDocs:
      description: Find out more
      url: https://database.massobs.org.uk
paths:
  /search/:
    get:
      tags:
        - search
      summary: Query the Database
      description: Returns an array of search results (you will have to use the filter function to get the search variables)
      operationId: getSearch
      parameters:
        - name: full_text
          in: query
          required: false
          description: Full Text Search
          schema:
            type: string
        - name: keywords
          in: query
          description: Keyword values that can be used for search
          required: false
          explode: true
          schema:
            type: string
        - name: type
          in: query
          description: type values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: collection
          in: query
          description: collection values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64  
        - name: code
          in: query
          description: code values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: region
          in: query
          description: region values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: gender
          in: query
          description: gender values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: marital_status
          in: query
          description: marital_status values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: employment_status
          in: query
          description: employment_status values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: birth_cohort
          in: query
          description: birth_cohort values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: yob
          in: query
          description: Year of Birth values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: date_joined
          in: query
          description: date_joined values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: living_arrangement
          in: query
          description: living_arrangement values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: religion
          in: query
          description: religion values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: sexuality
          in: query
          description: sexuality values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: disability
          in: query
          description: disability values that can be used for search
          required: false
          explode: true
          schema:
            type: integer
            format: int64
        - name: X-API-KEY
          in: header
          description: API Key
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search'          
            application/xml:
              schema:
                $ref: '#/components/schemas/Search'
        '400':
          description: Invalid tag value
      security:
        - api_key: []
  /filter/:
    get:
      tags:
        - filter
      summary: Get filter results
      description: Returns an array of your filter
      operationId: getFilter
      parameters:
        - name: filter
          in: query
          description: Status values that can be used for filter
          required: true
          explode: true
          schema:
            type: string
            enum:
              - keywords
              - type
              - collection
              - code
              - region
              - gender
              - marital_status
              - employment_status
              - birth_cohort
              - yob
              - date_joined
              - living_arrangement
              - religion
              - sexuality
              - disability
        - name: X-API-KEY
          in: header
          description: API Key
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Filter'          
            application/xml:
              schema:
                $ref: '#/components/schemas/Filter'
        '400':
          description: Invalid filter supplied
        '404':
          description: filter not found
      security:
        - api_key: []
components:
  schemas:
    Search:
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 136808
        PDF Download:
          type: string
          example: "https://database.massobs.org.uk/diaries_and_directives/SxMOA2_1_120_2_2_T7345.pdf"
        TXT Download:
          type: string
          example: "https://database.massobs.org.uk/diaries_and_directives/SxMOA2_1_120_2_2_T7345.txt"
        Archive_Ref:
          type: string
          example: "SxMOA2_1_120_2_2_T7345"
        Type_of_submission:
          type: string
          example: "Directive - Covid"
        Title_of_Collection:
          type: string
          example: "120: Autumn 2020: Everyday Health and Wellbeing"
        MO_Code:
          type: string
          example: "T7345"
        Keywords:
          type: string
          example: "COVID-19 pandemic (2020-);Lifestyle, health and well-being;Society and social behaviour;Health services and medical care;Pregnancy and early maternity;Family life;Schools;Adolescence;Reproductive health;Personal hygiene;Mental health;Personal appearance;Family members;Leisure time and social activities;"
        Response_Format:
          type: string
          example: "Digital;Word Processed;"
        employment_status:
          type: string
          example: "In compulsory education"
        birth_cohort:
          type: string
          example: "1910s"
        Physical_Description:
          type: string
          example: "Includes photograph of 'pebble calendar' made by observer's wife.;"
        Extent_in_pages:
          type: integer
          format: int64
          example: 7
        Language:
          type: string
          example: "eng"
        Date_Received:
          type: string
          example: "23/12/2020"
        Description:
          type: string
          example: "Response to the Mass-Observation Project Directive 'Everyday Health and Wellbeing'. Mass-Observer T7345 describes themself as 'a 36-year-old female living ... with my partner, our son and my partner's brother. I am a social worker by background, and currently work for a charity that trains graduates to work as mental health social workers.';The Directive 'Everyday Health and Wellbeing' was issued on 27 November 2020 and asked Mass-Observers about their opinions on and experiences of health and wellbeing, in particular 'health, wellbeing and the healthy body'; 'identity'; 'growing up and learning about health and wellbeing'; 'growing older'; 'health, wellbeing and appearance'; 'getting ready to leave the house'."
      xml:
        name: search
    Filter:
      required:
        - keyword
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 2
        value:
          type: string
          example: Directive - Covid
      xml:
        name: filter
    ApiResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
        type:
          type: string
        message:
          type: string
      xml:
        name: '##default'
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-KEY
      in: header
