Bureau of Consular Affairs Write API

Write actions (require API token).

OpenAPI Specification

bureau-of-consular-affairs-write-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CA Data Catalog (CKAN) Datastore Write API
  description: 'Best-effort OpenAPI 3.1 description of the Bureau of Consular Affairs (CA) Data Catalog

    API. The catalog runs on the standard CKAN platform, which exposes its functionality at

    `/api/3/action/{action_name}` using both GET and POST. CKAN actions are described in the

    CKAN Action API documentation.


    All CA Data Catalog actions are publicly readable; write actions require an `Authorization`

    header carrying a CKAN API token (obtained from the CKAN user profile).

    '
  version: '3.0'
  contact:
    name: Bureau of Consular Affairs
    url: https://cadatacatalog.state.gov/dataset/
  license:
    name: U.S. Government Work
    url: https://www.usa.gov/government-works
servers:
- url: https://cadatacatalog.state.gov/api/3
  description: CA Data Catalog CKAN Action API
tags:
- name: Write
  description: Write actions (require API token).
paths:
  /action/package_create:
    post:
      tags:
      - Write
      summary: Create a dataset (package)
      operationId: packageCreate
      security:
      - apiToken: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PackageResult'
  /action/package_update:
    post:
      tags:
      - Write
      summary: Update a dataset (package)
      operationId: packageUpdate
      security:
      - apiToken: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PackageResult'
  /action/package_delete:
    post:
      tags:
      - Write
      summary: Delete a dataset
      operationId: packageDelete
      security:
      - apiToken: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: string
      responses:
        '200':
          description: Deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessBoolean'
components:
  schemas:
    Resource:
      type: object
      properties:
        id:
          type: string
        package_id:
          type: string
        name:
          type: string
        description:
          type: string
        format:
          type: string
        url:
          type: string
        mimetype:
          type: string
        size:
          type: integer
        created:
          type: string
          format: date-time
        last_modified:
          type: string
          format: date-time
        datastore_active:
          type: boolean
        state:
          type: string
    Package:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        title:
          type: string
        notes:
          type: string
        author:
          type: string
        author_email:
          type: string
        maintainer:
          type: string
        maintainer_email:
          type: string
        license_id:
          type: string
        owner_org:
          type: string
        state:
          type: string
        type:
          type: string
        metadata_created:
          type: string
          format: date-time
        metadata_modified:
          type: string
          format: date-time
        tags:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              display_name:
                type: string
        groups:
          type: array
          items:
            type: object
        resources:
          type: array
          items:
            $ref: '#/components/schemas/Resource'
        extras:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              value:
                type: string
    PackageResult:
      type: object
      properties:
        help:
          type: string
        success:
          type: boolean
        result:
          $ref: '#/components/schemas/Package'
    SuccessBoolean:
      type: object
      properties:
        help:
          type: string
        success:
          type: boolean
        result:
          type: boolean
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: Authorization
      description: CKAN API token, generated from the CKAN user profile.