fix project raml

fix project raml

type: container
get:
  responses:
    200:
      body:
        application/json:
          example: !include ../examples/output/project-list.json
          schema: !include ../schemas/output/project-list.json
post:
  description: Create a project
  body:
    application/json:
      example: !include ../examples/input/project.json
      schema: !include ../schemas/input/project.json
/{ProjectId}:
  uriParameters:
    ProjectId:
      type: string
      required: true
  type: container-item
  get:
    responses:
      200:
        body:
          application/json:
            example: !include ../examples/output/project.json
            schema: !include ../schemas/output/project.json
  put:
    body:
      application/json:
        example: !include ../examples/input/project-update.json
        schema: !include ../schemas/input/project-update.json
  /template:
    post:
      description: Set the session template for a project
      body:
        application/json:
          example: !include ../examples/input/project-template.json
          schema: !include ../schemas/input/project-template.json
      responses:
        200:
          description: Template was saved
          body:
            application/json:
              schema: !include ../schemas/output/container-update.json
              example: !include ../examples/output/container-update.json
        404:
          description: Project was not found
  /recalc:
    post:
      description: |
        Recalculate if sessions in the project satisfy the template.
        Returns list of modified session ids.
      responses:
        200:
          description: |
            Project's sessions' compliance was recalculated.
            Returns list of session that were modified.
          body:
            application/json:
              schema: !include ../schemas/output/session-template-recalc.json
              example: !include ../examples/output/session-template-recalc.json
        404:
          description: Project was not found
  delete:
    description: Remove the session template for a project
    responses:
      200:
        description: Template was removed
        body:
          application/json:
            example: !include ../examples/output/container-delete.json
            schema: !include ../schemas/output/container-delete.json
      404:
        description: Project was not found

/recalc:
  post:
    description: |
      Iterates all projects that have a session template.
      Recalculate if projects' sessions satisfy the template.
      Returns list of modified session ids.
    responses:
      200:
        description: |
          Projects' sessions' compliance was recalculated.
          Returns list of session that were modified.

type: container
get:
  responses:
    200:
      body:
        application/json:
          example: !include ../examples/output/project-list.json
          schema: !include ../schemas/output/project-list.json
post:
  description: Create a project
  body:
    application/json:
      example: !include ../examples/input/project.json
      schema: !include ../schemas/input/project.json
/{ProjectId}:
  uriParameters:
    ProjectId:
      type: string
      required: true
  type: container-item
  uriParameters:
    ProjectId:
      type: string
      required: true
  get:
    responses:
      200:
        body:
          application/json:
            example: !include ../examples/output/project.json
            schema: !include ../schemas/output/project.json
  put:
    body:
      application/json:
        example: !include ../examples/input/project-update.json
        schema: !include ../schemas/input/project-update.json
  /template:
    post:
      description: Set the session template for a project
      body:
        application/json:
          example: !include ../examples/input/project-template.json
          schema: !include ../schemas/input/project-template.json
      responses:
        200:
          description: Template was saved
          body:
            application/json:
              schema: !include ../schemas/output/container-update.json
              example: !include ../examples/output/container-update.json
        404:
          description: Project was not found
  /recalc:
    post:
      description: |
        Recalculate if sessions in the project satisfy the template.
        Returns list of modified session ids.
      responses:
        200:
          description: |
            Project's sessions' compliance was recalculated.
            Returns list of session that were modified.
          body:
            application/json:
              schema: !include ../schemas/output/session-template-recalc.json
              example: !include ../examples/output/session-template-recalc.json
        404:
          description: Project was not found
  delete:
    description: Remove the session template for a project
    responses:
      200:
        description: Template was removed
        body:
          application/json:
            example: !include ../examples/output/container-delete.json
            schema: !include ../schemas/output/container-delete.json
      404:
        description: Project was not found

/recalc:
  post:
    description: |
      Iterates all projects that have a session template.
      Recalculate if projects' sessions satisfy the template.
      Returns list of modified session ids.
    responses:
      200:
        description: |
          Projects' sessions' compliance was recalculated.
          Returns list of session that were modified.


Show https for base API endpoint

Show https for base API endpoint

#%RAML 0.8
---
title: Knapsack Pro
baseUri: https://api.knapsackpro.com/{version}
version: v1
mediaType: application/json

/build_subsets: !include build_subsets/main.raml
/build_distributions: !include build_distributions/main.raml
/queues: !include queues/main.raml

#%RAML 0.8
---
title: Knapsack Pro
baseUri: http://api.knapsackpro.com/{version}
version: v1
mediaType: application/json

/build_subsets: !include build_subsets/main.raml
/build_distributions: !include build_distributions/main.raml
/queues: !include queues/main.raml


Adding union type at the end of example.

#%RAML 1.0  Library
types:
    Location:
      type: object
      properties:
        id?: string
        name?: string
        latitude?: number
        longtitude?: number
      example:
        id: "1"
        name: "John"
        latitude: 34.016242
        longtitude: -95.800781
    Meta:
      type: object
      properties:
        code: number
      example:
        code: 200
    Locations:
      type: object
      properties:
        meta?: Meta
        data?: Location[]
      example:
        meta:
          code: 200
        data:
          - id: "1"
            name: "John"
            latitude: 34.016242
            longtitude: -95.800781
    Counts:
      type: object
      properties:
        media?: integer
        follows?: integer
        followed_by?: integer
      example:
        media: 2
        follows: 3
        followed_by: 5
    UserAccount:
      type: object
      properties:
        data:
          type: object
          properties:
            id?: string
            username?: string
            full_name?: string
            profile_picture?: string
            bio?: string
            website?: string
            count?: Counts
      example:
        data:
          id: "1"
          username: "John"
          full_name: "John Smith"
          profile_picture: "URL"
          website: "example.org"
          count:
            media: 2
            follows: 3
            followed_by: 5
    User:
      type: object
      properties:
        id?: string
        username?: string
        full_name?: string
        profile_picture?:
        bio?: string
        website?: string
        count?: Counts
      example:
        id: "1"
        username: "John"
        full_name: "John Smith"
        profile_picture: "URL"
        website: "example.org"
        count:
          media: 2
          follows: 3
          followed_by: 5
    SubscriptionPost:
      type: object
      properties:
        meta?: Meta
        data?:
          type: object
          properties:
            object?: string
            object_id?: string
            aspect?: string
            callback_url?: string
            type?: string
            id?: string
            lat?: number
            lng?: number
            radius?: number
      example:
        meta:
          code: 200
        data:
          object_id: "25"
          callback_url: "url"
          id: "22"
          lat: 34.016242
          lng: -95.800781
          radius: 20
    SubscriptionData:
      type: object
      properties:
        id?: string
        type?: string
        object?: string
        aspect?: string
        callback_url?: string
        object_id?: string
      example:
        object_id: "25"
        callback_url: "url"
        id: "22"
    SubscriptionsGet:
      type: object
      properties:
        meta?: Meta
        data?:
          type: SubscriptionData[]
      example:
        meta:
          code: 200
        data:
          - object_id: "25"
            callback_url: "url"
            id: "22"
    SubscriptionsDelete:
       type: object
       properties:
         meta?: Meta
         data?:
           type: SubscriptionData
       example:
         meta:
           code: 200
         data:
           object_id: "25"
           callback_url: "url"
           id: "22"
    Tag:
      type: object
      properties:
        data?:
          type: object
          properties:
            media_count?: integer
            name?: string
      example:
        data:
          media_count: 2
          name: forest
    SerachTagItem:
      type: object
      properties:
        media_count?: integer
        name?: string
      example:
        media_count: 2
        name: forest
    TagsSearch:
      type: object
      properties:
        meta?: Meta
        data?: SerachTagItem[]
      example:
        meta:
          code: 200
        data:
          - media_count: 2
            name: forest
    MediaLike:
      type: object
      properties:
        first_name?: string
        last_name?: string
        id?: string
        type?: string
      example:
        first_name: "John"
        last_name: "Smith"
        id: "2"
        type: "string"
    MediaLikes:
      type: object
      properties:
        data?: MediaLike[]
      example:
        data:
          - first_name: "John"
            last_name: "Smith"
            id: "2"
            type: "string"
    Comment:
      type: object
      properties:
        created_time?: string
        text?: string
        from?:
          type: object
          properties:
            username?: string
            profile_pictures?: string
            id?: string
            full_name?: string
        id?: string
      example:
        created_time: "1382576494"
        text: "text"
        from:
            username: "John"
            id: "2000"
            full_name: "John Smith"
        id: "200"
    MediaComment:
      type: object
      properties:
        meta: Meta
        data: Comment[]
      example:
        meta:
          code: 200
        data:
        - created_time: "1382576494"
          text: "text"
          from:
            username: "John"
            id: "2000"
            full_name: "John Smith"
          id: "200"
    Oembed:
      type: object
      properties:
        author_id?: integer
        author_name?: string
        author_url?: string
        heght?: integer
        media_id?: string
        provider_name?: string
        provider_url?: string
        title?: string
        type?: string
        url?: string
        version?: string
        width?: integer
      example:
        author_id: 20
        author_name: "John"
        author_url: "URL"
        heght: 400
        media_id: "29"
        provider_name: "Alex"
        provider_url: "URL"
        title: "Photos"
        type: "media"
        url: "URL"
        version: "2.11"
        width: 600
    RelationshipsPost:
      type: object
      properties:
        meta?: Meta
        data?:
          type: object
          properties:
            outgoing_status?: string
      example:
        meta:
          code: 200
        data:
          outgoing_status: "none"
    Relationships:
      type: object
      properties:
        meta?: Meta
        data?:
          type: object
          properties:
            outgoing_status?: string
            incoming_status?: string
      example:
        meta:
          code: 200
        data:
          outgoing_status: "none"
          incoming_status: "requested_by"
    RequestedBy:
      type: object
      properties:
        meta: Meta
        data:
          type: object
          properties:
            username: string
            profile_picture: string
            id: string
      example:
        meta:
          code: 200
        data:
          username: "John"
          profile_picture: "URL"
          id: "25"
    UsersItem:
      type: object
      properties:
        username: string
        first_name: string
        profile_picture: string
        id: string
        last_name: string
      example:
        username: "John"
        first_name: "John"
        profile_picture: "URL"
        id: "25"
        last_name: "Smith"
    Users:
      type: object
      properties:
        data: UsersItem[]
      example:
        data:
          - username: "John"
            first_name: "John"
            profile_picture: "URL"
            id: "25"
            last_name: "Smith"
    OkStatus:
      type: object
      properties:
        geo:
          type: object
          properties:
            address:
              type: object
              properties:
                city: string
                streetAddress: string
            age: number
      example:
        geo:
          address:
            city: "SEATTLE"
            streetAddress: "300 BOYLSTON AVE E"
          age: 20
    Caption:
      type: object
      properties:
        created_time?: string
        text?: string
        from?:
          type: object
          properties:
            username?: string
            id?: string
        id?: string
      example:
        created_time: "1382576494"
        text: "text"
        from:
          username: "John"
          id: "2000"
    Likes:
      type: object
      properties:
        count?: number
        data?: User[]
      example:
        count: 42
        data:
            - id: "1"
              username: "John"
              full_name: "John Smith"
              profile_picture: "URL"
              website: "example.org"
              count:
                media: 2
                follows: 3
                followed_by: 5
    Resolution:
      type: object
      properties:
        url?: string
        width?: number
        height?: number
      example:
        url: "URL"
        width: 400
        height: 600
    Image:
      type: object
      properties:
        low_resolution?: Resolution
        thumbnail?: Resolution
        standard_resolution?: Resolution
      example:
        low_resolution:
          url: "URL"
          width: 200
          height: 400
        thumbnail:
          url: "URL"
          width: 400
          height: 600
        standard_resolution:
          url: "URL"
          width: 600
          height: 800
    TagsRecentMedia:
      type: object
      properties:
        data?: TagsRecentMediaItem []
      example:
        data:
          - type: "photo"
            tags:
              - "forest"
              - "flovers"
            comments:
              data:
                - created_time: "1382576494"
                  text: "text"
                  from:
                    username: "John"
                    id: "2000"
                    full_name: "John Smith"
                  id: "200"
              count: 1
            caption:
              created_time: "1382576494"
              text: "text"
              from:
                username: "John"
                id: "2000"
            likes:
              count: 42
              data:
                - id: "1"
                  username: "John"
                  full_name: "John Smith"
                  profile_picture: "URL"
                  website: "example.org"
                  count:
                    media: 2
                    follows: 3
                    followed_by: 5
            link: "link"
            created_time: "1386312776"
            images:
              low_resolution:
                url: "URL"
                width: 200
                height: 400
              thumbnail:
                url: "URL"
                width: 400
                height: 600
              standard_resolution:
                url: "URL"
                width: 600
                height: 800
            id: "id"
            location: "location"
    TagsRecentMediaItem:
      type: object
      properties:
        type?: string
        users_in_photo?: string[]
        filter?: string
        tags?: string[]
        comments?:
          type: object
          properties:
            data?: Comment[]
            count?: number
        caption?:
          type: Caption
        likes?: Likes
        link?: string
        created_time?: string
        images?: Image
        id?: string
        location?: string
      example:
        type: "photo"
        tags:
          - "forest"
          - "flovers"
        comments:
          data:
            - created_time: "1382576494"
              text: "text"
              from:
                username: "John"
                id: "2000"
                full_name: "John Smith"
              id: "200"
          count: 2
        caption:
          created_time: "1382576494"
          text: "text"
          from:
            username: "John"
            id: "2000"
        likes:
          count: 42
          data:
            - id: "1"
              username: "John"
              full_name: "John Smith"
              profile_picture: "URL"
              website: "example.org"
              count:
                media: 2
                follows: 3
                followed_by: 5
        link: "link"
        created_time: "1386312776"
        images:
          low_resolution:
            url: "URL"
            width: 200
            height: 400
          thumbnail:
            url: "URL"
            width: 400
            height: 600
          standard_resolution:
            url: "URL"
            width: 600
            height: 800
        id: "id"
        location: "location"
    UsersInPhoto:
      type: object
      properties:
        user: User
        position:
          type: object
          properties:
            x: number
            y: number
      example:
        user:
          id: "1"
          username: "John"
          full_name: "John Smith"
          profile_picture: "URL"
          website: "example.org"
          count:
            media: 2
            follows: 3
            followed_by: 5
        position:
          x: 275
          y: 705
    Media:
      type: object
      properties:
        data:
          type: object
          properties:
            users_in_photo: UsersInPhoto []
            filter: string
            tags?: string []
            comments:
              type: object
              properties:
                data?: Comment[]
                count?: number
            caption: string
            likes: Likes
            link: string
            user: User
            created_time: string
            images: Image
            id: string
            location: string
      example:
        data:
          users_in_photo:
            - user:
                id: "1"
                username: "John"
                full_name: "John Smith"
                profile_picture: "URL"
                website: "example.org"
                count:
                  media: 2
                  follows: 3
                  followed_by: 5
              position:
                x: 275
                y: 705
          filter: "filter"
          tags:
            - "forest"
            - "animals"
          comments:
            data:
              - created_time: "1382576494"
                text: "text"
                from:
                  username: "John"
                  id: "2000"
                  full_name: "John Smith"
                id: "200"
          caption: string
          likes:
            count: 42
            data:
              - id: "1"
                username: "John"
                full_name: "John Smith"
                profile_picture: "URL"
                website: "example.org"
                count:
                  media: 2
                  follows: 3
                  followed_by: 5
          link: "link"
          created_time: "1386312776"
          images:
            low_resolution:
              url: "URL"
              width: 200
              height: 400
            thumbnail:
              url: "URL"
              width: 400
              height: 600
            standard_resolution:
              url: "URL"
              width: 600
              height: 800
          id: "id"
          location: "location"
          user:
            id: "1"
            username: "John"
            full_name: "John Smith"
            profile_picture: "URL"
            website: "example.org"
            count:
              media: 2
              follows: 3
              followed_by: 5
    MediaSearchFirstType:
      type: object
      properties:
        distance: number
        users_in_photo: UsersInPhoto[]
        filter: string
        tags: string[]
        comments:
          type: object
          properties:
            data?: Comment[]
            count?: number
        caption: string
        likes: Likes
        link: string
        user: User
        created_time: string
        images: Image
        id: string
        location: string
      example:
        distance: 50
        users_in_photo:
          - user:
              id: "1"
              username: "John"
              full_name: "John Smith"
              profile_picture: "URL"
              website: "example.org"
              count:
                media: 2
                follows: 3
                followed_by: 5
            position:
              x: 275
              y: 705
        filter: "filter"
        tags:
          - "forest"
          - "animals"
        comments:
          data:
            - created_time: "1382576494"
              text: "text"
              from:
                username: "John"
                id: "2000"
                full_name: "John Smith"
              id: "200"
        caption: string
        likes:
          count: 42
          data:
            - id: "1"
              username: "John"
              full_name: "John Smith"
              profile_picture: "URL"
              website: "example.org"
              count:
                media: 2
                follows: 3
                followed_by: 5
        link: "link"
        created_time: "1386312776"
        images:
          low_resolution:
            url: "URL"
            width: 200
            height: 400
          thumbnail:
            url: "URL"
            width: 400
            height: 600
          standard_resolution:
            url: "URL"
            width: 600
            height: 800
        id: "id"
        location: "location"
        user:
          id: "1"
          username: "John"
          full_name: "John Smith"
          profile_picture: "URL"
          website: "example.org"
          count:
            media: 2
            follows: 3
            followed_by: 5
    MediaSearchSecondType:
      type: object
      properties:
        distance: number
        videos:
          type: object
          properties:
            low_resoulution:
              type: object
              properties:
                url: string
                width: integer
                height: integer
            standard_resoulution?:
              type: object
              properties:
                url: string
                width: integer
                height: integer
            users_in_photo: UsersInPhoto[]
            filter: string
            tags: string[]
            comments:
              type: object
              properties:
                data?: Comment[]
                count?: number
            caption: string
            likes: Likes
            link: string
            user: User
            created_time: string
            images: Image
            id: string
            location: string
      example:
        distance: 50
        videos:
          low_resoulution:
              url: "URL"
              width: 200
              height: 400
          standard_resoulution:
              url: "URL"
              width: 400
              height: 600
          users_in_photo:
            - user:
                id: "1"
                username: "John"
                full_name: "John Smith"
                profile_picture: "URL"
                website: "example.org"
                count:
                  media: 2
                  follows: 3
                  followed_by: 5
              position:
                x: 275
                y: 705
          filter: "filter"
          tags:
            - "forest"
            - "animals"
          comments:
            data:
              - created_time: "1382576494"
                text: "text"
                from:
                  username: "John"
                  id: "2000"
                  full_name: "John Smith"
                id: "200"
          caption: string
          likes:
            count: 42
            data:
              - id: "1"
                username: "John"
                full_name: "John Smith"
                profile_picture: "URL"
                website: "example.org"
                count:
                  media: 2
                  follows: 3
                  followed_by: 5
          link: "link"
          created_time: "1386312776"
          images:
            low_resolution:
              url: "URL"
              width: 200
              height: 400
            thumbnail:
              url: "URL"
              width: 400
              height: 600
            standard_resolution:
              url: "URL"
              width: 600
              height: 800
          id: "id"
          location: "location"
          user:
            id: "1"
            username: "John"
            full_name: "John Smith"
            profile_picture: "URL"
            website: "example.org"
            count:
              media: 2
              follows: 3
              followed_by: 5
    MediaSearch:
      type: object
      properties:
        meta?: Meta
        data: MediaSearchFirstType | MediaSearchSecondType


