swagger: '2.0'
info:
  version: '2.0'
  title: jurisdictions
consumes:
  - application/json
produces:
  - application/json
paths:
  /jurisdictions:
    get:
      tags:
        - jurisdictions
      description: Get a collection of jurisdictions.
      operationId: getJurisdictions
      parameters:
        - name: id
          in: query
          description: The unique ID for the jurisdiction.
          required: false
          type: integer
          format: int32
        - name: code
          in: query
          description: 'A code which, together with its storeId and subclass, uniquely identifies this jurisdiction.'
          required: false
          type: string
        - name: storeId
          in: query
          description: The reference number of the store this jurisdiction associated with.
          required: false
          type: integer
          format: int32
        - name: subclass
          in: query
          description: 'Indicates the jurisdiction types as follows: 1 = ShippingJurisdiction. 2 = TaxJurisdiction.'
          required: false
          type: integer
          format: int32
        - name: description
          in: query
          description: 'A brief description of the jurisdiction, suitable for display by a user interface that manages jurisdiction definitions.'
          required: false
          type: string
        - name: country
          in: query
          description: The country or region.
          required: false
          type: string
        - name: countryAbbreviation
          in: query
          description: An optional ISO standard abbreviation code for the country or region.
          required: false
          type: string
        - name: state
          in: query
          description: 'The state, province, or other equivalent region.'
          required: false
          type: string
        - name: stateAbbreviation
          in: query
          description: An optional country specific abbreviation code for the state or province.
          required: false
          type: string
        - name: city
          in: query
          description: The city or an equivalent.
          required: false
          type: string
        - name: district
          in: query
          description: The district or an equivalent.
          required: false
          type: string
        - name: county
          in: query
          description: The county or an equivalent.
          required: false
          type: string
        - name: zipcodeStart
          in: query
          description: The starting ZIP code or postal code of a range of ZIP codes or postal codes.
          required: false
          type: string
        - name: zipcodeEnd
          in: query
          description: The ending ZIP code or postal code of a range of ZIP codes or postal codes.
          required: false
          type: string
        - name: geoCode
          in: query
          description: A tax code that is based on geographic region. This code is used to support Taxware integration.
          required: false
          type: string
        - name: markForDelete
          in: query
          description: 'Indicates if this jurisdiction has been marked for deletion: 0 = No. 1 = Yes.'
          required: false
          type: integer
          format: int32
        - name: offset
          in: query
          description: The index of the first item to be returned.
          required: false
          type: integer
          format: int32
        - name: limit
          in: query
          description: The maximum number of items to be returned.
          required: false
          type: integer
          format: int32
        - name: fields
          in: query
          description: The fields to be returned.
          required: false
          type: string
        - name: expand
          in: query
          description: The related resources to be embedded.
          required: false
          type: string
      responses:
        '200':
          description: A collection of jurisdictions.
          schema:
            $ref: '#/definitions/JurisdictionCollection'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    post:
      tags:
        - jurisdictions
      description: Create a jurisdiction.
      operationId: createJurisdiction
      parameters:
        - in: body
          name: Jurisdiction
          description: 'Provides RESTful services to manage jurisdictions. Jurisdictions are geographical regions or zones that represent a country, region, province, territory, or ZIP code range in which you sell goods.'
          required: true
          schema:
            $ref: '#/definitions/Jurisdiction'
      responses:
        '201':
          description: The operation was successful.
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
  '/jurisdictions/{id}':
    get:
      tags:
        - jurisdictions
      description: Get a jurisdiction.
      operationId: getJurisdictionById
      parameters:
        - name: fields
          in: query
          description: The fields to be returned.
          required: false
          type: string
        - name: expand
          in: query
          description: The related resources to be embedded.
          required: false
          type: string
      responses:
        '200':
          description: 'Provides RESTful services to manage jurisdictions. Jurisdictions are geographical regions or zones that represent a country, region, province, territory, or ZIP code range in which you sell goods.'
          schema:
            $ref: '#/definitions/Jurisdiction'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '404':
          description: The resource was not found.
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    delete:
      tags:
        - jurisdictions
      description: Delete a jurisdiction.
      operationId: deleteJurisdictionById
      parameters: []
      responses:
        '204':
          description: The operation was successful.
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '404':
          description: The resource was not found.
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    patch:
      tags:
        - jurisdictions
      description: Update a jurisdiction.
      operationId: updateJurisdictionById
      parameters:
        - in: body
          name: Jurisdiction
          description: 'Provides RESTful services to manage jurisdictions. Jurisdictions are geographical regions or zones that represent a country, region, province, territory, or ZIP code range in which you sell goods.'
          required: true
          schema:
            $ref: '#/definitions/Jurisdiction'
      responses:
        '200':
          description: The operation was successful.
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '404':
          description: The resource was not found.
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    parameters:
      - name: id
        in: path
        description: The unique ID for the jurisdiction.
        required: true
        type: integer
        format: int32
  '/jurisdictions/{id}/jurisdiction-group-relationships':
    get:
      tags:
        - jurisdictions
      description: Finds the jurisdiction group relationships of a jusridiction.
      operationId: getJurisdictionGroupRelationshipsOfJurisdiction
      parameters:
        - name: offset
          in: query
          description: The index of the first item to be returned.
          required: false
          type: integer
          format: int32
        - name: limit
          in: query
          description: The maximum number of items to be returned.
          required: false
          type: integer
          format: int32
        - name: fields
          in: query
          description: The fields to be returned.
          required: false
          type: string
        - name: expand
          in: query
          description: The related resources to be embedded.
          required: false
          type: string
      responses:
        '200':
          description: A collection of jurisdiction group to jurisdiction relationship.
          schema:
            $ref: '#/definitions/JurisdictionGroupRelationshipCollection'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    parameters:
      - name: id
        in: path
        description: The unique ID for the jurisdiction.
        required: true
        type: integer
        format: int32
