User Tools

Site Tools


api:destination:provider:update

API : Destination provider Update

Introduction

This request will bulk update the provider cost prices of multiple destinations at once. Each destination in the body gets its breakouts replaced with the ones supplied; destinations that do not exist are created. It is intended to save the result of Destination Provider Upload.

Request

URL https://api.telecomx.dk/destination/provider/update
Method POST
Access level RESELLER_ADMIN with FINANCE feature, or ADMIN.
Body providerName String Name of the provider whose prices are updated. Only TELENOR is supported.
destinations Array The destinations to update, see definition below.
Destination object
_id String ISO3166 2-char uppercase country code. The destination is created if it does not exist.
breakouts Array The full list of breakouts to store on the destination. Replaces the destination's existing breakouts.
breakouts[].prefix Array Array of strings, which is the prefixes, that this destination/type covers
breakouts[].type String FIXED, MOBILE, SPECIAL
breakouts[].cost Object Cost prices for each peer.
breakouts[].cost.<PeerId> Object Cost prices for one peer, keyed by peer id: TELENOR, SUPERTEL or TDC.
breakouts[].cost.<PeerId>.fee Number Connection fee cost.
breakouts[].cost.<PeerId>.rate Number Pr. minute cost.
breakouts[].cost.<PeerId>.rates Array List of cost rates for the prefixes in this breakout.

Request body example

{
  "providerName": "TELENOR",
  "destinations": [
    {
      "_id": "DE",
      "breakouts": [
        {
          "prefix": [ "+4915", "+49151", "+49152", "+49160", "+49170" ],
          "type": "MOBILE",
          "cost": {
            "TELENOR": { "fee": 0.02, "rate": 0.1795 }
          }
        },
        {
          "prefix": [ "+49", "+4930", "+4940" ],
          "type": "FIXED",
          "cost": {
            "TELENOR": { "fee": 0.02, "rate": 0.0955 }
          }
        },
        {
          "prefix": [ "+49700", "+49701" ],
          "type": "SPECIAL",
          "cost": {
            "TELENOR": { "fee": 0.2, "rate": 0.1975 }
          }
        }
      ]
    }
  ]
}

Response

The response contains every destination in the database (not only the updated ones) as full destination objects, see Destination Get for the object definition. If the destinations array in the request is empty, { “success”: true } is returned instead.

JSON object
destinations Array All destinations, as full destination objects.

Example

{
  "destinations": [
    {
      "_id": "DE",
      "prefix": "+49",
      "image": "650000000000000000000001",
      "names": [
        { "language": "da", "text": "Tyskland" },
        { "language": "en", "text": "Germany" }
      ],
      "region": "EU_NORDIC",
      "roamingRegion": {
        "tdc": "650000000000000000000002",
        "telenor": "650000000000000000000003"
      },
      "breakouts": [
        {
          "prefix": [ "+4915", "+49151", "+49152", "+49160", "+49170" ],
          "type": "MOBILE",
          "cost": {
            "TELENOR": { "fee": 0.02, "rate": 0.1795 }
          }
        }
      ],
      "fixed": {
        "wholesaleFee": 0.1,
        "wholesaleRate": 0.15,
        "customerFee": 0.2,
        "customerRate": 0.25
      },
      "mobile": {
        "wholesaleFee": 0.1,
        "wholesaleRate": 0.5,
        "customerFee": 0.2,
        "customerRate": 0.75
      },
      "special": {
        "wholesaleFee": 0.2,
        "wholesaleRate": 0.5,
        "customerFee": 0.2,
        "customerRate": 0.6
      }
    }
  ]
}

Errors

Error code Message Description
404 providerName Provider name is missing
404 destinations Destinations is missing
422 providerName Invalid provider name
404 _id Destination country code is missing
422 breakouts Breakouts is not valid
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/destination/provider/update.txt · Last modified: by Mikkel Meerwaldt Jørgensen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki