swagger: "2.0"
info:
  description: "This service and API endpoint provides customers means to upload files (CSV, XLS and XLSX) to Simployer Employee Surveys to be used in e.g. automated processing, for example for providing user & organization data to us for import into Simployer Employee Surveys. The upload service is available as an API (allowing files to be uploaded and listed via REST/HTTPS), or as an Secure FTP (SFTP - also allowing only file upload and listing, not retrieve of data). Both means of transferring data to Simployer Employee Surveys is encrypted and secure. Note that the service only allows uploading and listing files, not downloading files (meaning even someone that would get access to the credentials used to upload files would not be able to download the data, which reduces potential issues with GDPR in use of this specific service). The hostname/base URL is the same for both endpoints: upload.api.andfrankly.com. <br><br>For SFTP access, log in to upload.api.andfrankly.com (port 22) using an API token as password and username as specified on the Accounts => API Access page in your Simployer Employee Surveys account. If you cannot connect, it may be because you need to allow SFTP traffic in your firewalls, and/or that you need to whitelist your sending IP-adresses in Simployer Employee Surveys. Contact help@andfrankly.com for more information if you are having troubles connecting.<br><br>The below documentation provides details for the HTTPS API endpoint. <br><br>The OpenAPI/Swagger definition of this API is avalable <a href='../swagger.yml'>here</a>."
  version: "0.1"
  title: "Simployer Employee Surveys upload API & service"
  contact:
    email: "help@andfrankly.com"
host: "upload.api.andfrankly.com"
tags:
- name: "File upload"
schemes:
- "https"
paths:
  /v1/storage/uploadFile:
    post:
      tags: 
      - "File upload"
      description: "Uploads a file to our secure storage area"
      consumes:
        - multipart/form-data
      produces:
        - text/plain
        - "application/json"
      parameters:
        - in: formData
          name: file
          type: file
          description: "The file to upload. Max file size 10Mb, allowed file formats: CSV, XLS, XLSX."
      responses:
        200:
          description: "Successful upload (text/plain)"
          schema:
            type: string
            description: "The name of the file uploaded (text/plain)"
            example: file.csv
        400:
          description: "Invalid token, Not allowed IP address (no response, text/plain) or error processing the file (JSON response explaining the error, application/json)"
          schema:
            type: object
            properties:
              details:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      example: "file validation"
                    message:
                      type: string
                      example: "Too big file"
              id:
                type: string
                example: "82d83de3-0c6a-441b-9158-9d7de686fdc4"
              message:
                type: string
                example: "Incorrect file size"
              
              
  /v1/storage/files:
    get:
      tags: 
      - "File upload"
      description: "List all files currently uploaded"
      produces:
      - "application/json"
      consumes:
      - "application/json"
      responses:
        200:
          description: "List of all files (by name) currently on the file area"
          schema:
            type: "array"
            items: 
              type: string
              example: "file.csv"
              description: "List of filenames"
        400:
          description: "Invalid token or not allowed IP address"          
securityDefinitions:
  api_key:
    type: "apiKey"
    name: "Authorization"
    in: "header"

        