swagger: '2.0'
info:
  version: '2.0'
  title: addresses
consumes:
  - application/json
produces:
  - application/json
paths:
  /addresses:
    get:
      tags:
        - addresses
      description: Get a collection of addresses.
      operationId: getAddresses
      parameters:
        - name: id
          in: query
          description: The unique numeric ID for identifying the address.
          required: false
          type: integer
          format: int64
        - name: address1
          in: query
          description: The first address line of the street address.
          required: false
          type: string
        - name: address2
          in: query
          description: The second address line of the street address.
          required: false
          type: string
        - name: address3
          in: query
          description: The third address line of the street address.
          required: false
          type: string
        - name: addressType
          in: query
          description: 'The usage of the address. Available values:\n  SB - The address is used both as a shipping and a billing address.\n  S - The address is used as a shipping address.\n  B - The address is used as a billing address.'
          required: false
          type: string
        - name: bestCallingTime
          in: query
          description: 'Indicates the preferred time of day when the user is to be contacted. Available values:\n  D - Daytime.\n  E - Evening.'
          required: false
          type: string
        - name: billingCode
          in: query
          description: A code to identify the shipping or billing information.
          required: false
          type: string
        - name: billingCodeType
          in: query
          description: The code for identifying the system or method of code structure that is used for billing.
          required: false
          type: string
        - name: businessTitle
          in: query
          description: 'The business title for the user, such as a Manager or Chief Executive Officer.'
          required: false
          type: string
        - name: city
          in: query
          description: The name of the city where the user or organization resides.
          required: false
          type: string
        - name: country
          in: query
          description: The name of the country or region where the user or organization resides.
          required: false
          type: string
        - name: createdDateTime
          in: query
          description: The date and time that the address was created.
          required: false
          type: string
          format: date-time
        - name: email1
          in: query
          description: The primary e-mail.
          required: false
          type: string
        - name: email2
          in: query
          description: The secondary e-mail.
          required: false
          type: string
        - name: fax1
          in: query
          description: The primary facsimile number.
          required: false
          type: string
        - name: fax2
          in: query
          description: The secondary facsimile number.
          required: false
          type: string
        - name: field1
          in: query
          description: A customizable field.
          required: false
          type: string
        - name: field2
          in: query
          description: A customizable field.
          required: false
          type: string
        - name: field3
          in: query
          description: A customizable field.
          required: false
          type: string
        - name: firstName
          in: query
          description: The first name of the user.
          required: false
          type: string
        - name: lastName
          in: query
          description: The last name of the user.
          required: false
          type: string
        - name: memberId
          in: query
          description: 'The unique numeric ID for identifying the member that this address belongs to. A member can be can be an organization or a user. If memberId is not specified, then the default is the current user (the user who is logging on).'
          required: false
          type: integer
          format: int64
        - name: middleName
          in: query
          description: The middle name or initial of the user.
          required: false
          type: string
        - name: mobilePhone1
          in: query
          description: 'The primary mobile device number of the user, used for text messaging. The number should be specified without the country code. The country code is specified as the mobilePhone1Country value.'
          required: false
          type: string
        - name: mobilePhone1Country
          in: query
          description: The country code of the mobile device phone number. This country is used for country code resolution when sending text messages. This data is required when the mobilePhone1 column is used.
          required: false
          type: string
        - name: nickName
          in: query
          description: The unique name or identifier for the address. A nickname must be unique among the addresses for a specific user or organization. The nickname for a user's address must also be different than the logon ID for a user so that the address does not conflict with the user's self-address. The self-address is created when the account for the user is first created. Multiple users or organizations can each have an address with the same nickname.
          required: false
          type: string
        - name: officeAddress
          in: query
          description: 'The internal office address line, such as the internal designation for an employee''s desk location.'
          required: false
          type: string
        - name: organizationName
          in: query
          description: 'The name of the organization to which the address information applies, if this is a business address.'
          required: false
          type: string
        - name: organizationUnitName
          in: query
          description: 'The name of the organizational unit to which the address information applies, if this is a business address.'
          required: false
          type: string
        - name: packageSuppression
          in: query
          description: 'Specifies whether or not to include package inserts. Available values:\n  1 - Include.\n  0 - Do not include.'
          required: false
          type: integer
          format: int32
        - name: personTitle
          in: query
          description: 'The personal title of the user that is associated with the address. For example, Dr., Rev., Mr. or Ms.'
          required: false
          type: string
        - name: phone1
          in: query
          description: The primary phone number.
          required: false
          type: string
        - name: phone1Type
          in: query
          description: 'The type of phone that is used for the primary phone number. For example, TTY for hearing impaired, PCM for pulse-coded modulation, or CEL for mobile.'
          required: false
          type: string
        - name: phone2
          in: query
          description: The secondary phone number.
          required: false
          type: string
        - name: phone2Type
          in: query
          description: 'The type of phone that is used for the secondary phone number. For example, TTY for hearing impaired, PCM for pulse-coded modulation, or CEL for mobile.'
          required: false
          type: string
        - name: primary
          in: query
          description: 'Indicates that the address is the primary address for the user or organization when the user or organization has multiple addresses associated, such as when a user or organization has multiple shipping addresses. Available values:\n  1 - The address is the primary address.\n  0 - (Default value) The address is an alternate address.'
          required: false
          type: integer
          format: int32
        - name: publishPhone1
          in: query
          description: 'Whether to list the primary phone number. Available values: 1 - Yes, 0 - No.'
          required: false
          type: integer
          format: int32
        - name: publishPhone2
          in: query
          description: 'Whether to list the secondary phone number. Available values: 1 - Yes, 0 - No.'
          required: false
          type: integer
          format: int32
        - name: selfAddress
          in: query
          description: 'Indicates whether the address is associated with the registration of the user or organization. This value cannot be edited after address creation. Available values: 1 - Yes, 0 - No.'
          required: false
          type: integer
          format: int32
        - name: shippingGeoCode
          in: query
          description: The geographical code that identifies a region for the shipping purposes.
          required: false
          type: string
        - name: state
          in: query
          description: 'The name of the state, province, or equivalent where the user or organization resides.'
          required: false
          type: string
        - name: status
          in: query
          description: 'Indicates the status of the address. When an address is created, its status is marked with a \"P\", meaning \"permanent\", and indicates that the address is the current address. When an address is updated, a new record of the address is created with the updates. The new record is marked with a \"P\" and the earlier record is marked with a \"T\", meaning \"temporary\", and indicates that the address is the historical address. This value cannot be edited.'
          required: false
          type: string
        - name: taxGeoCode
          in: query
          description: The geographical tax code that identifies a region for the tax purposes.
          required: false
          type: string
        - name: zipCode
          in: query
          description: The ZIP or postal code of the address.
          required: false
          type: string
        - name: offset
          in: query
          description: 'The position within the resulting dataset where the query begins returning item records. If the offset is "5", the records that returned begin with the sixth record that matches the query parameters. If the offset is "0", the records that are returned begin with the first record that matches the query parameters.'
          required: false
          type: integer
          format: int32
        - name: limit
          in: query
          description: The maximum number of records to return.
          required: false
          type: integer
          format: int32
        - name: fields
          in: query
          description: 'The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.'
          required: false
          type: string
        - name: expand
          in: query
          description: 'The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.'
          required: false
          type: string
        - name: sort
          in: query
          description: 'The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.'
          required: false
          type: string
      responses:
        '200':
          description: A collection of addresses.
          schema:
            $ref: '#/definitions/AddressCollection'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    post:
      tags:
        - addresses
      description: Create an address.
      operationId: createAddress
      parameters:
        - in: body
          name: Address
          description: The addresses of users and organizations. An address can be the a user's own address or alternative address that is used for billing or shipping purposes.
          required: true
          schema:
            $ref: '#/definitions/Address'
      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'
  '/addresses/{id}':
    get:
      tags:
        - addresses
      description: Get an address by ID.
      operationId: getAddressById
      parameters:
        - name: fields
          in: query
          description: 'The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.'
          required: false
          type: string
        - name: expand
          in: query
          description: 'The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.'
          required: false
          type: string
        - name: sort
          in: query
          description: 'The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.'
          required: false
          type: string
      responses:
        '200':
          description: The addresses of users and organizations. An address can be the a user's own address or alternative address that is used for billing or shipping purposes.
          schema:
            $ref: '#/definitions/Address'
        '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:
        - addresses
      description: Delete an address.
      operationId: deleteAddressById
      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:
        - addresses
      description: Update an address.
      operationId: updateAddressById
      parameters:
        - in: body
          name: Address
          description: The addresses of users and organizations. An address can be the a user's own address or alternative address that is used for billing or shipping purposes.
          required: true
          schema:
            $ref: '#/definitions/Address'
      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 numeric ID for identifying the address.
        required: true
        type: integer
        format: int64
