swagger: "2.0"
schemes:
  - https
host: schedule.import.io
basePath: /
info:
  title: import.io
  version: "1.0"
  x-apisguru-categories:
    - tools
  x-logo:
    backgroundColor: "#F6248E"
    url: http://api.docs.import.io/images/import-io-logo.svg
  x-origin:
    - format: swagger
      url: http://api.docs.import.io/schedule/swagger.json
      version: "2.0"
  x-providerName: import.io
  x-serviceName: schedule
externalDocs:
  url: http://api.docs.import.io/
consumes:
  - application/json
produces:
  - application/json;charset=UTF-8
securityDefinitions:
  api_key:
    in: query
    name: _apikey
    type: apiKey
tags:
  - description: APIs that exist on the run.import.io endpoint
    name: run
  - description: APIs that exist on the data.import.io endpoint
    name: data
  - description: APIs that exist on the extraction.import.io endpoint
    name: extraction
  - description: APIs that exist on the rss.import.io endpoint
    name: rss
  - description: APIs that exist on the store.import.io endpoint
    name: store
  - description: APIs that exist on the schedule.import.io endpoint
    name: schedule
  - description: APIs that exist on the api.import.io endpoint
    name: api
  - name: run.import.io
  - name: data.import.io
  - name: extraction.import.io
  - name: rss.import.io
  - name: store.import.io
  - name: schedule.import.io
  - name: api.import.io
paths:
  /extractor:
    get:
      responses:
        "200":
          description: array of crawl run schedules
          schema:
            $ref: "#/definitions/Schedule"
        "401":
          description: User doesn't have a valid session.
          schema:
            $ref: "#/definitions/APIError"
        "404":
          description: Unable to find supplied extractor ID.
          schema:
            $ref: "#/definitions/APIError"
      security:
        - api_key: []
      summary: Get the list of schedules for all your extractors
      tags:
        - schedule.import.io
    post:
      parameters:
        - description: Request body with the schema defined on the left. Interval is a cron string.
          in: body
          name: Schedule Request Body
          required: true
          schema:
            $ref: "#/definitions/ScheduleRequest"
      responses:
        "200":
          description: crawl run schedule
          schema:
            $ref: "#/definitions/Schedule"
        "400":
          description: Validation errors on the request input.
          schema:
            $ref: "#/definitions/APIError"
        "401":
          description: User doesn't own this extractor, or doesn't have a valid session.
          schema:
            $ref: "#/definitions/APIError"
        "403":
          description: User is not allowed to create schedule for this extractor.
          schema:
            $ref: "#/definitions/APIError"
        "404":
          description: Unable to find supplied extractor ID.
          schema:
            $ref: "#/definitions/APIError"
      security:
        - api_key: []
      summary: Schedule and extractor to run at a specific time
      tags:
        - schedule.import.io
  "/extractor/{extractorId}/":
    delete:
      parameters:
        - description: the id of the extractor with a schedule
          in: path
          name: extractorId
          required: true
          type: string
      responses:
        "200":
          description: Empty object
        "401":
          description: User doesn't have a valid session.
          schema:
            $ref: "#/definitions/APIError"
        "403":
          description: User is not allowed to delete this schedule.
          schema:
            $ref: "#/definitions/APIError"
        "404":
          description: Unable to find supplied extractor ID.
          schema:
            $ref: "#/definitions/APIError"
      security:
        - api_key: []
      summary: Delete an existing schedule
      tags:
        - schedule.import.io
    get:
      parameters:
        - description: the id of the extractor with a schedule
          in: path
          name: extractorId
          required: true
          type: string
      responses:
        "200":
          description: crawl run schedule
          schema:
            $ref: "#/definitions/Schedule"
      security:
        - api_key: []
      summary: Get the schedule of a particular extractor
      tags:
        - schedule.import.io
definitions:
  APIError:
    properties:
      code:
        description: Internal error code
        format: int
        type: integer
      error:
        description: (deprecated) A message containing a brief description of the error
        type: string
      message:
        description: A message containing a brief description of the error
        type: string
    type: object
  CrawlRun:
    properties:
      extractorId:
        type: string
      failedUrlCount:
        format: int32
        type: integer
      guid:
        type: string
      rowCount:
        format: int32
        type: integer
      runtimeConfigId:
        type: string
      startedAt:
        format: int64
        type: integer
      state:
        type: string
      stoppedAt:
        format: int64
        type: integer
      successUrlCount:
        format: int32
        type: integer
      totalUrlCount:
        format: int32
        type: integer
      urlListId:
        type: string
    type: object
  Inputs:
    properties:
      Example Input:
        type: string
      _url:
        type: string
    required:
      - _url
    type: object
  ObjectStoreSearchResult:
    properties:
      hits:
        properties:
          hits:
            items:
              properties:
                _id:
                  type: string
                _score:
                  type: integer
                _type:
                  type: string
                fields:
                  $ref: "#/definitions/CrawlRun"
              type: object
            type: array
          total:
            type: integer
        type: object
      timed_out:
        type: boolean
      took:
        type: integer
    type: object
  QueryResponse:
    properties:
      error:
        type: string
      exceptionType:
        type: string
      extractorData:
        type: object
      pageData:
        type: object
      runtimeConfigId:
        type: string
      sequenceNumber:
        format: int32
        type: integer
      timestamp:
        format: int64
        type: integer
      url:
        type: string
    type: object
  Report:
    properties:
      configId:
        type: string
      guid:
        type: string
      name:
        type: string
      published:
        type: boolean
      reportId:
        type: string
      status:
        type: string
      summary:
        type: object
      type:
        type: string
    type: object
  ReportRun:
    properties:
      autoPublish:
        type: boolean
      guid:
        type: string
      latestConfigId:
        type: string
      name:
        type: string
      type:
        type: string
    type: object
  Schedule:
    properties:
      extractorId:
        type: string
      interval:
        type: string
      intervalData:
        properties:
          minutes:
            type: string
          time:
            type: string
          type:
            type: string
        type: object
      nextRunAt:
        format: int64
        type: integer
      ownerId:
        type: string
      startTimestamp:
        format: int64
        type: integer
    type: object
  ScheduleRequest:
    properties:
      extractorId:
        example: 00000000-0000-0000-0000-000000000000
        type: string
      interval:
        example: 15 * * * *
        type: string
      startTimestamp:
        example: 1485448509727
        format: int64
        type: integer
    required:
      - extractorId
      - interval
    type: object