WIP add documentation for shipping guide

#%RAML 0.8
---
title: Shipping Guide API
baseUri: https://api.bring.com/shippingguide/products

documentation:
- title: Introduction
  content: |
      The Shipping Guide (Fraktguiden) is a free service from Bring that provides

      * price information,
      * service area (norwegian: dekningsområde), and
      * estimated delivery times.

      With the Shipping Guide it is easy to offer different shipping alternatives to your end customers. Whether they want to

      * get delivery to the door (daytime or evening),
      * pick up the shipment at a post office, or
      * get the shipment delivered to the mailbox

      The Shipping Guide returns the recommended way to present these shipping alternatives, as well as prices and delivery times.

      [Demo shipping alternatives](http://fraktguide.bring.no/fraktguide/demoVelgFraktalternativ.do?from=0484&to=0470&weightInGrams=800&length=10&width=20&height=5&product=servicepakke&product=pa_doren&product=bpakke_dor-dor&product=smaapakker_a-post&product=ekspress09&product=smaapakker_b-post&product=courier_1h&product=minipakke&callbackUrl=http://fraktguide.bring.no/fraktguide/popupCallback.jsp&date=2015-10-07) form (Norwegian).

      The demo shows that the Shipping Guide returns product categories for each request, making a shipping alternatives-page easy to set up. The focus is on delivery methods to the end customer, not product names.

      The Shipping Guide has several interfaces (SOAP and XML/JSON). Choose the option that fits your needs best (see table below). The SOAP interface is the core interface with complete functionality. There are some limitations in the XML/JSON API, such as the inability to mark a parcel as a specialized goods.

      There is also a [Offline SOAP service](http://developer.bring.com/additionalresources/offlinedata.html?from=shipping) for retrieving data for offline use (get complete prices, service area and delivery times based on a fixed sender postal code).

- title: Guidelines
  content: |
      `<MainDisplayCategory>` should be written in bold text and followed by our logo. [Get approved logo here](http://mediaweb.posten.no/fotoweb/Default.fwx?archiveId=5005).

      In the webshop you should display

      * `<MainDisplayCategory>`
      * `<DisplayName>`
      * `<DescriptionText>`

      Repeat the last two as needed, depending on the number of options you would like to display.

      The following values are not meant for display in the webshop and as such should not be visible on your site

      * `<Product>`
      * `<ProductId>`
      * `<ProductCodeInProductionSystem>`

      *We strongly advise that you give your customers at least two options, home delivery and pickup point.*

      | XML | JSON/JSONP | Web services/SOAP |
      |:----|:-----------|:------------------|
      | The XML API is an easy way to integrate with the Shipping Guide using plain HTTP clients. It is also the best API to use when exploring the service using a web browser. | Web browsers can (using JavaScript) retrieve information from external sites if the data are made available in JSONP format. The purpose is that you can paste HTML / Javascript on your web page and easily use data from the Shipping Guide without server components on your web page. See widgets. | The SOAP API has the complete feature set of the Shipping Guide. It requires a SOAP client and the use of our WSDL. It has an Online version (one request per shipment) or an offline version (e.g. nightly fetch prices, service area and delivery times based on a fixed consignor postal code). |

/price{mediaTypeExtension}:
  displayName: Get shipment prices
  securedBy: [mybring_headers, null]
  description: |
      TODO: description
  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    description: Get shipment prices
    queryParameters:
      from:
        description: Sending from postal code
        type: string
        example: 7600
      to:
        description: Sending to postal code
        type: string
        example: 1407
      weightInGrams:
        description: Weight of package in grams
        type: integer
        example: 1500
      width:
        description: Package width in centimeters
        type: integer
        example: 40
      length:
        description: Package length in centimeters
        type: integer
        example: 40
      height:
        description: Package height in centimeters
        type: integer
        example: 30
      date:
        description: Shipping date specifies which date the parcel will be delivered to Bring (within the timelimit), and is used to calculate the delivery date. Date is specified in ISO-format, YYYY-MM-DD.
        type: date
        example: 2015-11-18
      time:
        description: Shipping time may be specified. Note that Bring's courier products are the only one affected by this parameter. Time is specified in ISO-format, HH:mm.
        type: date
        example: 12:30
      clientUrl:
        displayName: Client URL
        description: To use the Shipping Guide you must specify a client url parameter. The client url should be set to the url of the web shop or application the end user is ordering from. The client url can be sent as a url parameter, clientUrl, or as a header, `X-Bring-Client-URL`.
        type: string
        example: https://www.example.org/webshop
      edi:
        displayName: EDI setting
        description: Flag that tells if the parcel will be registred using EDI when it is shipped. Note that this flag may affect price and which products are available.
        type: boolean
        default: true
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo
      foo:
        description: TODO
        type: string
        example: foo

    responses:
      200:
        displayName: Successful response
        body:
          application/json:
          application/xml:

/expectedDelivery{mediaTypeExtension}:
  displayName: Get estimated delivery time
  securedBy: [mybring_headers, null]
  description: |
      TODO: description
  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    description: Get estimated delivery time
    queryParameters:
      q:
        description: Reference, package number, shipment number to search for
        type: string
        required: true
        example: TESTPACKAGE-AT-PICKUPPOINT
      callback:
        description: JSONP callback function name
        type: string
        required: false

    responses:
      200:
        displayName: Successful response
        body:
          application/json:
          application/xml:

/all{mediaTypeExtension}:
  displayName: Get shipment prices, estimated delivery and more
  securedBy: [mybring_headers, null]
  description: |
      TODO: description
  uriParameters:
    mediaTypeExtension:
      enum: [ .json, .xml ]
      description: Use .json to specify application/json or .xml to specify application/xml
  get:
    description: Get shipment prices, estimated delivery and more
    queryParameters:
      q:
        description: Get shipment prices, estimated delivery time and additional information
        type: string
        required: true
        example: TESTPACKAGE-AT-PICKUPPOINT
      callback:
        description: JSONP callback function name
        type: string
        required: false

    responses:
      200:
        displayName: Successful response
        body:
          application/json:
          application/xml:


Update xsd and wsdl url

Update xsd and wsdl url

#%RAML 1.0
---
title: Shipping Guide API 2.0
baseUri: https://api.bring.com/shippingguide

documentation:
- title: Introduction
  content: |
      The Shipping Guide API 2.0 lets you query for shipping methods for your shipments. If you request applicable shipping methods with all details you will receive an object with the following data:

      - Prices
      - Estimated delivery times
      - GUI information

      The API returns the recommended way to present these shipping methods, meaning that the actual response can be shown in a web-shop checkout without any sorting or filtering and with human readable service texts.

      The Shipping Guide API 2.0 has both a REST and a SOAP interface. The REST interface only supports single consignments. While the SOAP interface can be used for multiple consignments.

      ### Why upgrade?

      * [Unified request and response model](/api/shipping-guide_2/#getting-started): Due to backward compatibility, existing SOAP API versions had too many ways of requesting to Shipping guide which was always confusing for clients. This has been simplified in new version with one unified way of requesting to Shipping guide.
      * [Better error handling for both SOAP and REST](/api/shipping-guide_2/#handle-api-errors): New version of API gives ability to handle error in much simpler way.
      * [Ability to fetch agreement prices specific to a product on REST](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery): Now you can specify multiple product and along with multiple customer number in a single REST request. [How?](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery)
      * [New restructured service models](): New product codes as part of Posten and Bring restructuring will be supported on new version only. More details on restructuring coming soon.

      ### How to upgrade
      Now that Shipping Guide API 2.0 is out you might be wondering how to upgrade to it. The [Upgrade to version 2](/api/shipping-guide_2/upgrade-to-version-2) will help you on your way to version 2 of the Shipping Guide API.

- title: Getting started
  content: |
      This guide will walk you through getting shipment methods for your first consignment using Shipping Guide API. In this example we will be calling the SOAP interface with a HTTP client and query for the services `SERVICEPAKKE` and `PA_DOREN` for two packages.

      ### Before you start
      Before you can begin using the new API you'll have to do the following:

      * [Sign up for a MyBring account](https://www.mybring.com/signup/register/user) if you do not already have one
      * [Generate an API key](/api/#authentication) for your user

      ### 1. Get your API key from Mybring
      To make API requests you will need an API key.

      To do this click the button below, which sends you to your "Settings and API" page in Mybring profile administration. Scroll down to the "API key" section. Your generated API key which you will use to authenticate your requests can be found here.

      Get API key

      ### 2. Add authentication headers
      A description of the headers can be found in [Getting Started / Authentication](/api/#authentication).

      ### 3. Add additional headers
      Since we're using the SOAP (1.1) interface we'll have to add the following header:

      - `Content-type: text/xml`

      Most SOAP libraries will do this for you.

      ### 4. Add the body to the request
      In this request we will query prices and expected delivery time for the service `SERVICEPAKKE` for a single package being sent from the postal code 0015 to 5518 in Norway.

      ```
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                        xmlns:ns="http://www.bring.no/logistics/shippingguide/2.0">
          <soapenv:Header/>
          <soapenv:Body>
              <ns:ShippingGuideRequest xmlns:ns="http://www.bring.no/logistics/shippingguide/2.0">
                  <ns:RequestProperties>
                      <ns:Language>no</ns:Language>
                      <ns:Trace>true</ns:Trace>
                  </ns:RequestProperties>
                  <ns:Consignments>
                      <ns:Consignment consignmentId="101">
                          <ns:ProductIds>
                              <ns:ProductId>SERVICEPAKKE</ns:ProductId>
                              <ns:ProductId>PA_DOREN</ns:ProductId>
                          </ns:ProductIds>
                          <ns:FromCountryCode>NO</ns:FromCountryCode>
                          <ns:FromPostalCode>0015</ns:FromPostalCode>
                          <ns:ToCountryCode>NO</ns:ToCountryCode>
                          <ns:ToPostalCode>5518</ns:ToPostalCode>
                          <ns:ShippingDate>
                              <ns:Year>2018</ns:Year>
                              <ns:Month>10</ns:Month>
                              <ns:Day>10</ns:Day>
                          </ns:ShippingDate>
                          <ns:Packages>
                              <ns:Package>
                                  <ns:Height>19</ns:Height>
                                  <ns:Width>12</ns:Width>
                                  <ns:Length>30</ns:Length>
                                  <ns:GrossWeight>120</ns:GrossWeight>
                              </ns:Package>
                              <ns:Package>
                                  <ns:Height>30</ns:Height>
                                  <ns:Width>15</ns:Width>
                                  <ns:Length>22</ns:Length>
                                  <ns:GrossWeight>240</ns:GrossWeight>
                              </ns:Package>
                          </ns:Packages>
                      </ns:Consignment>
                  </ns:Consignments>
              </ns:ShippingGuideRequest>
          </soapenv:Body>
      </soapenv:Envelope>
      ```

      ### 5. Submit the request

      Post at:

      ```

        https://api.bring.com/shippingguide/api/ws

      ```

      The response may have changed since it was documented but you will get a response that looks something like this:

      ```
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
          <SOAP-ENV:Header/>
          <SOAP-ENV:Body>
              <ns2:ShippingGuideResponse xmlns:ns2="http://www.bring.no/logistics/shippingguide/2.0">
                  <ns2:TraceMessages>
                      <ns2:Message>Defaulting to current time of day as no hour and minute component present in date time element.</ns2:Message>
                      <ns2:Message>Added fee 'brev-varsling' (NOK 13.00) to base price of SERVICEPAKKE since request did not have additional service 'eVarsling' specified.</ns2:Message>
                  </ns2:TraceMessages>
                  <ns2:Consignments>
                      <ns2:Consignment consignmentId="101">
                          <ns2:Products>
                              <ns2:Product>
                                  <ns2:ProductId>SERVICEPAKKE</ns2:ProductId>
                                  <ns2:ProductCodeInProductionSystem>1202</ns2:ProductCodeInProductionSystem>
                                  <ns2:GuiInformation>
                                      <ns2:SortOrder>11</ns2:SortOrder>
                                      <ns2:MainDisplayCategory>Pakke</ns2:MainDisplayCategory>
                                      <ns2:SubDisplayCategory>Til private</ns2:SubDisplayCategory>
                                      <ns2:DisplayName>Klimanøytral Servicepakke</ns2:DisplayName>
                                      <ns2:ProductName>Klimanøytral Servicepakke</ns2:ProductName>
                                      <ns2:DescriptionText>Pakken kan spores og utleveres på ditt lokale hentested.</ns2:DescriptionText>
                                      <ns2:HelpText>Klimanøytral Servicepakke leveres til mottakers lokale hentested (postkontor eller Post i Butikk). Mottaker kan velge å hente sendingen på et annet hentested enn sitt lokale. Mottaker varsles om at sendingen er ankommet via SMS, e-post eller hentemelding i postkassen. Sendingen kan spores ved hjelp av sporingsnummeret.</ns2:HelpText>
                                      <ns2:ShortName>Klimanøytral Servicepakke</ns2:ShortName>
                                      <ns2:ProductURL>http://www.bring.no/sende/pakker/private-i-norge/hentes-pa-posten</ns2:ProductURL>
                                      <ns2:DeliveryType>Hentested</ns2:DeliveryType>
                                      <ns2:Tip/>
                                      <ns2:MaxWeightInKgs>35</ns2:MaxWeightInKgs>
                                  </ns2:GuiInformation>
                                  <ns2:Price currencyIdentificationCode="NOK">
                                      <ns2:PriceWithoutAdditionalServices>
                                          <ns2:AmountWithoutVAT>239.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>59.75</ns2:VAT>
                                          <ns2:AmountWithVAT>298.75</ns2:AmountWithVAT>
                                      </ns2:PriceWithoutAdditionalServices>
                                      <ns2:PriceWithAdditionalServices>
                                          <ns2:AmountWithoutVAT>239.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>59.75</ns2:VAT>
                                          <ns2:AmountWithVAT>298.75</ns2:AmountWithVAT>
                                      </ns2:PriceWithAdditionalServices>
                                  </ns2:Price>
                                  <ns2:ExpectedDelivery>
                                      <ns2:WorkingDays>2</ns2:WorkingDays>
                                      <ns2:UserMessage/>
                                      <ns2:FormattedExpectedDeliveryDate>12.10.2018</ns2:FormattedExpectedDeliveryDate>
                                      <ns2:ExpectedDeliveryDate>
                                          <ns2:Year>2018</ns2:Year>
                                          <ns2:Month>10</ns2:Month>
                                          <ns2:Day>12</ns2:Day>
                                      </ns2:ExpectedDeliveryDate>
                                      <ns2:AlternativeDeliveryDates/>
                                  </ns2:ExpectedDelivery>
                              </ns2:Product>
                              <ns2:Product>
                                  <ns2:ProductId>PA_DOREN</ns2:ProductId>
                                  <ns2:ProductCodeInProductionSystem>1736</ns2:ProductCodeInProductionSystem>
                                  <ns2:GuiInformation>
                                      <ns2:SortOrder>41</ns2:SortOrder>
                                      <ns2:MainDisplayCategory>Pakke</ns2:MainDisplayCategory>
                                      <ns2:SubDisplayCategory>Til private</ns2:SubDisplayCategory>
                                      <ns2:DisplayName>På Døren</ns2:DisplayName>
                                      <ns2:ProductName>På Døren</ns2:ProductName>
                                      <ns2:DescriptionText>Pakken kan spores og leveres hjem til deg mellom kl. 17-21. Sjåføren ringer 30-60 min før ankomst.</ns2:DescriptionText>
                                      <ns2:HelpText>På Døren leveres hjem til mottaker mellom kl. 17 og 21. Mottaker varsles i god tid om forventet utleveringsdag via SMS eller e-post, i tillegg til nytt varsel når sendingen er lastet på bil for utkjøring samme kveld. Sjåføren ringer mottaker 30-60 minutter før ankomst. Mottaker kan endre leveringsdag når pakken spores (gjelder ikke lokalpakker). Dersom sendingen ikke kan leveres, blir den sendt til mottakers lokale hentested (postkontor eller Post i Butikk). Sendingen kan spores ved hjelp av sporingsnummeret.</ns2:HelpText>
                                      <ns2:ShortName>På Døren</ns2:ShortName>
                                      <ns2:ProductURL>http://www.bring.no/sende/pakker/private-i-norge/hjemlevering</ns2:ProductURL>
                                      <ns2:DeliveryType>Dør</ns2:DeliveryType>
                                      <ns2:Tip/>
                                      <ns2:MaxWeightInKgs>35</ns2:MaxWeightInKgs>
                                  </ns2:GuiInformation>
                                  <ns2:Price currencyIdentificationCode="NOK">
                                      <ns2:PriceWithoutAdditionalServices>
                                          <ns2:AmountWithoutVAT>270.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>67.50</ns2:VAT>
                                          <ns2:AmountWithVAT>337.50</ns2:AmountWithVAT>
                                      </ns2:PriceWithoutAdditionalServices>
                                      <ns2:PriceWithAdditionalServices>
                                          <ns2:AmountWithoutVAT>270.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>67.50</ns2:VAT>
                                          <ns2:AmountWithVAT>337.50</ns2:AmountWithVAT>
                                      </ns2:PriceWithAdditionalServices>
                                  </ns2:Price>
                                  <ns2:ExpectedDelivery>
                                      <ns2:WorkingDays/>
                                      <ns2:UserMessage>Ingen fremsendingstidsgaranti for oppgitt tilpostnummer.</ns2:UserMessage>
                                      <ns2:FormattedExpectedDeliveryDate/>
                                      <ns2:AlternativeDeliveryDates/>
                                      <ns2:FormattedEarliestPickupDate/>
                                  </ns2:ExpectedDelivery>
                              </ns2:Product>
                          </ns2:Products>
                      </ns2:Consignment>
                  </ns2:Consignments>
              </ns2:ShippingGuideResponse>
          </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      ```

      If you want to know more about the fields you can have a look at the XSD linked from the section [Request and response structure](/api/shipping-guide_2/#request-and-response-structure)

- title: Shipping Guide topics
  content: |
      If you want to know more about corner cases/topics/etc, then [Let's talk about Shipping Guide](/api/shipping-guide_2/topics)

- title: Handle API errors
  content: |
      When using the Shipping Guide it is important to handle errors gracefully. Your users should still be able to order even if the Shipping Guide API returns an error or if there is an error establishing a connection to the API.

      The Shipping Guide API return two levels of error information:

      * HTTP error codes or SOAP fault with a message in the body

        For REST we follow general convention of HTTP status codes.
        For SOAP we give out detailed error decription along with an error code which can be parsed programmatically.

        ```
        <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
            <SOAP-ENV:Header/>
            <SOAP-ENV:Body>
                <SOAP-ENV:Fault>
                    <faultcode>SOAP-ENV:Client</faultcode>
                    <faultstring>FG_INPUT_010 Number of alternative delivery dates must be numeric and less than 10 [errorId 2806bbda-1df0-4b1b-b008-1068f5c57f06]
                    </faultstring>
                    <detail>
                        <code>FG_INPUT_010</code>
                        <description>Error number of alternative deliverydates</description>
                    </detail>
                </SOAP-ENV:Fault>
            </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>
        ```

        Possible error codes can be found [here](https://api.bring.com/shippingguide/api/errors?clientUrl=developer.bring.com)

      * An error object in the response that is on a service level

        When we are not able to process one of the product requested, we will respond with a error on product level. Details of possible error codes are documented in [XSD](https://api.bring.com/shippingguide/api/ws/shipping-guide-2.0.xsd) and [WDSL](https://api.bring.com/shippingguide/api/ws/shippingguide-2.0.wsdl) itself, making it easier for clients to parse it.

- title: Request and response structure
  content: |
      If you request shipping methods via the API your request and response will have to comply with the following schemas:

      #### SOAP

      [https://api.bring.com/shippingguide/api/ws/shipping-guide-20.xsd](https://api.bring.com/shippingguide/api/ws/shipping-guide-20.xsd)

      [https://api.bring.com/shippingguide/api/ws/shippingguide-20.wsdl](https://api.bring.com/shippingguide/api/ws/shippingguide-20.wsdl)

- title: Improve performance
  content: |
      To have better performance of the api

      * Request can be limited to have only the services needed since the response time of some services can be slow as compared to others
      * If the request is only to find the lead time / prices of different services, the flag for withExpectedDelivery / withPrices should be set to true and others can be set to false
      * For net prices requests should include customer number and correct package details
      * Request can include limited number of consignments in each request for quick response.
      * New shipments request can be part of separate request

/v2/services:
  displayName: Get shipment prices and estimated delivery
  description: Use this endpoint to get expected delivery, product categories and additional information.
  get:
    description: Get shipment prices
    headers:
      X-MyBring-API-Uid:
        description: Your Mybring login ID
      X-MyBring-API-Key:
        description: Your user's API key
      Content-Type:
        description: The API key needed to create a new job
    queryParameters:
      fromcountry:
        description: Sender country code
        type: string
      tocountry:
        description: Receiver country code
        type: string
      frompostalcode:
        description: Sender postal code
        type: string
      topostalcode:
        description: Receiver postal code
        type: string
      product:
        description: List of products requested. Multiple products can be requested in a single request. Requested product can also be specified with a customer number separated with delimiter (**:**). For example CARGO**:**CARGO-123456
        type: string
      date:
        description: Shipping date
        type: date
        example: 2018-11-18
        required: false
      time:
        description: Shipping time
        type: date
        example: 12:30
        required: false
      weight:
        description: Package weight in grams
        type: integer
        required: false
      volumeindm3:
        description: Package volume in dm3
        type: integer
        required: false
      loadingmeter:
        description: Package loading meters
        type: double
        required: false
      width:
        description: Package width in cm
        type: integer
        required: false
      length:
        description: Package length in cm
        type: integer
        required: false
      height:
        description: Package height in cm
        type: integer
        required: false
      numberofpallets:
        displayName: Number of pallets
        type: integer
        required: false
      nonstackable:
        description: Set to true if you know that pallet would be non-stackable
        type: boolean
        required: false
        default: false
      edi:
        description: Tells if the parcel will be registered using EDI when being booked. It may affect price and which services are available
        type: boolean
        required: false
        default: true
      postingatpostoffice:
        description: |
          Tells whether the parcel is delivered at a post office when it is shipped. A surcharge will be applied for SERVICEPAKKE and BPAKKE_DOR-DOR
        type: boolean
        required: false
        default: false
      additional:
        displayName: Additional service
        description: Multiple additional services can be requested by repeating this parameter
        required: false
        type: string
      service:
        description: Multiple services can be requested by repeating this parameter
        type: string
        required: true
      customernumber:
        description: Lets you specify which customer number to use in the request. If specified and product is not supplied with delimited customer number, then it will be applied on all request products
        type: string
        example: CARGO-123456
        required: false
      language:
        description: Language used for the service texts
        type: string
        default: no
        required: false
      volumeSpecial:
        description: True if the package has a shape that requires special handling
        type: boolean
        default: false
        required: false

    responses:
      200:
        displayName: Successful response
        description: |
          A successful response
      400:
        displayName: User error
        description: |
          This can mean that a required field or parameter has not been provided, the value supplied is invalid, or the combination of provided fields is invalid.
      401:
        displayName: Unauthorized
        description: |
          A failed response when the request is unauthenticated

/v2/services/price:
  displayName: Get shipment prices
  description: |
      Use this endpoint to get prices. The request parameters are the same as for [Get shipment prices and estimated delivery](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery)
  get:
    description: Use this endpoint to get price. The request parameters are the same as for [Get shipment prices and estimated delivery](/api/shipping-guide_v2/#get-shipment-prices-and-estimated-delivery)

/v2/services/expectedDelivery:
  displayName: Get expected delivery times
  description: |
      Use this endpoint to get expected delivery. The request parameters are the same as for [Get shipment prices and estimated delivery](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery)
  get:
    description: Get estimated delivery time

/api/ws:
  displayName: Get shipment prices and estimated delivery
  description: Use this endpoint to get expected delivery, product categories and additional information.
  post:
    description: Use this endpoint to get expected delivery, product categories and additional information.
    headers:
      X-MyBring-API-Uid:
        description: Your Mybring login ID
      X-MyBring-API-Key:
        description: Your user's API key
      Content-Type:
        description: The API key needed to create a new job

#%RAML 1.0
---
title: Shipping Guide API 2.0
baseUri: https://api.bring.com/shippingguide

documentation:
- title: Introduction
  content: |
      The Shipping Guide API 2.0 lets you query for shipping methods for your shipments. If you request applicable shipping methods with all details you will receive an object with the following data:

      - Prices
      - Estimated delivery times
      - GUI information

      The API returns the recommended way to present these shipping methods, meaning that the actual response can be shown in a web-shop checkout without any sorting or filtering and with human readable service texts.

      The Shipping Guide API 2.0 has both a REST and a SOAP interface. The REST interface only supports single consignments. While the SOAP interface can be used for multiple consignments.

      ### Why upgrade?

      * [Unified request and response model](/api/shipping-guide_2/#getting-started): Due to backward compatibility, existing SOAP API versions had too many ways of requesting to Shipping guide which was always confusing for clients. This has been simplified in new version with one unified way of requesting to Shipping guide.
      * [Better error handling for both SOAP and REST](/api/shipping-guide_2/#handle-api-errors): New version of API gives ability to handle error in much simpler way.
      * [Ability to fetch agreement prices specific to a product on REST](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery): Now you can specify multiple product and along with multiple customer number in a single REST request. [How?](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery)
      * [New restructured service models](): New product codes as part of Posten and Bring restructuring will be supported on new version only. More details on restructuring coming soon.

      ### How to upgrade
      Now that Shipping Guide API 2.0 is out you might be wondering how to upgrade to it. The [Upgrade to version 2](/api/shipping-guide_2/upgrade-to-version-2) will help you on your way to version 2 of the Shipping Guide API.

- title: Getting started
  content: |
      This guide will walk you through getting shipment methods for your first consignment using Shipping Guide API. In this example we will be calling the SOAP interface with a HTTP client and query for the services `SERVICEPAKKE` and `PA_DOREN` for two packages.

      ### Before you start
      Before you can begin using the new API you'll have to do the following:

      * [Sign up for a MyBring account](https://www.mybring.com/signup/register/user) if you do not already have one
      * [Generate an API key](/api/#authentication) for your user

      ### 1. Get your API key from Mybring
      To make API requests you will need an API key.

      To do this click the button below, which sends you to your "Settings and API" page in Mybring profile administration. Scroll down to the "API key" section. Your generated API key which you will use to authenticate your requests can be found here.

      Get API key

      ### 2. Add authentication headers
      A description of the headers can be found in [Getting Started / Authentication](/api/#authentication).

      ### 3. Add additional headers
      Since we're using the SOAP (1.1) interface we'll have to add the following header:

      - `Content-type: text/xml`

      Most SOAP libraries will do this for you.

      ### 4. Add the body to the request
      In this request we will query prices and expected delivery time for the service `SERVICEPAKKE` for a single package being sent from the postal code 0015 to 5518 in Norway.

      ```
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                        xmlns:ns="http://www.bring.no/logistics/shippingguide/2.0">
          <soapenv:Header/>
          <soapenv:Body>
              <ns:ShippingGuideRequest xmlns:ns="http://www.bring.no/logistics/shippingguide/2.0">
                  <ns:RequestProperties>
                      <ns:Language>no</ns:Language>
                      <ns:Trace>true</ns:Trace>
                  </ns:RequestProperties>
                  <ns:Consignments>
                      <ns:Consignment consignmentId="101">
                          <ns:ProductIds>
                              <ns:ProductId>SERVICEPAKKE</ns:ProductId>
                              <ns:ProductId>PA_DOREN</ns:ProductId>
                          </ns:ProductIds>
                          <ns:FromCountryCode>NO</ns:FromCountryCode>
                          <ns:FromPostalCode>0015</ns:FromPostalCode>
                          <ns:ToCountryCode>NO</ns:ToCountryCode>
                          <ns:ToPostalCode>5518</ns:ToPostalCode>
                          <ns:ShippingDate>
                              <ns:Year>2018</ns:Year>
                              <ns:Month>10</ns:Month>
                              <ns:Day>10</ns:Day>
                          </ns:ShippingDate>
                          <ns:Packages>
                              <ns:Package>
                                  <ns:Height>19</ns:Height>
                                  <ns:Width>12</ns:Width>
                                  <ns:Length>30</ns:Length>
                                  <ns:GrossWeight>120</ns:GrossWeight>
                              </ns:Package>
                              <ns:Package>
                                  <ns:Height>30</ns:Height>
                                  <ns:Width>15</ns:Width>
                                  <ns:Length>22</ns:Length>
                                  <ns:GrossWeight>240</ns:GrossWeight>
                              </ns:Package>
                          </ns:Packages>
                      </ns:Consignment>
                  </ns:Consignments>
              </ns:ShippingGuideRequest>
          </soapenv:Body>
      </soapenv:Envelope>
      ```

      ### 5. Submit the request

      Post at:

      ```

        https://api.bring.com/shippingguide/api/ws

      ```

      The response may have changed since it was documented but you will get a response that looks something like this:

      ```
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
          <SOAP-ENV:Header/>
          <SOAP-ENV:Body>
              <ns2:ShippingGuideResponse xmlns:ns2="http://www.bring.no/logistics/shippingguide/2.0">
                  <ns2:TraceMessages>
                      <ns2:Message>Defaulting to current time of day as no hour and minute component present in date time element.</ns2:Message>
                      <ns2:Message>Added fee 'brev-varsling' (NOK 13.00) to base price of SERVICEPAKKE since request did not have additional service 'eVarsling' specified.</ns2:Message>
                  </ns2:TraceMessages>
                  <ns2:Consignments>
                      <ns2:Consignment consignmentId="101">
                          <ns2:Products>
                              <ns2:Product>
                                  <ns2:ProductId>SERVICEPAKKE</ns2:ProductId>
                                  <ns2:ProductCodeInProductionSystem>1202</ns2:ProductCodeInProductionSystem>
                                  <ns2:GuiInformation>
                                      <ns2:SortOrder>11</ns2:SortOrder>
                                      <ns2:MainDisplayCategory>Pakke</ns2:MainDisplayCategory>
                                      <ns2:SubDisplayCategory>Til private</ns2:SubDisplayCategory>
                                      <ns2:DisplayName>Klimanøytral Servicepakke</ns2:DisplayName>
                                      <ns2:ProductName>Klimanøytral Servicepakke</ns2:ProductName>
                                      <ns2:DescriptionText>Pakken kan spores og utleveres på ditt lokale hentested.</ns2:DescriptionText>
                                      <ns2:HelpText>Klimanøytral Servicepakke leveres til mottakers lokale hentested (postkontor eller Post i Butikk). Mottaker kan velge å hente sendingen på et annet hentested enn sitt lokale. Mottaker varsles om at sendingen er ankommet via SMS, e-post eller hentemelding i postkassen. Sendingen kan spores ved hjelp av sporingsnummeret.</ns2:HelpText>
                                      <ns2:ShortName>Klimanøytral Servicepakke</ns2:ShortName>
                                      <ns2:ProductURL>http://www.bring.no/sende/pakker/private-i-norge/hentes-pa-posten</ns2:ProductURL>
                                      <ns2:DeliveryType>Hentested</ns2:DeliveryType>
                                      <ns2:Tip/>
                                      <ns2:MaxWeightInKgs>35</ns2:MaxWeightInKgs>
                                  </ns2:GuiInformation>
                                  <ns2:Price currencyIdentificationCode="NOK">
                                      <ns2:PriceWithoutAdditionalServices>
                                          <ns2:AmountWithoutVAT>239.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>59.75</ns2:VAT>
                                          <ns2:AmountWithVAT>298.75</ns2:AmountWithVAT>
                                      </ns2:PriceWithoutAdditionalServices>
                                      <ns2:PriceWithAdditionalServices>
                                          <ns2:AmountWithoutVAT>239.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>59.75</ns2:VAT>
                                          <ns2:AmountWithVAT>298.75</ns2:AmountWithVAT>
                                      </ns2:PriceWithAdditionalServices>
                                  </ns2:Price>
                                  <ns2:ExpectedDelivery>
                                      <ns2:WorkingDays>2</ns2:WorkingDays>
                                      <ns2:UserMessage/>
                                      <ns2:FormattedExpectedDeliveryDate>12.10.2018</ns2:FormattedExpectedDeliveryDate>
                                      <ns2:ExpectedDeliveryDate>
                                          <ns2:Year>2018</ns2:Year>
                                          <ns2:Month>10</ns2:Month>
                                          <ns2:Day>12</ns2:Day>
                                      </ns2:ExpectedDeliveryDate>
                                      <ns2:AlternativeDeliveryDates/>
                                  </ns2:ExpectedDelivery>
                              </ns2:Product>
                              <ns2:Product>
                                  <ns2:ProductId>PA_DOREN</ns2:ProductId>
                                  <ns2:ProductCodeInProductionSystem>1736</ns2:ProductCodeInProductionSystem>
                                  <ns2:GuiInformation>
                                      <ns2:SortOrder>41</ns2:SortOrder>
                                      <ns2:MainDisplayCategory>Pakke</ns2:MainDisplayCategory>
                                      <ns2:SubDisplayCategory>Til private</ns2:SubDisplayCategory>
                                      <ns2:DisplayName>På Døren</ns2:DisplayName>
                                      <ns2:ProductName>På Døren</ns2:ProductName>
                                      <ns2:DescriptionText>Pakken kan spores og leveres hjem til deg mellom kl. 17-21. Sjåføren ringer 30-60 min før ankomst.</ns2:DescriptionText>
                                      <ns2:HelpText>På Døren leveres hjem til mottaker mellom kl. 17 og 21. Mottaker varsles i god tid om forventet utleveringsdag via SMS eller e-post, i tillegg til nytt varsel når sendingen er lastet på bil for utkjøring samme kveld. Sjåføren ringer mottaker 30-60 minutter før ankomst. Mottaker kan endre leveringsdag når pakken spores (gjelder ikke lokalpakker). Dersom sendingen ikke kan leveres, blir den sendt til mottakers lokale hentested (postkontor eller Post i Butikk). Sendingen kan spores ved hjelp av sporingsnummeret.</ns2:HelpText>
                                      <ns2:ShortName>På Døren</ns2:ShortName>
                                      <ns2:ProductURL>http://www.bring.no/sende/pakker/private-i-norge/hjemlevering</ns2:ProductURL>
                                      <ns2:DeliveryType>Dør</ns2:DeliveryType>
                                      <ns2:Tip/>
                                      <ns2:MaxWeightInKgs>35</ns2:MaxWeightInKgs>
                                  </ns2:GuiInformation>
                                  <ns2:Price currencyIdentificationCode="NOK">
                                      <ns2:PriceWithoutAdditionalServices>
                                          <ns2:AmountWithoutVAT>270.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>67.50</ns2:VAT>
                                          <ns2:AmountWithVAT>337.50</ns2:AmountWithVAT>
                                      </ns2:PriceWithoutAdditionalServices>
                                      <ns2:PriceWithAdditionalServices>
                                          <ns2:AmountWithoutVAT>270.00</ns2:AmountWithoutVAT>
                                          <ns2:VAT>67.50</ns2:VAT>
                                          <ns2:AmountWithVAT>337.50</ns2:AmountWithVAT>
                                      </ns2:PriceWithAdditionalServices>
                                  </ns2:Price>
                                  <ns2:ExpectedDelivery>
                                      <ns2:WorkingDays/>
                                      <ns2:UserMessage>Ingen fremsendingstidsgaranti for oppgitt tilpostnummer.</ns2:UserMessage>
                                      <ns2:FormattedExpectedDeliveryDate/>
                                      <ns2:AlternativeDeliveryDates/>
                                      <ns2:FormattedEarliestPickupDate/>
                                  </ns2:ExpectedDelivery>
                              </ns2:Product>
                          </ns2:Products>
                      </ns2:Consignment>
                  </ns2:Consignments>
              </ns2:ShippingGuideResponse>
          </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      ```

      If you want to know more about the fields you can have a look at the XSD linked from the section [Request and response structure](/api/shipping-guide_2/#request-and-response-structure)

- title: Shipping Guide topics
  content: |
      If you want to know more about corner cases/topics/etc, then [Let's talk about Shipping Guide](/api/shipping-guide_2/topics)

- title: Handle API errors
  content: |
      When using the Shipping Guide it is important to handle errors gracefully. Your users should still be able to order even if the Shipping Guide API returns an error or if there is an error establishing a connection to the API.

      The Shipping Guide API return two levels of error information:

      * HTTP error codes or SOAP fault with a message in the body

        For REST we follow general convention of HTTP status codes.
        For SOAP we give out detailed error decription along with an error code which can be parsed programmatically.

        ```
        <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
            <SOAP-ENV:Header/>
            <SOAP-ENV:Body>
                <SOAP-ENV:Fault>
                    <faultcode>SOAP-ENV:Client</faultcode>
                    <faultstring>FG_INPUT_010 Number of alternative delivery dates must be numeric and less than 10 [errorId 2806bbda-1df0-4b1b-b008-1068f5c57f06]
                    </faultstring>
                    <detail>
                        <code>FG_INPUT_010</code>
                        <description>Error number of alternative deliverydates</description>
                    </detail>
                </SOAP-ENV:Fault>
            </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>
        ```

        Possible error codes can be found [here](https://api.bring.com/shippingguide/api/errors?clientUrl=developer.bring.com)

      * An error object in the response that is on a service level

        When we are not able to process one of the product requested, we will respond with a error on product level. Details of possible error codes are documented in [XSD](https://api.bring.com/shippingguide/api/ws/shipping-guide-2.0.xsd) and [WDSL](https://api.bring.com/shippingguide/api/ws/shippingguide-2.0.wsdl) itself, making it easier for clients to parse it.

- title: Request and response structure
  content: |
      If you request shipping methods via the API your request and response will have to comply with the following schemas:

      #### SOAP

      [https://api.bring.com/shippingguide/api/ws/shipping-guide-2.0.xsd](https://api.bring.com/shippingguide/api/ws/shipping-guide-2.0.xsd)

      [https://api.bring.com/shippingguide/api/ws/shippingguide-2.0.wsdl](https://api.bring.com/shippingguide/api/ws/shippingguide-2.0.wsdl)

- title: Improve performance
  content: |
      To have better performance of the api

      * Request can be limited to have only the services needed since the response time of some services can be slow as compared to others
      * If the request is only to find the lead time / prices of different services, the flag for withExpectedDelivery / withPrices should be set to true and others can be set to false
      * For net prices requests should include customer number and correct package details
      * Request can include limited number of consignments in each request for quick response.
      * New shipments request can be part of separate request

/v2/services:
  displayName: Get shipment prices and estimated delivery
  description: Use this endpoint to get expected delivery, product categories and additional information.
  get:
    description: Get shipment prices
    headers:
      X-MyBring-API-Uid:
        description: Your Mybring login ID
      X-MyBring-API-Key:
        description: Your user's API key
      Content-Type:
        description: The API key needed to create a new job
    queryParameters:
      fromcountry:
        description: Sender country code
        type: string
      tocountry:
        description: Receiver country code
        type: string
      frompostalcode:
        description: Sender postal code
        type: string
      topostalcode:
        description: Receiver postal code
        type: string
      product:
        description: List of products requested. Multiple products can be requested in a single request. Requested product can also be specified with a customer number separated with delimiter (**:**). For example CARGO**:**CARGO-123456
        type: string
      date:
        description: Shipping date
        type: date
        example: 2018-11-18
        required: false
      time:
        description: Shipping time
        type: date
        example: 12:30
        required: false
      weight:
        description: Package weight in grams
        type: integer
        required: false
      volumeindm3:
        description: Package volume in dm3
        type: integer
        required: false
      loadingmeter:
        description: Package loading meters
        type: double
        required: false
      width:
        description: Package width in cm
        type: integer
        required: false
      length:
        description: Package length in cm
        type: integer
        required: false
      height:
        description: Package height in cm
        type: integer
        required: false
      numberofpallets:
        displayName: Number of pallets
        type: integer
        required: false
      nonstackable:
        description: Set to true if you know that pallet would be non-stackable
        type: boolean
        required: false
        default: false
      edi:
        description: Tells if the parcel will be registered using EDI when being booked. It may affect price and which services are available
        type: boolean
        required: false
        default: true
      postingatpostoffice:
        description: |
          Tells whether the parcel is delivered at a post office when it is shipped. A surcharge will be applied for SERVICEPAKKE and BPAKKE_DOR-DOR
        type: boolean
        required: false
        default: false
      additional:
        displayName: Additional service
        description: Multiple additional services can be requested by repeating this parameter
        required: false
        type: string
      service:
        description: Multiple services can be requested by repeating this parameter
        type: string
        required: true
      customernumber:
        description: Lets you specify which customer number to use in the request. If specified and product is not supplied with delimited customer number, then it will be applied on all request products
        type: string
        example: CARGO-123456
        required: false
      language:
        description: Language used for the service texts
        type: string
        default: no
        required: false
      volumeSpecial:
        description: True if the package has a shape that requires special handling
        type: boolean
        default: false
        required: false

    responses:
      200:
        displayName: Successful response
        description: |
          A successful response
      400:
        displayName: User error
        description: |
          This can mean that a required field or parameter has not been provided, the value supplied is invalid, or the combination of provided fields is invalid.
      401:
        displayName: Unauthorized
        description: |
          A failed response when the request is unauthenticated

/v2/services/price:
  displayName: Get shipment prices
  description: |
      Use this endpoint to get prices. The request parameters are the same as for [Get shipment prices and estimated delivery](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery)
  get:
    description: Use this endpoint to get price. The request parameters are the same as for [Get shipment prices and estimated delivery](/api/shipping-guide_v2/#get-shipment-prices-and-estimated-delivery)

/v2/services/expectedDelivery:
  displayName: Get expected delivery times
  description: |
      Use this endpoint to get expected delivery. The request parameters are the same as for [Get shipment prices and estimated delivery](/api/shipping-guide_2/#get-shipment-prices-and-estimated-delivery)
  get:
    description: Get estimated delivery time

/api/ws:
  displayName: Get shipment prices and estimated delivery
  description: Use this endpoint to get expected delivery, product categories and additional information.
  post:
    description: Use this endpoint to get expected delivery, product categories and additional information.
    headers:
      X-MyBring-API-Uid:
        description: Your Mybring login ID
      X-MyBring-API-Key:
        description: Your user's API key
      Content-Type:
        description: The API key needed to create a new job


api doc update

api doc update

#%RAML 1.0
title: Citadel REST API
version: v1
schemas:
  - Metadata: |
     {
       "$schema": "http://json-schema.org/draft-03/schema",
       "type": "object",
       "properties": {
         "srcid": { "type": "string"},
         "unit": { "type": "string"},
         "pointType": { "type": "string"}
       }
     }
  - Datum: |
      {
        "$schema": "http://json-schema.org/draft-03/schema",
        "type": "object",
        "properties": {
          "srcid": { "type": "string"},
          "value": { "type": "double"},
          "geometryType": { "type": "string"},
          "coordinates": [[{"type": "double"}]]
        }
      }
  - Data: |
      [
        schema: Datum
      ]

/api:
  get:
    responses:
      200:
        body:
          {API Documentation}
  /point:
    post:
      responses:
        201:
          body:
            application/json:
              example:
    /{srcid}
      get:
        responses:
          200:
            body:
              application/json:
                schema: Metadata
  /data:
    get:
      responses:
        200:
    post:
      bpdy:
        application/json:
          schema: Data
      responses:
        201:
          body:
            {}
  /query:
    post:
      body:
        application/json:
          {}
      responses:
        200:
          body:
            application/json:
              schema: |
                {}
  /querydata:
    post:
      body:
        application/json:
          {}
      responses:
        200:
          body:
            application/json:
              schema: |
                {}

#%RAML 1.0
title: Citadel REST API
version: v1
schemas:
  - Metadata: |
     {
       "$schema": "http://json-schema.org/draft-03/schema",
       "type": "object",
       "properties": {
         "srcid": { "type": "string"},
         "unit": { "type": "string"},
         "pointType": { "type": "string"}
       }
     }

/api/point:
  post:
    responses:
      201:
        body:
          application/json:
            example:
  /{srcid}
    get:
      responses:
        200:
          body:
            application/json:
              schema: Metadata

  /{srcid}:
    get:
      responses:
        200:
          body:
            application/json:
              schema: |
                {}
    /data:
      get:
        responses:
          200:
      post:
        responses:
          201:
            body:
              application/json:
                example: |
                  {
                    "srcid": "random_srcid_str",
                    "timestamp": 1500161205,
                    "value": "1.31",
                    "geometry": {
                      "type": "point",
                      "coordinates": [-117.224590, 32.865847],
                    }
                  }
/api/query:
  post:
    responses:
      200:
        body:
          application/json:
            schema: |
              {}
/api/querydata:
  post:
    responses:
      200:
        body:
          application/json:
            schema: |
              {}