definitions:
  Link:
    type: object
    properties:
      href:
        type: string
        format: uri
        description: The URL of the link.
    description: Links to related resources.
  Error:
    type: object
    properties:
      code:
        type: string
        description: The error message code.
      message:
        type: string
        description: The error message.
      messageKey:
        type: string
        description: The error message key.
      messageArguments:
        type: array
        description: The arguments used to construct the error message.
        items:
          type: object
      correlationId:
        type: string
        description: The unique identifier for the request.
      locale:
        type: string
        description: The locale of the error message.
    description: The error message item model.
  ErrorResponseContainer:
    type: object
    properties:
      requestId:
        type: string
        description: The request identifier.
      errors:
        type: array
        description: The errors.
        items:
          $ref: '#/definitions/Error'
    description: The error message model.
  Address:
    type: object
    properties:
      id:
        type: integer
        format: int64
        description: The unique numeric ID for identifying the address.
      address1:
        type: string
        description: The first address line of the street address.
      address2:
        type: string
        description: The second address line of the street address.
      address3:
        type: string
        description: The third address line of the street address.
      addressType:
        type: string
        description: 'The usage of the address. Available values:\n  SB - The address is used both as a shipping and a billing address.\n  S - The address is used as a shipping address.\n  B - The address is used as a billing address.'
      bestCallingTime:
        type: string
        description: 'Indicates the preferred time of day when the user is to be contacted. Available values:\n  D - Daytime.\n  E - Evening.'
      billingCode:
        type: string
        description: A code to identify the shipping or billing information.
      billingCodeType:
        type: string
        description: The code for identifying the system or method of code structure that is used for billing.
      businessTitle:
        type: string
        description: 'The business title for the user, such as a Manager or Chief Executive Officer.'
      city:
        type: string
        description: The name of the city where the user or organization resides.
      country:
        type: string
        description: The name of the country or region where the user or organization resides.
      createdDateTime:
        type: string
        format: date-time
        description: The date and time that the address was created.
      email1:
        type: string
        description: The primary e-mail.
      email2:
        type: string
        description: The secondary e-mail.
      fax1:
        type: string
        description: The primary facsimile number.
      fax2:
        type: string
        description: The secondary facsimile number.
      field1:
        type: string
        description: A customizable field.
      field2:
        type: string
        description: A customizable field.
      field3:
        type: string
        description: A customizable field.
      firstName:
        type: string
        description: The first name of the user.
      lastName:
        type: string
        description: The last name of the user.
      memberId:
        type: integer
        format: int64
        description: 'The unique numeric ID for identifying the member that this address belongs to. A member can be can be an organization or a user. If memberId is not specified, then the default is the current user (the user who is logging on).'
      middleName:
        type: string
        description: The middle name or initial of the user.
      mobilePhone1:
        type: string
        description: 'The primary mobile device number of the user, used for text messaging. The number should be specified without the country code. The country code is specified as the mobilePhone1Country value.'
      mobilePhone1Country:
        type: string
        description: The country code of the mobile device phone number. This country is used for country code resolution when sending text messages. This data is required when the mobilePhone1 column is used.
      nickName:
        type: string
        description: The unique name or identifier for the address. A nickname must be unique among the addresses for a specific user or organization. The nickname for a user's address must also be different than the logon ID for a user so that the address does not conflict with the user's self-address. The self-address is created when the account for the user is first created. Multiple users or organizations can each have an address with the same nickname.
      officeAddress:
        type: string
        description: 'The internal office address line, such as the internal designation for an employee''s desk location.'
      organizationName:
        type: string
        description: 'The name of the organization to which the address information applies, if this is a business address.'
      organizationUnitName:
        type: string
        description: 'The name of the organizational unit to which the address information applies, if this is a business address.'
      packageSuppression:
        type: integer
        format: int32
        description: 'Specifies whether or not to include package inserts. Available values:\n  1 - Include.\n  0 - Do not include.'
      personTitle:
        type: string
        description: 'The personal title of the user that is associated with the address. For example, Dr., Rev., Mr. or Ms.'
      phone1:
        type: string
        description: The primary phone number.
      phone1Type:
        type: string
        description: 'The type of phone that is used for the primary phone number. For example, TTY for hearing impaired, PCM for pulse-coded modulation, or CEL for mobile.'
      phone2:
        type: string
        description: The secondary phone number.
      phone2Type:
        type: string
        description: 'The type of phone that is used for the secondary phone number. For example, TTY for hearing impaired, PCM for pulse-coded modulation, or CEL for mobile.'
      primary:
        type: integer
        format: int32
        description: 'Indicates that the address is the primary address for the user or organization when the user or organization has multiple addresses associated, such as when a user or organization has multiple shipping addresses. Available values:\n  1 - The address is the primary address.\n  0 - (Default value) The address is an alternate address.'
      publishPhone1:
        type: integer
        format: int32
        description: 'Whether to list the primary phone number. Available values: 1 - Yes, 0 - No.'
      publishPhone2:
        type: integer
        format: int32
        description: 'Whether to list the secondary phone number. Available values: 1 - Yes, 0 - No.'
      selfAddress:
        type: integer
        format: int32
        description: 'Indicates whether the address is associated with the registration of the user or organization. This value cannot be edited after address creation. Available values: 1 - Yes, 0 - No.'
      shippingGeoCode:
        type: string
        description: The geographical code that identifies a region for the shipping purposes.
      state:
        type: string
        description: 'The name of the state, province, or equivalent where the user or organization resides.'
      status:
        type: string
        description: 'Indicates the status of the address. When an address is created, its status is marked with a \"P\", meaning \"permanent\", and indicates that the address is the current address. When an address is updated, a new record of the address is created with the updates. The new record is marked with a \"P\" and the earlier record is marked with a \"T\", meaning \"temporary\", and indicates that the address is the historical address. This value cannot be edited.'
      taxGeoCode:
        type: string
        description: The geographical tax code that identifies a region for the tax purposes.
      zipCode:
        type: string
        description: The ZIP or postal code of the address.
    description: The addresses of users and organizations. An address can be the a user's own address or alternative address that is used for billing or shipping purposes.
  AddressCollection:
    type: object
    properties:
      count:
        type: integer
        format: int64
        description: The total number of items.
      items:
        type: array
        description: The items.
        items:
          $ref: '#/definitions/Address'
    description: A collection of addresses.
