{
  "openapi": "3.0.4",
  "info": {
    "title": "Scale-up Data Service Api Reference",
    "description": "<p>API definition for the creation of web services to be consumed by Scale-up Suite<br/>This reference implementation uses an example service returning time zone information, but Data Services can return any data.</p><p>Use apikey <code>test-key-1</code> to get results. Use other keys or none to test api key validation.</p>",
    "version": "v1"
  },
  "paths": {
    "/v1/search": {
      "post": {
        "tags": [
          "DataService"
        ],
        "summary": "Search for items by text input",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchParameters"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchParameters"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SearchParameters"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              }
            }
          }
        }
      }
    },
    "/v1/fetch": {
      "post": {
        "tags": [
          "DataService"
        ],
        "summary": "Get items by ID",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FetchParameters"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/FetchParameters"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/FetchParameters"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/FetchResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FetchResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/FetchResult"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "FetchParameters": {
        "required": [
          "applicationId",
          "buildNumber",
          "clientId",
          "ids",
          "serviceIdentifier",
          "serviceVersionNumber",
          "userName"
        ],
        "type": "object",
        "properties": {
          "userName": {
            "minLength": 1,
            "type": "string",
            "description": "The user name/email address of the Scale-up Account of the user making the request",
            "example": "user@example.com"
          },
          "buildNumber": {
            "minLength": 1,
            "type": "string",
            "description": "Build Number of the Scale-up Suite or Numero client making the request",
            "example": "1.3.1b345"
          },
          "applicationId": {
            "minLength": 1,
            "type": "string",
            "description": "Executable name of the application from which the request is made (ReactionLab | EXCEL | WINWORD | POWERPOINT | OUTLOOK)",
            "example": "Excel"
          },
          "clientId": {
            "minLength": 1,
            "type": "string",
            "description": "Client context from which the request is made (Materials Search | Catalist)",
            "example": "Catalist"
          },
          "serviceIdentifier": {
            "minLength": 1,
            "type": "string",
            "description": "The service identifier as defined in the Scale-up Data Service listing. Can be used to make servcie distinctions in case the same endpoint is used for several data sets.",
            "example": "Example-Data-Service-123456"
          },
          "serviceVersionNumber": {
            "type": "number",
            "description": "The version number as defined in the Scale-up Data Service listing.",
            "format": "double",
            "example": 1.0
          },
          "dataServiceId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "dataServiceIdentifier": {
            "type": "string",
            "nullable": true
          },
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs ofthe items to be retrieved",
            "example": "[\"Europe/Dublin\", \"Pacific/Easter\"]"
          }
        },
        "additionalProperties": false
      },
      "FetchResult": {
        "required": [
          "items"
        ],
        "type": "object",
        "properties": {
          "errorMessage": {
            "type": "string",
            "description": "Error information, result will be treated as error if not null or empty",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemInfo"
            },
            "description": "List of  items"
          }
        },
        "additionalProperties": false
      },
      "ItemInfo": {
        "required": [
          "id",
          "properties"
        ],
        "type": "object",
        "properties": {
          "id": {
            "minLength": 1,
            "type": "string"
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemProperty"
            },
            "description": "List of property names and values"
          }
        },
        "additionalProperties": false
      },
      "ItemProperty": {
        "required": [
          "name",
          "value"
        ],
        "type": "object",
        "properties": {
          "name": {
            "minLength": 1,
            "type": "string",
            "description": "Property name"
          },
          "value": {
            "description": "Property value. Data type can be\n- numeric\n- bool\n- string\n- date-time string (internet format, a .NET fromatting string can be sepcified in \"Usage\") \n- base64 string representing a bitmap image as byte array (specify \"Image\" in the Usage property)\n- base64 string representing a chemcial structure file as byte array (specify \"Structure\" in the Usage property, supported formats: .cdxml, .cdx, .mol, .sdf, .rxn)\n- array"
          },
          "unit": {
            "type": "string",
            "description": "Unit of measure to be displayed, can be null or empty",
            "nullable": true
          },
          "usage": {
            "type": "string",
            "description": "Possible values (case sensitive):\n- null - The Value property will be treated as a simple value\n- \"Image\" - use for base64 strings that should be treated as general bitmap image\n- \"Structure\" - use for base64 strings that should be treated as chemical structure bitmap image\n- .NET date-time format - for date-time strings (e.g. (\"d\" for shortdate, \"D\" for long date etc.)",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SearchHeaderInfo": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "minLength": 1,
            "type": "string",
            "description": "Data Item Id, to be used for Fetch calls"
          },
          "structure": {
            "type": "string",
            "description": "Chemical structure to be displayed as thumb nail. Expected: base64 string, can be null or empty",
            "format": "byte",
            "nullable": true
          },
          "image": {
            "type": "string",
            "description": "Thumbnail image to be shown if no checmical structure is provided. Expected: base64 string, can be null or empty",
            "format": "byte",
            "nullable": true
          },
          "value1": {
            "type": "string",
            "description": "Column 1 value for search result (CAS Number for Materials services, can be null or empty)",
            "nullable": true
          },
          "value2": {
            "type": "string",
            "description": "Column 2 value for search result (Name for Materials services, can be null or empty)",
            "nullable": true
          },
          "value3": {
            "type": "string",
            "description": "Column 3 value for search result (Formula for Materials services, can be null or empty)",
            "nullable": true
          },
          "value4": {
            "type": "string",
            "description": "Column 4 value for search result (Long Name for Materials services, can be null or empty)",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "For Data Services of type \"Materials\" the Value properties must contain CAS Number, Name, Formula and Long Name in that order"
      },
      "SearchParameters": {
        "required": [
          "applicationId",
          "buildNumber",
          "clientId",
          "searchString",
          "serviceIdentifier",
          "serviceVersionNumber",
          "userName"
        ],
        "type": "object",
        "properties": {
          "userName": {
            "minLength": 1,
            "type": "string",
            "description": "The user name/email address of the Scale-up Account of the user making the request",
            "example": "user@example.com"
          },
          "buildNumber": {
            "minLength": 1,
            "type": "string",
            "description": "Build Number of the Scale-up Suite or Numero client making the request",
            "example": "1.3.1b345"
          },
          "applicationId": {
            "minLength": 1,
            "type": "string",
            "description": "Executable name of the application from which the request is made (ReactionLab | EXCEL | WINWORD | POWERPOINT | OUTLOOK)",
            "example": "Excel"
          },
          "clientId": {
            "minLength": 1,
            "type": "string",
            "description": "Client context from which the request is made (Materials Search | Catalist)",
            "example": "Catalist"
          },
          "serviceIdentifier": {
            "minLength": 1,
            "type": "string",
            "description": "The service identifier as defined in the Scale-up Data Service listing. Can be used to make servcie distinctions in case the same endpoint is used for several data sets.",
            "example": "Example-Data-Service-123456"
          },
          "serviceVersionNumber": {
            "type": "number",
            "description": "The version number as defined in the Scale-up Data Service listing.",
            "format": "double",
            "example": 1.0
          },
          "dataServiceId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "dataServiceIdentifier": {
            "type": "string",
            "nullable": true
          },
          "searchString": {
            "minLength": 1,
            "type": "string",
            "description": "Text to be searched",
            "example": "Dublin"
          }
        },
        "additionalProperties": false
      },
      "SearchResult": {
        "required": [
          "results"
        ],
        "type": "object",
        "properties": {
          "errorMessage": {
            "type": "string",
            "description": "Error information, result will be treated as error if not null or empty",
            "nullable": true
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchHeaderInfo"
            },
            "description": "List of search results"
          },
          "headerName1": {
            "type": "string",
            "description": "Column 1 header name for search result (CAS Number for Materials services, can be null or empty)",
            "nullable": true
          },
          "headerName2": {
            "type": "string",
            "description": "Column 2 header name for search result (Name for Materials services, can be null or empty)",
            "nullable": true
          },
          "headerName3": {
            "type": "string",
            "description": "Column 3 header name  for search result (Formula for Materials services, can be null or empty)",
            "nullable": true
          },
          "headerName4": {
            "type": "string",
            "description": "Column 4 header name  for search result (Long Name for Materials services, can be null or empty)",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "description": "Enter ApiKey test-key-1",
        "name": "API_KEY",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "ApiKey": [ ]
    }
  ],
  "tags": [
    {
      "name": "DataService"
    }
  ]
}