used differnet section for the new and old way of requesting VASes, updated the text

#%RAML 0.8
---
title: Booking API
baseUri: https://api.bring.com/booking/api

documentation:
- title: Introduction
  content: |
      The Bring Booking API is a logged-in service that lets Mybring users (customers of Mybring) programatically create a booking by invoking a Web Service over SOAP or by posting XML/JSON over HTTP. The API uses the same backend as [Mybring Booking](https://www.mybring.com/booking/) and the same PDF labels.

      We support two types of integration with the Booking API. XML/JSON over HTTP and SOAP (over HTTP).

      Booking uses Shipping Guide as the source for price and availability for the different products. We advise clients of the Booking API to use [Shipping Guide API](/api/shipping-guide_2/) for getting the list price and checking availability before sending a booking request. Note that invoice payment is the only available payment option for the Booking API. This means that the Mybring user ID used in the booking request must have access to the customer number specified as payer of the booking.

- title: Versioning strategy
  content: |
      Each request has a `schemaVersion` element indicating which release of the schema is being used in the request and expected schema format in the response. Important: All clients must accept new (unknown) elements in the response. E.g. unknown elements should be ignored. The client framework used by client must thus not crash when unknown elements are encountered. Note that this requirement excludes the (old, but still widely used) Apache Axis 1.x Web Service client framework.

- title: Encoding
  content: |
    Booking endpoints will assume all requests are UTF-8 encoded

- title: A new way of requesting additional services
  content: |
      We have added a new tag and by that a new way of requesting additional services. Both ways are still supported, but they can not be combined.

      * All the new additional services will be added supporting only the new way.

      * The old way will be decommission after some time.

      Where you before had to send each additional service as a tag under the services tag, the new way has a list of additionalService tags under the additionalServices tag, where the id element identify the additonal service to request.

      ```
       <additionalServices>
          <additionalService>
            <id>EVARSLING</id>
            <email>sender@sender.com</email>
            <mobile>12345</mobile>
          </additionalService>
          <additionalService>
            <id>DANGEROUS_GOODS</id>
            <mobile>777777</mobile>
            <unNumber>ABC</unNumber>
          </additionalService>
       </additionalServices>
      ```

       The old way of requesting additional servies:

      ```

        <services>
           <simpleDelivery>true</simpleDelivery>
           <flexDelivery>
              <message>
                 Legg pakken i garasjen.
              </message>
           </flexDelivery>
        </services>

      ```

- title: Authentication
  content: |
    The Booking API requires authentication for all its endpoints. See the [getting started guide on authentication](/api/#authentication) if you're not sure what this means.

- title: Authorization
  content: |
    In addition to authentication, you need to be authorized with the _booking_ right in order to perform bookings. This is done in [customer administration in Mybring](https://www.mybring.com/useradmin/external/administration):

    ![Authorized for booking](booking_authorization.png)

    To perform a booking, you must specify which customer number to use. For your convenience, there is an [API for getting the customer numbers](#list-customer-numbers) associated with your API user. The Customer Number API also links customer numbers with the products the customer number is valid for.

- title: Making labels
  content: |
    The Booking API generates and sends all necessary EDI messages to carry out the shipment. A URL to a PDF label is returned in responses. This label must be printed and be attached to the shipment. A URL that points to tracking information is also returned.

    A GET request to the label URL will result in a HTTP 302 redirect to the concrete storage facility (e.g. redirect to Amazon S3). Ensure that your client follows these redirects.

- title: Performance
  content: |
    Different product groups have different response times in booking:

    - Parcels and courier products
      - A booking will typically take < 2 seconds
    - Express UPS products and Cargo
      - A booking will typically take < 3 seconds
    - Express Nordic SameDay
      - A booking will typically take < 10 seconds (query in flight schedules). We are working on improving the response times for QuickPack SameDay, making popular city-pairs much faster.

/customers{mediaTypeExtension}:
  displayName: List customer numbers
  description: |
      The customer numbers are prefixed with the specialist, followed by the number. For Courier and Bring Express-products, we use a UUID to identify users.

      The customer API will return for each specialist a list with the products that you can order through the booking API.

      You can also get the API customer numbers from [this page in Mybring](https://www.mybring.com/useradmin/account/settings#customerApiKeyContainer).

      | Specialist | Example products | Example customer number |
      |:-----------|:-----------------|:------------------------|
      | Bring Parcels, Norway | `BPAKKE_DOR-DOR`, `PA_DOREN`, `EKSPRESS09` | `PARCELS_NORWAY-10001123123` |
      | Bring Cargo, Norway | `CARGO_GROUPAGE` | `CARGO-329511` |
      | Bring Cargo, International | `CARGO_INTERNATIONAL` | `CARGO-803739` |
      | Bring Express, Norway | `COURIER_4H`, `EXPRESS_NORDIC_SAME_DAY`, `EXPRESS_INTERNATIONAL` | `EXPRESS_NORWAY-2caedf20-27da-012f-3858-58b0357c4f66` |
      | Bring Express, Sweden | `COURIER_4H`, `EXPRESS_NORDIC_SAME_DAY`, `EXPRESS_INTERNATIONAL` | `EXPRESS_SWEDEN-406077f0-27da-012f-3859-58b0357c4f66` |
      | Oil Express, Norway | `OIL_EXPRESS` | `SYSPED_NORWAY-12345` |
      | Frigo, Norway | `FRIGO` | `FRIGO-123456` |

      [Check out this page](/api/products/#booking) to see the whole list of products for each customer type.

  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    description: List customer numbers and products
    responses:
      200:
        displayName: List of available customers and products
        body:
          application/json:
            example: !include examples/customers.json
          application/xml:
            example: !include examples/customers.xml

/booking:
  displayName: Book shipments
  description: |
      This is the endpoint where you can book a shipment and get a printable label in return.

      #### Additional services

      The following products have available additional services:

      | Product | Additional services |
      |:--------|:--------------------|
      | SERVICEPAKKE | cashOnDelivery, recipientNotification, socialControl |
      | BPAKKE_DOR-DOR | recipientNotification, simpleDelivery, deliveryOption |
      | PA_DOREN | recipientNotification, simpleDelivery |
      | EKSPRESS09 | recipientNotification, saturdayDelivery |
      | PICKUP_PARCEL | cashOnDelivery, flexDelivery, recipientNotification, deliveryOption |
      | PICKUP_PARCEL_BULK | cashOnDelivery, flexDelivery, recipientNotification, deliveryOption |
      | HOME_DELIVERY_PARCEL | cashOnDelivery, flexDelivery, recipientNotification |
      | BUSINESS_PARCEL | cashOnDelivery, flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_PARCEL_BULK | cashOnDelivery, flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | EXPRESS_NORDIC_0900_BULK | cashOnDelivery, flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_PALLET | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_HALFPALLET | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_QUARTERPALLET | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | EXPRESS_NORDIC_0900 | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |

      See the "More examples" section below to see examples on how to use additional services.

      #### Error handling

      If an error occurs, the following will be provided:

      - `uniqueId`: A unique log ID (UUID) that can be used as a reference for the error
      - `code`: An error code describing the error
      - `message`: Internationalized messages (with <message lang="”xx”"> elements). First version will be with lang=”en” (English) only. </message>

      See the [error codes](#error-codes) below to get an overview of error codes and what they mean.

      #### Testing

      This service will send actual production orders unless it is set to testing mode.

      To use the test mode, you need to set the `testIndicator` flag to `true` on the root node.

      Note that the examples below use `testIndicator=true`, so remove this when implementing the Booking API in your production system.

  post:
    description: Make a booking
    headers:
      Content-Type:
        description: Specify request format (application/json, application/xml)
        required: true
        enum: [ application/json, application/xml ]
      Accept:
        description: Specify response format (application/json, application/xml)
        required: false
        default: same as Content-Type
        enum: [ application/json, application/xml ]
    queryParameters:
        testIndicator:
            description:  It is true for test orders.
            type: boolean
            example: false
            required: true
        schemaVersion:
            description: Currently, it is 1
            type: integer
            example: 1
            required: true
        shippingDateTime:
            description: The date and time when an order is ready to be transported. The label generated against a booking will be valid for 52 weeks when Bring receives the request for an order.
            type: dateTime
            example: 2016-07-26T06:24:09 or 1469494449000 (for json req)
            required: true
        customerNumber:
            description: Specify API customer number. This parameter can be maximum 35 character long.
            type: string
            example: PARCELS_NORWAY-*********
            required: true
        addressLine:
            description: Specify address. This parameter can be maximum 35 character long.
            type: string
            example: Testsvingen 12
            required: true
        addressLine2:
            description: Specify address line 2. This parameter can be 35 character long.
            type: string
        customsDeclarationType:
            description: Declaration for customs clarance usage
            enum: [OTHER, REPAIR_OR_RETURN, DOCUMENTS, COMMERCIAL_SAMPLE, TEMPORARY_EXP, GIFT]
            example: COMMERCIAL_SAMPLE
            required: true
        customsDeclarationText:
            description: Describe good inside the package for custom clearance. This parameter can be maximum 35 character long.
            type: string
            example: Sample for verification
        purchaseOrderNumber:
            type: string
            description: Specify when there is any purchase orders associated with the booking. This parameter can be maximum 35 character long.
        weightInKg:
            description: Specify weight in kilograms
            type: double
            example: 15.2
            required: true
        goodsDescription:
            description: Describe what is inside the package. This parameter can be maximum 35 character long.
            type: string
        heightInCm:
            description: Specify height in cm. Dimension is optional when volumeInDm3 is specified in the request for cargo.
            type: integer
            example: 100
            required: true
        widthInCm:
            description: Specify width in cm. Dimension is optional when volumeInDm3 is specified in the request for cargo.
            type: integer
            example: 100
            required: true
        lengthInCm:
             description: Specify length in cm. Dimension is optional when volumeInDm3 is specified in the request for cargo.
             type: integer
             example: 100
             required: true
        numberOfItems:
             description: Specify number of items within a package
             type: integer
             example: 5
             required: true
        volumeInDm3:
             description: Specify volume in cubic decimeter. This is optional when dimension is specified in the request for cargo.
             type: decimal
             required: true
        numberOfPallets:
             description: Specify Number of pallets when request is for Cargo
             type: integer
             required: false
             example: 3
        loadMeters:
             description: Specify Load meters when request is for Cargo. Maximum value is 49.9
             type: double
             required: false
             example: 2.0
        whoPaysInvoice:
             description: Specify which party will pay the invoice for the booking. This parameter can be maximum 35 character long.
             type: string
             enum: [sender, recipient, thirdParty]
        accountNumber:
             description: Specify account number for cash on delivery. This parameter can be maximum 35 character long.
             type: string
             example: 12345678903
             required: true
        accountType:
             description: Specify account type. This parameter can be maximum 35 character long.
             type: string
             enum: [bankgiro,plusgiro]
        amount:
             description: Specify amount
             type: double
        currencyCode:
             description: Specify currency code
             type: string
             example: NOK
        correlationId:
             description: Specify something to correlate packages which belong to same order
             type: string
        containerId:
             description: Specify the container identification in which dangerous good is packed. This parameter can be maximum 35 character long.
             type: string
             example: 1236
        unNumber:
             description: Specify UN number of dangerous good. This parameter can be maximum 35 character long.
             type: string
             example: 1560
             required: true
        commodity:
             description: Specify name of the dangerous good. This parameter can be maximum 35 character long.
             type: string
             example: ARSENTRIKLORID
             required: true
        dangerClass:
             description: Specify the class of dangerous good. This parameter can be maximum 35 character long.
             type: string
             example: 1
             required: true
        postalCode:
             description: Specify the postal code. This parameter can be maximum 35 character long.
             type: string
             required: true
        city:
            description: Specify the city. This parameter can be maximum 35 character long.
            type : string
            required: true
        countryCode:
            description: Specify the country code. This parameter can be maximum 35 character long.
            type: string
            example: NO
            required: true
        reference:
            description: Specify shipper or consignee reference. This parameter can be maximum 35 character long.
            type: string
        additionalAddressInfo:
            description: Pickup instruction and delivery instruction. This parameter can be maximum 35 character long.
            type: string
        vatNumber:
            description: Specify organisation number. This parameter can be maximum 35 character long.
            type: string
        email:
            description: Specify email address. This parameter can be maximum 35 character long.
            type: string
            pattern: ^((\w*_)?(p|m|)\d*(\.\d|)|(\w*_)?(p|m)\d*(\.\d|)p)$
        phoneNumber:
            description: Specify phone number.
            type: string
        messageForRecipient:
            description: Specify message to recipient . This parameter can be maximum 35 character long.
            type: string

    body:
      application/json:
        example: !include examples/basicRequestNew.json
      application/xml:
        schema: !include schemas/booking-v1.xsd
        example: !include examples/basicRequestNew.xml
    responses:
      200:
        displayName: Successful booking
        description: On a successful request, the response gives information about the booking. Most importantly it contains a link to the label for the shipment.
        body:
          application/json:
            example: !include examples/successfulResponse.json
          application/xml:
            example: !include examples/successfulResponse.xml

      250:
        displayName: Recipient Notification. The old way of requesting additional services
        description: The `recipientNotification` attribute/element must be set for all products that allow electronic notification, in order for the recipient to receive electronic notification. This element must contain the recipient's mobile phone number and/or e-mail address.
        body:
          application/json:
            example: !include examples/recipientNotificationRequest.json
          application/xml:
            example: !include examples/recipientNotificationRequest.xml
      251:
        displayName: Recipient notification.
        description: The `recipientNotification` attribute/element must be set for all products that allow electronic notification, in order for the recipient to receive electronic notification. This element must the recipient's mobile phone number and/or e-mail address.
        body:
          application/json:
            example: !include examples/recipientNotificationRequestNew.json
          application/xml:
            example: !include examples/recipientNotificationRequestNew.xml

      252:
         displayName: Cash On Delivery. The old way of requesting additional services
         description: |
           The `cashOnDelivery` element/attribute can be set for products that allow cash on delivery. This element must contain the account number, the amount, the currency code and a `kid`, which is a customer identification number.

           `Amount` field only accepts numeric values without comma in it and with two decimal places.
         body:
           application/json:
             example: !include examples/cashOnDelivery.json
           application/xml:
             example: !include examples/cashOnDelivery.xml

      253:
         displayName: Cash On Delivery
         description: |
           The `cashOnDelivery` element/attribute can be set for products that allow cash on delivery. This element must contain the account number, the amount, the currency code and a `kid`, which is a customer identification number.

           `Amount` field only accepts numeric values without comma in it and with two decimal places.
         body:
           application/json:
             example: !include examples/cashOnDeliveryNew.json
           application/xml:
             example: !include examples/cashOnDeliveryNew.xml
      255:
        displayName: QuickPack Envelope
        description: |
          The `quickPackEnvelope` element/attribute is of type boolean, and can be set for products that allow quickpack envelope shipment. We recommend using the weight and measurements shown in the example, for correct mapping.
        body:
          application/json:
            example: !include examples/quickPackEnvelopeNew.json
          application/xml:
            example: !include examples/quickPackEnvelopeNew.xml
      262:
        displayName: Delivery Option
        description: |

          #### Attempted delivery

          If a sender want their package delivered to the door, and it cannot be delivered (i.e. Business closed or recipient is not present), then you can now choose what will happen with your package.

          If this option is not set, then the default behaviour is `TWO_DELIVERIES_THEN_RETURN`.

          If you want Bring to try deliver only once and/or deliver package to nearest PiB, then you must tell us by setting this option. These options cost extra money but the customer/sender will only be charged if the event happen.

          Example:

          You send a package to a business with the `deliveryOption=TWO_DELIVERIES_THEN_PIB`.

          - If Bring manage to deliver the package to the recipient on first try, then no extra charges is made.
          - If first attempt to deliver fails, then Bring will do a second attempt. The customer/sender will be charged extra.
          - If the second attempt also fails, then the package will be delivered to nearest PiB. The customer/sender will be charged extra.

          Possible options:

          - Not set = `TWO_DELIVERIES_THEN_RETURN`
          - `ONE_DELIVERY_THEN_PIB`
          - `TWO_DELIVERIES_THEN_PIB`
          - `TWO_DELIVERIES_THEN_RETURN`
        body:
          application/json:
            example: !include examples/deliveryOption.json
          application/xml:
            example: !include examples/deliveryOption.xml
      264:
        displayName: Flex Delivery
        description: |
          The `flexDelivery` element/attribute can be set for products that allow flex delivery. This element must contain an instruction message for the driver.
        body:
          application/json:
            example: !include examples/flexDelivery.json
          application/xml:
            example: !include examples/flexDelivery.xml
      266:
        displayName: Select Pickup Point in Norway
        description: |
          You can specify pickup point Id in request for `SERVICEPAKKE` and `PICKUP_PARCEL_BULK` products for delivery of parcels within Norway and to Norway from other countries. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points.

          The parcel will be delivered to the pickup point specified in the request with SMS/Email notification. Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.

          Pickup point id and country code has to be specified under `pickupPoint` within `parties` as shown below.
        body:
          application/json:
            example: !include examples/selectPickupPoint_NO.json
          application/xml:
            example: !include examples/selectPickupPoint_NO.xml
      268:
        displayName: Select Pickup Point in Sweden
        description: |
          You can specify pickup point Id in request for `PICKUP_PARCEL_BULK` products for delivery of parcels within Sweden and to Sweden from other countries. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points.

          The parcel will be delivered to the pickup point specified in the request with SMS/Email notification. Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.

          Pickup point id and country code has to be specified under `pickupPoint` in `parties` as shown below.
        body:
          application/json:
            example: !include examples/selectPickupPoint_SE.json
          application/xml:
            example: !include examples/selectPickupPoint_SE.xml
      270:
        displayName: Select Pickup Point in Denmark
        description: |
          The products `PICKUP_PARCEL` and `PICKUP_PARCEL_BULK` support the `deliveryOption=PICKUP_POINT` for shipments within Denmark and to Denmark, respectively. The parcel will be delivered to the pickup point closest to the recipient address and the recipient will receive a notification when the parcel arrives. If you do not specify a delivery option for these products in Denmark, the package will be delivered to the door.

          You can also specify a pickup point id to get the package delivered at a specific pickup point. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points. Pickup point id and country code has to be specified under `pickupPoint` within `parties` as shown below.

          `pickupPoint` is optional but both `id` and `countryCode` inside it are mandatory. This element has precedence over `deliveryOption=PICKUP_POINT` i.e. if this element is present then pickup point specified in it will be selected irrespective of value set in `deliveryOption`.

          Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.
        body:
          application/json:
            example: !include examples/selectPickupPoint_DK.json
          application/xml:
            example: !include examples/selectPickupPoint_DK.xml
      272:
        displayName: Select Pickup Point in Finland
        description: |
          You can specify pickup point Id in request for `PICKUP_PARCEL_BULK` products for delivery of parcels to Finland from other countries. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points.

          The parcel will be delivered to the pickup point specified in the request with SMS/Email notification. Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.

          Pickup point id and country code has to be specified under `pickupPoint` within `parties` as shown below.
        body:
          application/json:
            example: !include examples/selectPickupPoint_FI.json
          application/xml:
            example: !include examples/selectPickupPoint_FI.xml
      274:
        displayName: Express
        description: |
          ### Express service for Oil Express

          You can use Express service if you want to send your goods urgently (this service is *applicable only for Oil Express* product). In case of express delivery, goods are picked up as soon as possible and delivered to its destination.

          For using Express service send `true` value in `express` as shown in below example.
        body:
          application/json:
            example: !include examples/express.json
          application/xml:
            example: !include examples/express.xml
      276:
        displayName: Delivery Indoors
        description: The `deliveryIndoors` element/attribute can be set for products that allow delivery indoors. This element must contain an instruction message for the driver.
        body:
          application/json:
            example: !include examples/deliveryIndoors.json
          application/xml:
            example: !include examples/deliveryIndoors.xml
      278:
        displayName: Temperature Zone
        description: The `temperatureZone` element/attribute can be set for Frigo product for the goods which requires temperature controlled environment. This element allows either of 4 values `FROZEN`, `COOL`, `DRY` and `FISH`.
        body:
          application/json:
            example: !include examples/temperatureZone.json
          application/xml:
            example: !include examples/temperatureZone.xml
      280:
              displayName: Cargo International - Incoterms
              description: The `incotermRule` element/attribute can be set for Cargo International product. This is a mandatory element while creating an order for Cargo International. API request will return error code i.e., `BOOK-INPUT-065` in case of no IncotermRule is provided in request. This element allows either of 13 values `DDP`, `DAP`, `FCA`, `FAS`, `FOB`, `CFR`, `CIF`, `CPT`, `CIP`, `DAT`, `DAF`, `DES` and `EXW`.
              body:
                application/json:
                  example: !include examples/incotermRule.json
                application/xml:
                  example: !include examples/incotermRule.xml
      282:
              displayName: Cargo International - Dangerous Goods
              description: The `dangerousGoods` attribute/element block should be there in request for Cargo International to create an order with dangerous goods.
              body:
                application/json:
                  example: !include examples/bciDangerousGoods.json
                application/xml:
                  example: !include examples/bciDangerousGoods.xml
      284:
                    displayName: Cargo Norway - Dangerous Goods
                    description: The `dangerousGoods` attribute/element block should be there in request for Cargo Norway to create an order with dangerous goods.
                    body:
                      application/json:
                        example: !include examples/cargoDangerousGoods.json
                      application/xml:
                        example: !include examples/cargoDangerousGoods.xml
      286:
              displayName: Simple Delivery
              description: |
                The `simpleDelivery` element/attribute can be set for products that allow simple delivery.
              body:
                application/json:
                  example: !include examples/simpleDelivery.json
                application/xml:
                  example: !include examples/simpleDelivery.xml
      288:
              displayName: Cargo Norway - Number of Pallets & Load Meters
              description: The `numberOfPallets` element can be set for Number of pallets & `loadMeters` can be set for Load Metres
              body:
                application/json:
                  example: !include examples/cargowithPallets.json
                application/xml:
                  example: !include examples/cargoWithPallets.xml

/errors{mediaTypeExtension}:
  displayName: Error codes
  description: |
    Programming is hard. Something will always go wrong. See below for the current enumeration of error codes. A value of "true" for the attribute "suffixable" means that the error code is suffixed with "-SENDER" if the error is for the sending party data and "-RECIPIENT" if the error is for the recipient party data.
  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    body:
      application/json:
        example: !include examples/errors.json
      application/xml:
        example: !include examples/errors.xml

/pickupOrder:
  displayName: Order pickups
  description: |
    The Pickup Order Api is for ordering a single pickup at a particular address.

    Parcels Norway, Parcels Sweden, Parcels Denmark and Cargo Customers with a Mybring user ID can use this service. Customer numbers in this API is the same as to booking API, obtained either through your Mybring profile or the customer number API.

    Pickup in the different countries requires different customer numbers:

    | Customer number prefix | Pickup in country | Required information element |
    |:-----------------------|:------------------|:-----------------------------|
    | PARCELS_NORWAY         | Norway (parcels)  | `parcelsInformation`         |
    | CARGO                  | Norway (cargo)    | `cargoInformation`           |
    | PARCELS_NORWAY_INTERNATIONAL, PARCELS_SWEDEN, PARCELS_DENMARK, PARCELS_FINLAND | Sweden, Denmark | parcelsInternationalInformation |

    #### Pickup ordered by default with product CARGO_GROUPAGE from Bring Cargo

    A pickup order is necessary to get the goods collected for transportation by Bring Cargo but you don't have to worry about it when ordering with the API .

    A pickup will be automatically ordered together with the shipment when ordering a `CARGO_GROUPAGE` shipment.

    If you order many shipments the pickups will be aggregated by Bring Cargo to one pickup by place and date.
  post:
    description: Order a pickup
    body:
      application/json:
        example: !include examples/pickuporder_NO.json
      application/xml:
        example: !include examples/pickuporder_NO.xml
    responses:
      200:
        displayName: Successful pickup order
        body:
          application/json:
            example: !include examples/pickuporder_response.json
          application/xml:
            example: !include examples/pickuporder_response.xml
      250:
        displayName: Parcels Sweden request
        body:
          application/json:
            example: !include examples/pickuporder_SE.json
          application/xml:
            example: !include examples/pickuporder_SE.xml
      251:
        displayName: Cargo request
        body:
          application/json:
            example: !include examples/pickuporder_CARGO.json
          application/xml:
            example: !include examples/pickuporder_CARGO.xml

/ws:
  displayName: SOAP
  description: |
    The SOAP Body follows the same XML Schema Definition (XSD) as the XML API.

    The SOAP endpoint has the same operations as the endpoints listed above:

    - list customers
    - book shipments
    - order pikcups

    #### WSDL

    [https://api.bring.com/booking/api/ws/booking-v1.wsdl](https://api.bring.com/booking/api/ws/booking-v1.wsdl)

    #### XSD

    [https://api.bring.com/booking/api/schema/booking-v1.xsd](https://api.bring.com/booking/api/schema/booking-v1.xsd)

  post:
    description: SOAP

#%RAML 0.8
---
title: Booking API
baseUri: https://api.bring.com/booking/api

documentation:
- title: Introduction
  content: |
      The Bring Booking API is a logged-in service that lets Mybring users (customers of Mybring) programatically create a booking by invoking a Web Service over SOAP or by posting XML/JSON over HTTP. The API uses the same backend as [Mybring Booking](https://www.mybring.com/booking/) and the same PDF labels.

      We support two types of integration with the Booking API. XML/JSON over HTTP and SOAP (over HTTP).

      Booking uses Shipping Guide as the source for price and availability for the different products. We advise clients of the Booking API to use [Shipping Guide API](/api/shipping-guide_2/) for getting the list price and checking availability before sending a booking request. Note that invoice payment is the only available payment option for the Booking API. This means that the Mybring user ID used in the booking request must have access to the customer number specified as payer of the booking.

- title: Versioning strategy
  content: |
      Each request has a `schemaVersion` element indicating which release of the schema is being used in the request and expected schema format in the response. Important: All clients must accept new (unknown) elements in the response. E.g. unknown elements should be ignored. The client framework used by client must thus not crash when unknown elements are encountered. Note that this requirement excludes the (old, but still widely used) Apache Axis 1.x Web Service client framework.

- title: Encoding
  content: |
    Booking endpoints will assume all requests are UTF-8 encoded

- title: A new way of requesting additional services
  content: |
      We have added a new tag and by that a new way of requesting additional services. Both ways are still supported, but they can not be combined.

      Where you before had to send each additional service as a tag under the services tag, the new way has a list of additionalService tags under the additionalServices tag, where the id element identify the additonal service to request.

      ```
       <additionalServices>
          <additionalService>
            <id>EVARSLING</id>
            <email>sender@sender.com</email>
            <mobile>12345</mobile>
          </additionalService>
          <additionalService>
            <id>DANGEROUS_GOODS</id>
            <mobile>777777</mobile>
            <unNumber>ABC</unNumber>
          </additionalService>
       </additionalServices>

       The old way of requesting additional servies:

        <services>
           <simpleDelivery>true</simpleDelivery>
           <flexDelivery>
              <message>
                 Legg pakken i garasjen.
              </message>
           </flexDelivery>
        </services>
      ```

- title: Authentication
  content: |
    The Booking API requires authentication for all its endpoints. See the [getting started guide on authentication](/api/#authentication) if you're not sure what this means.

- title: Authorization
  content: |
    In addition to authentication, you need to be authorized with the _booking_ right in order to perform bookings. This is done in [customer administration in Mybring](https://www.mybring.com/useradmin/external/administration):

    ![Authorized for booking](booking_authorization.png)

    To perform a booking, you must specify which customer number to use. For your convenience, there is an [API for getting the customer numbers](#list-customer-numbers) associated with your API user. The Customer Number API also links customer numbers with the products the customer number is valid for.

- title: Making labels
  content: |
    The Booking API generates and sends all necessary EDI messages to carry out the shipment. A URL to a PDF label is returned in responses. This label must be printed and be attached to the shipment. A URL that points to tracking information is also returned.

    A GET request to the label URL will result in a HTTP 302 redirect to the concrete storage facility (e.g. redirect to Amazon S3). Ensure that your client follows these redirects.

- title: Performance
  content: |
    Different product groups have different response times in booking:

    - Parcels and courier products
      - A booking will typically take < 2 seconds
    - Express UPS products and Cargo
      - A booking will typically take < 3 seconds
    - Express Nordic SameDay
      - A booking will typically take < 10 seconds (query in flight schedules). We are working on improving the response times for QuickPack SameDay, making popular city-pairs much faster.

/customers{mediaTypeExtension}:
  displayName: List customer numbers
  description: |
      The customer numbers are prefixed with the specialist, followed by the number. For Courier and Bring Express-products, we use a UUID to identify users.

      The customer API will return for each specialist a list with the products that you can order through the booking API.

      You can also get the API customer numbers from [this page in Mybring](https://www.mybring.com/useradmin/account/settings#customerApiKeyContainer).

      | Specialist | Example products | Example customer number |
      |:-----------|:-----------------|:------------------------|
      | Bring Parcels, Norway | `BPAKKE_DOR-DOR`, `PA_DOREN`, `EKSPRESS09` | `PARCELS_NORWAY-10001123123` |
      | Bring Cargo, Norway | `CARGO_GROUPAGE` | `CARGO-329511` |
      | Bring Cargo, International | `CARGO_INTERNATIONAL` | `CARGO-803739` |
      | Bring Express, Norway | `COURIER_4H`, `EXPRESS_NORDIC_SAME_DAY`, `EXPRESS_INTERNATIONAL` | `EXPRESS_NORWAY-2caedf20-27da-012f-3858-58b0357c4f66` |
      | Bring Express, Sweden | `COURIER_4H`, `EXPRESS_NORDIC_SAME_DAY`, `EXPRESS_INTERNATIONAL` | `EXPRESS_SWEDEN-406077f0-27da-012f-3859-58b0357c4f66` |
      | Oil Express, Norway | `OIL_EXPRESS` | `SYSPED_NORWAY-12345` |
      | Frigo, Norway | `FRIGO` | `FRIGO-123456` |

      [Check out this page](/api/products/#booking) to see the whole list of products for each customer type.

  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    description: List customer numbers and products
    responses:
      200:
        displayName: List of available customers and products
        body:
          application/json:
            example: !include examples/customers.json
          application/xml:
            example: !include examples/customers.xml

/booking:
  displayName: Book shipments
  description: |
      This is the endpoint where you can book a shipment and get a printable label in return.

      #### Additional services

      The following products have available additional services:

      | Product | Additional services |
      |:--------|:--------------------|
      | SERVICEPAKKE | cashOnDelivery, recipientNotification, socialControl |
      | BPAKKE_DOR-DOR | recipientNotification, simpleDelivery, deliveryOption |
      | PA_DOREN | recipientNotification, simpleDelivery |
      | EKSPRESS09 | recipientNotification, saturdayDelivery |
      | PICKUP_PARCEL | cashOnDelivery, flexDelivery, recipientNotification, deliveryOption |
      | PICKUP_PARCEL_BULK | cashOnDelivery, flexDelivery, recipientNotification, deliveryOption |
      | HOME_DELIVERY_PARCEL | cashOnDelivery, flexDelivery, recipientNotification |
      | BUSINESS_PARCEL | cashOnDelivery, flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_PARCEL_BULK | cashOnDelivery, flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | EXPRESS_NORDIC_0900_BULK | cashOnDelivery, flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_PALLET | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_HALFPALLET | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | BUSINESS_QUARTERPALLET | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |
      | EXPRESS_NORDIC_0900 | flexDelivery, recipientNotification, phonenotification, deliveryIndoors |

      See the "More examples" section below to see examples on how to use additional services.

      #### Error handling

      If an error occurs, the following will be provided:

      - `uniqueId`: A unique log ID (UUID) that can be used as a reference for the error
      - `code`: An error code describing the error
      - `message`: Internationalized messages (with <message lang="”xx”"> elements). First version will be with lang=”en” (English) only. </message>

      See the [error codes](#error-codes) below to get an overview of error codes and what they mean.

      #### Testing

      This service will send actual production orders unless it is set to testing mode.

      To use the test mode, you need to set the `testIndicator` flag to `true` on the root node.

      Note that the examples below use `testIndicator=true`, so remove this when implementing the Booking API in your production system.

  post:
    description: Make a booking
    headers:
      Content-Type:
        description: Specify request format (application/json, application/xml)
        required: true
        enum: [ application/json, application/xml ]
      Accept:
        description: Specify response format (application/json, application/xml)
        required: false
        default: same as Content-Type
        enum: [ application/json, application/xml ]
    queryParameters:
        testIndicator:
            description:  It is true for test orders.
            type: boolean
            example: false
            required: true
        schemaVersion:
            description: Currently, it is 1
            type: integer
            example: 1
            required: true
        shippingDateTime:
            description: The date and time when an order is ready to be transported. The label generated against a booking will be valid for 52 weeks when Bring receives the request for an order.
            type: dateTime
            example: 2016-07-26T06:24:09 or 1469494449000 (for json req)
            required: true
        customerNumber:
            description: Specify API customer number. This parameter can be maximum 35 character long.
            type: string
            example: PARCELS_NORWAY-*********
            required: true
        addressLine:
            description: Specify address. This parameter can be maximum 35 character long.
            type: string
            example: Testsvingen 12
            required: true
        addressLine2:
            description: Specify address line 2. This parameter can be 35 character long.
            type: string
        customsDeclarationType:
            description: Declaration for customs clarance usage
            enum: [OTHER, REPAIR_OR_RETURN, DOCUMENTS, COMMERCIAL_SAMPLE, TEMPORARY_EXP, GIFT]
            example: COMMERCIAL_SAMPLE
            required: true
        customsDeclarationText:
            description: Describe good inside the package for custom clearance. This parameter can be maximum 35 character long.
            type: string
            example: Sample for verification
        purchaseOrderNumber:
            type: string
            description: Specify when there is any purchase orders associated with the booking. This parameter can be maximum 35 character long.
        weightInKg:
            description: Specify weight in kilograms
            type: double
            example: 15.2
            required: true
        goodsDescription:
            description: Describe what is inside the package. This parameter can be maximum 35 character long.
            type: string
        heightInCm:
            description: Specify height in cm. Dimension is optional when volumeInDm3 is specified in the request for cargo.
            type: integer
            example: 100
            required: true
        widthInCm:
            description: Specify width in cm. Dimension is optional when volumeInDm3 is specified in the request for cargo.
            type: integer
            example: 100
            required: true
        lengthInCm:
             description: Specify length in cm. Dimension is optional when volumeInDm3 is specified in the request for cargo.
             type: integer
             example: 100
             required: true
        numberOfItems:
             description: Specify number of items within a package
             type: integer
             example: 5
             required: true
        volumeInDm3:
             description: Specify volume in cubic decimeter. This is optional when dimension is specified in the request for cargo.
             type: decimal
             required: true
        numberOfPallets:
             description: Specify Number of pallets when request is for Cargo
             type: integer
             required: false
             example: 3
        loadMeters:
             description: Specify Load meters when request is for Cargo. Maximum value is 49.9
             type: double
             required: false
             example: 2.0
        whoPaysInvoice:
             description: Specify which party will pay the invoice for the booking. This parameter can be maximum 35 character long.
             type: string
             enum: [sender, recipient, thirdParty]
        accountNumber:
             description: Specify account number for cash on delivery. This parameter can be maximum 35 character long.
             type: string
             example: 12345678903
             required: true
        accountType:
             description: Specify account type. This parameter can be maximum 35 character long.
             type: string
             enum: [bankgiro,plusgiro]
        amount:
             description: Specify amount
             type: double
        currencyCode:
             description: Specify currency code
             type: string
             example: NOK
        correlationId:
             description: Specify something to correlate packages which belong to same order
             type: string
        containerId:
             description: Specify the container identification in which dangerous good is packed. This parameter can be maximum 35 character long.
             type: string
             example: 1236
        unNumber:
             description: Specify UN number of dangerous good. This parameter can be maximum 35 character long.
             type: string
             example: 1560
             required: true
        commodity:
             description: Specify name of the dangerous good. This parameter can be maximum 35 character long.
             type: string
             example: ARSENTRIKLORID
             required: true
        dangerClass:
             description: Specify the class of dangerous good. This parameter can be maximum 35 character long.
             type: string
             example: 1
             required: true
        postalCode:
             description: Specify the postal code. This parameter can be maximum 35 character long.
             type: string
             required: true
        city:
            description: Specify the city. This parameter can be maximum 35 character long.
            type : string
            required: true
        countryCode:
            description: Specify the country code. This parameter can be maximum 35 character long.
            type: string
            example: NO
            required: true
        reference:
            description: Specify shipper or consignee reference. This parameter can be maximum 35 character long.
            type: string
        additionalAddressInfo:
            description: Pickup instruction and delivery instruction. This parameter can be maximum 35 character long.
            type: string
        vatNumber:
            description: Specify organisation number. This parameter can be maximum 35 character long.
            type: string
        email:
            description: Specify email address. This parameter can be maximum 35 character long.
            type: string
            pattern: ^((\w*_)?(p|m|)\d*(\.\d|)|(\w*_)?(p|m)\d*(\.\d|)p)$
        phoneNumber:
            description: Specify phone number.
            type: string
        messageForRecipient:
            description: Specify message to recipient . This parameter can be maximum 35 character long.
            type: string

    body:
      application/json:
        example: !include examples/basicRequestNew.json
      application/xml:
        schema: !include schemas/booking-v1.xsd
        example: !include examples/basicRequestNew.xml
    responses:
      200:
        displayName: Successful booking
        description: On a successful request, the response gives information about the booking. Most importantly it contains a link to the label for the shipment.
        body:
          application/json:
            example: !include examples/successfulResponse.json
          application/xml:
            example: !include examples/successfulResponse.xml

      250:
        displayName: Recipient Notification. The old way of requesting additional services
        description: The `recipientNotification` attribute/element must be set for all products that allow electronic notification, in order for the recipient to receive electronic notification. This element must contain the recipient's mobile phone number and/or e-mail address.
        body:
          application/json:
            example: !include examples/recipientNotificationRequest.json
          application/xml:
            example: !include examples/recipientNotificationRequest.xml
      251:
        displayName: Recipient notification.
        description: The `recipientNotification` attribute/element must be set for all products that allow electronic notification, in order for the recipient to receive electronic notification. This element must the recipient's mobile phone number and/or e-mail address.
        body:
          application/json:
            example: !include examples/recipientNotificationRequestNew.json
          application/xml:
            example: !include examples/recipientNotificationRequestNew.xml

      252:
         displayName: Cash On Delivery. The old way of requesting additional services
         description: |
           The `cashOnDelivery` element/attribute can be set for products that allow cash on delivery. This element must contain the account number, the amount, the currency code and a `kid`, which is a customer identification number.

           `Amount` field only accepts numeric values without comma in it and with two decimal places.
         body:
           application/json:
             example: !include examples/cashOnDelivery.json
           application/xml:
             example: !include examples/cashOnDelivery.xml

      253:
         displayName: Cash On Delivery
         description: |
           The `cashOnDelivery` element/attribute can be set for products that allow cash on delivery. This element must contain the account number, the amount, the currency code and a `kid`, which is a customer identification number.

           `Amount` field only accepts numeric values without comma in it and with two decimal places.
         body:
           application/json:
             example: !include examples/cashOnDeliveryNew.json
           application/xml:
             example: !include examples/cashOnDeliveryNew.xml
      255:
        displayName: QuickPack Envelope
        description: |
          The `quickPackEnvelope` element/attribute is of type boolean, and can be set for products that allow quickpack envelope shipment. We recommend using the weight and measurements shown in the example, for correct mapping.
        body:
          application/json:
            example: !include examples/quickPackEnvelopeNew.json
          application/xml:
            example: !include examples/quickPackEnvelopeNew.xml
      262:
        displayName: Delivery Option
        description: |

          #### Attempted delivery

          If a sender want their package delivered to the door, and it cannot be delivered (i.e. Business closed or recipient is not present), then you can now choose what will happen with your package.

          If this option is not set, then the default behaviour is `TWO_DELIVERIES_THEN_RETURN`.

          If you want Bring to try deliver only once and/or deliver package to nearest PiB, then you must tell us by setting this option. These options cost extra money but the customer/sender will only be charged if the event happen.

          Example:

          You send a package to a business with the `deliveryOption=TWO_DELIVERIES_THEN_PIB`.

          - If Bring manage to deliver the package to the recipient on first try, then no extra charges is made.
          - If first attempt to deliver fails, then Bring will do a second attempt. The customer/sender will be charged extra.
          - If the second attempt also fails, then the package will be delivered to nearest PiB. The customer/sender will be charged extra.

          Possible options:

          - Not set = `TWO_DELIVERIES_THEN_RETURN`
          - `ONE_DELIVERY_THEN_PIB`
          - `TWO_DELIVERIES_THEN_PIB`
          - `TWO_DELIVERIES_THEN_RETURN`
        body:
          application/json:
            example: !include examples/deliveryOption.json
          application/xml:
            example: !include examples/deliveryOption.xml
      264:
        displayName: Flex Delivery
        description: |
          The `flexDelivery` element/attribute can be set for products that allow flex delivery. This element must contain an instruction message for the driver.
        body:
          application/json:
            example: !include examples/flexDelivery.json
          application/xml:
            example: !include examples/flexDelivery.xml
      266:
        displayName: Select Pickup Point in Norway
        description: |
          You can specify pickup point Id in request for `SERVICEPAKKE` and `PICKUP_PARCEL_BULK` products for delivery of parcels within Norway and to Norway from other countries. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points.

          The parcel will be delivered to the pickup point specified in the request with SMS/Email notification. Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.

          Pickup point id and country code has to be specified under `pickupPoint` within `parties` as shown below.
        body:
          application/json:
            example: !include examples/selectPickupPoint_NO.json
          application/xml:
            example: !include examples/selectPickupPoint_NO.xml
      268:
        displayName: Select Pickup Point in Sweden
        description: |
          You can specify pickup point Id in request for `PICKUP_PARCEL_BULK` products for delivery of parcels within Sweden and to Sweden from other countries. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points.

          The parcel will be delivered to the pickup point specified in the request with SMS/Email notification. Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.

          Pickup point id and country code has to be specified under `pickupPoint` in `parties` as shown below.
        body:
          application/json:
            example: !include examples/selectPickupPoint_SE.json
          application/xml:
            example: !include examples/selectPickupPoint_SE.xml
      270:
        displayName: Select Pickup Point in Denmark
        description: |
          The products `PICKUP_PARCEL` and `PICKUP_PARCEL_BULK` support the `deliveryOption=PICKUP_POINT` for shipments within Denmark and to Denmark, respectively. The parcel will be delivered to the pickup point closest to the recipient address and the recipient will receive a notification when the parcel arrives. If you do not specify a delivery option for these products in Denmark, the package will be delivered to the door.

          You can also specify a pickup point id to get the package delivered at a specific pickup point. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points. Pickup point id and country code has to be specified under `pickupPoint` within `parties` as shown below.

          `pickupPoint` is optional but both `id` and `countryCode` inside it are mandatory. This element has precedence over `deliveryOption=PICKUP_POINT` i.e. if this element is present then pickup point specified in it will be selected irrespective of value set in `deliveryOption`.

          Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.
        body:
          application/json:
            example: !include examples/selectPickupPoint_DK.json
          application/xml:
            example: !include examples/selectPickupPoint_DK.xml
      272:
        displayName: Select Pickup Point in Finland
        description: |
          You can specify pickup point Id in request for `PICKUP_PARCEL_BULK` products for delivery of parcels to Finland from other countries. Use [Pickup Point API](/api/pickup-point/) to get list of nearest pickup points.

          The parcel will be delivered to the pickup point specified in the request with SMS/Email notification. Pickup point delivery requires that the *recipient has email and/or phone number set*, so that he can receive notification when the package arrives at the pickup point.

          Pickup point id and country code has to be specified under `pickupPoint` within `parties` as shown below.
        body:
          application/json:
            example: !include examples/selectPickupPoint_FI.json
          application/xml:
            example: !include examples/selectPickupPoint_FI.xml
      274:
        displayName: Express
        description: |
          ### Express service for Oil Express

          You can use Express service if you want to send your goods urgently (this service is *applicable only for Oil Express* product). In case of express delivery, goods are picked up as soon as possible and delivered to its destination.

          For using Express service send `true` value in `express` as shown in below example.
        body:
          application/json:
            example: !include examples/express.json
          application/xml:
            example: !include examples/express.xml
      276:
        displayName: Delivery Indoors
        description: The `deliveryIndoors` element/attribute can be set for products that allow delivery indoors. This element must contain an instruction message for the driver.
        body:
          application/json:
            example: !include examples/deliveryIndoors.json
          application/xml:
            example: !include examples/deliveryIndoors.xml
      278:
        displayName: Temperature Zone
        description: The `temperatureZone` element/attribute can be set for Frigo product for the goods which requires temperature controlled environment. This element allows either of 4 values `FROZEN`, `COOL`, `DRY` and `FISH`.
        body:
          application/json:
            example: !include examples/temperatureZone.json
          application/xml:
            example: !include examples/temperatureZone.xml
      280:
              displayName: Cargo International - Incoterms
              description: The `incotermRule` element/attribute can be set for Cargo International product. This is a mandatory element while creating an order for Cargo International. API request will return error code i.e., `BOOK-INPUT-065` in case of no IncotermRule is provided in request. This element allows either of 13 values `DDP`, `DAP`, `FCA`, `FAS`, `FOB`, `CFR`, `CIF`, `CPT`, `CIP`, `DAT`, `DAF`, `DES` and `EXW`.
              body:
                application/json:
                  example: !include examples/incotermRule.json
                application/xml:
                  example: !include examples/incotermRule.xml
      282:
              displayName: Cargo International - Dangerous Goods
              description: The `dangerousGoods` attribute/element block should be there in request for Cargo International to create an order with dangerous goods.
              body:
                application/json:
                  example: !include examples/bciDangerousGoods.json
                application/xml:
                  example: !include examples/bciDangerousGoods.xml
      284:
                    displayName: Cargo Norway - Dangerous Goods
                    description: The `dangerousGoods` attribute/element block should be there in request for Cargo Norway to create an order with dangerous goods.
                    body:
                      application/json:
                        example: !include examples/cargoDangerousGoods.json
                      application/xml:
                        example: !include examples/cargoDangerousGoods.xml
      286:
              displayName: Simple Delivery
              description: |
                The `simpleDelivery` element/attribute can be set for products that allow simple delivery.
              body:
                application/json:
                  example: !include examples/simpleDelivery.json
                application/xml:
                  example: !include examples/simpleDelivery.xml
      288:
              displayName: Cargo Norway - Number of Pallets & Load Meters
              description: The `numberOfPallets` element can be set for Number of pallets & `loadMeters` can be set for Load Metres
              body:
                application/json:
                  example: !include examples/cargowithPallets.json
                application/xml:
                  example: !include examples/cargoWithPallets.xml

/errors{mediaTypeExtension}:
  displayName: Error codes
  description: |
    Programming is hard. Something will always go wrong. See below for the current enumeration of error codes. A value of "true" for the attribute "suffixable" means that the error code is suffixed with "-SENDER" if the error is for the sending party data and "-RECIPIENT" if the error is for the recipient party data.
  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    body:
      application/json:
        example: !include examples/errors.json
      application/xml:
        example: !include examples/errors.xml

/pickupOrder:
  displayName: Order pickups
  description: |
    The Pickup Order Api is for ordering a single pickup at a particular address.

    Parcels Norway, Parcels Sweden, Parcels Denmark and Cargo Customers with a Mybring user ID can use this service. Customer numbers in this API is the same as to booking API, obtained either through your Mybring profile or the customer number API.

    Pickup in the different countries requires different customer numbers:

    | Customer number prefix | Pickup in country | Required information element |
    |:-----------------------|:------------------|:-----------------------------|
    | PARCELS_NORWAY         | Norway (parcels)  | `parcelsInformation`         |
    | CARGO                  | Norway (cargo)    | `cargoInformation`           |
    | PARCELS_NORWAY_INTERNATIONAL, PARCELS_SWEDEN, PARCELS_DENMARK, PARCELS_FINLAND | Sweden, Denmark | parcelsInternationalInformation |

    #### Pickup ordered by default with product CARGO_GROUPAGE from Bring Cargo

    A pickup order is necessary to get the goods collected for transportation by Bring Cargo but you don't have to worry about it when ordering with the API .

    A pickup will be automatically ordered together with the shipment when ordering a `CARGO_GROUPAGE` shipment.

    If you order many shipments the pickups will be aggregated by Bring Cargo to one pickup by place and date.
  post:
    description: Order a pickup
    body:
      application/json:
        example: !include examples/pickuporder_NO.json
      application/xml:
        example: !include examples/pickuporder_NO.xml
    responses:
      200:
        displayName: Successful pickup order
        body:
          application/json:
            example: !include examples/pickuporder_response.json
          application/xml:
            example: !include examples/pickuporder_response.xml
      250:
        displayName: Parcels Sweden request
        body:
          application/json:
            example: !include examples/pickuporder_SE.json
          application/xml:
            example: !include examples/pickuporder_SE.xml
      251:
        displayName: Cargo request
        body:
          application/json:
            example: !include examples/pickuporder_CARGO.json
          application/xml:
            example: !include examples/pickuporder_CARGO.xml

/ws:
  displayName: SOAP
  description: |
    The SOAP Body follows the same XML Schema Definition (XSD) as the XML API.

    The SOAP endpoint has the same operations as the endpoints listed above:

    - list customers
    - book shipments
    - order pikcups

    #### WSDL

    [https://api.bring.com/booking/api/ws/booking-v1.wsdl](https://api.bring.com/booking/api/ws/booking-v1.wsdl)

    #### XSD

    [https://api.bring.com/booking/api/schema/booking-v1.xsd](https://api.bring.com/booking/api/schema/booking-v1.xsd)

  post:
    description: SOAP