definitions:
  Link:
    type: object
    properties:
      href:
        type: string
        format: uri
  Error:
    type: object
    properties:
      code:
        type: string
      message:
        type: string
      messageKey:
        type: string
      messageArguments:
        type: array
        items:
          type: object
      correlationId:
        type: string
      locale:
        type: string
  ErrorResponseContainer:
    type: object
    properties:
      requestId:
        type: string
      errors:
        type: array
        items:
          $ref: '#/definitions/Error'
  Jurisdiction:
    type: object
    properties:
      id:
        type: integer
        format: int32
        description: The unique ID for the jurisdiction.
      code:
        type: string
        description: 'A code which, together with its storeId and subclass, uniquely identifies this jurisdiction.'
      storeId:
        type: integer
        format: int32
        description: The reference number of the store this jurisdiction associated with.
      subclass:
        type: integer
        format: int32
        description: 'Indicates the jurisdiction types as follows: 1 = ShippingJurisdiction. 2 = TaxJurisdiction.'
      description:
        type: string
        description: 'A brief description of the jurisdiction, suitable for display by a user interface that manages jurisdiction definitions.'
      country:
        type: string
        description: The country or region.
      countryAbbreviation:
        type: string
        description: An optional ISO standard abbreviation code for the country or region.
      state:
        type: string
        description: 'The state, province, or other equivalent region.'
      stateAbbreviation:
        type: string
        description: An optional country specific abbreviation code for the state or province.
      city:
        type: string
        description: The city or an equivalent.
      district:
        type: string
        description: The district or an equivalent.
      county:
        type: string
        description: The county or an equivalent.
      zipcodeStart:
        type: string
        description: The starting ZIP code or postal code of a range of ZIP codes or postal codes.
      zipcodeEnd:
        type: string
        description: The ending ZIP code or postal code of a range of ZIP codes or postal codes.
      geoCode:
        type: string
        description: A tax code that is based on geographic region. This code is used to support Taxware integration.
      markForDelete:
        type: integer
        format: int32
        description: 'Indicates if this jurisdiction has been marked for deletion: 0 = No. 1 = Yes.'
      links:
        type: object
        description: Links to related resources.
        properties:
          jurisdiction-group-relationships:
            type: object
            description: The jurisdiction group relationships of a jusridiction.
            properties:
              href:
                type: string
                description: The URL of the link.
    description: 'Provides RESTful services to manage jurisdictions. Jurisdictions are geographical regions or zones that represent a country, region, province, territory, or ZIP code range in which you sell goods.'
  JurisdictionCollection:
    type: object
    properties:
      count:
        type: integer
        format: int64
        description: The total number of items.
      items:
        type: array
        description: The items.
        items:
          $ref: '#/definitions/Jurisdiction'
    description: A collection of jurisdictions.
  JurisdictionGroupRelationship:
    type: object
    properties:
      jurisdictionId:
        type: integer
        format: int32
        description: The unique ID for the jurisdiction.
      jurisdictionGroupId:
        type: integer
        format: int32
        description: The unique ID for the jurisdiction group.
      subclass:
        type: integer
        format: int32
        description: 'The subclass of the jurisdiction and of the jurisdiction group should match as follows: 1 = ShippingJurisdiction[Group]. 2 = TaxJurisdiction[Group].'
      links:
        type: object
        description: Links to related resources.
        properties:
          jurisdiction-group:
            type: object
            description: The jurisdiction group.
            properties:
              href:
                type: string
                description: The URL of the link.
          jurisdiction:
            type: object
            description: The jurisdiction.
            properties:
              href:
                type: string
                description: The URL of the link.
    description: Relate jurisdiction groups to the jurisdictions that are inside them.
  JurisdictionGroupRelationshipCollection:
    type: object
    properties:
      count:
        type: integer
        format: int64
        description: The total number of items.
      items:
        type: array
        description: The items.
        items:
          $ref: '#/definitions/JurisdictionGroupRelationship'
    description: A collection of jurisdiction group to jurisdiction relationship.
