FORMAT: 1A

# Group Vectorapi
Group of all vectorapi-related resources.

## Subaccount Territory Restriction

This API resource is used to store territories i.e. country ids which are restricted for subaccount user.

## Index [/vectorapi/subaccountterritoryrestriction/index{?subaccountId,limit,access_token}]

Fetch restricted territories for subaccount by request parameters.

### Index [GET]

+ Parameters
    + subaccountId (optional, number, `18`)
    + limit  (number, `2`)
    + access_token (varchar, `some token`)
  
+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "testing.vapi.devorch.com",
      "httpStatusCode": 200
    },
    "request": "subaccountterritoryrestriction/index?params=vectorapi&subaccountterritoryrestriction&index&json&2&<some_token>",
    "response": {
      "subaccountTerrirtoryRestriction": [
        {
          "territoryRestrictionId": 2118,
          "lastUpdated": "2013-02-04 15:04:08",
          "updatedBy": 737,
          "subaccount": {
            "subaccountId": 15,
            "subaccountName": "override"
          },
          "country": {
            "id": 1,
            "name": "USA",
            "continent": "North America"
          }
        },
        {
          "territoryRestrictionId": 3015,
          "lastUpdated": "2013-02-22 15:10:15",
          "updatedBy": 163,
          "subaccount": {
            "subaccountId": 22,
            "subaccountName": "Corey's Terrible Label"
          },
          "country": {
            "id": 1,
            "name": "USA",
            "continent": "North America"
          }
        }
      ]
    }
  }
}


+ **Other Optional Parameters**

    + Pagination Options : limit, offset
    + Sort Options : sort_by, sort_order (By default order is ASC)
    + Parameter options : subaccountId, countryId


## GET [/vectorapi/subaccountterritoryrestriction/get{?id,access_token}]

Get restricted dms for given subaccount.

+ Parameters

    + id (required,number, `1326`) 
    + access_token (required,varchar, `some token`)


### Get [GET]

+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)
    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "testing.vapi.devorch.com",
      "httpStatusCode": 200
    },
    "request": "subaccountterritoryrestriction/get?params=vectorapi&subaccountterritoryrestriction&get&json&1326&<some_token>",
    "response": {
      "subaccountTerrirtoryRestriction": {
        "territoryRestrictionId": 1326,
        "lastUpdated": "2013-02-04 03:14:52",
        "updatedBy": 562,
        "Country": {
          "id": 17,
          "name": "Afghanistan",
          "abbrivation": "AF",
          "continent": "Asia"
        },
        "Subaccount": {
          "subaccountId": 18,
          "subaccountName": "sixty sixty sixty sixty sixty sixty sixty "
        }
      }
    }
  }
}


+ **Required Parameters**

    + id - Primary key of subaccount_territory_restriction tabel.


## POST [/vectorapi/subaccountterritoryrestriction/post{?data,access_token}]

Add restricted territories for given subaccount.

### Post [POST]

+ Parameters

    + data (varchar, `{"subaccountId":"1","countryIds":[1, 2, 3]}`)
    + access_token (varchar, `some token`)

+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "testing.vapi.devorch.com",
      "httpStatusCode": 200
    },
    "request": "subaccountterritoryrestriction/post?params=vectorapi&subaccountterritoryrestriction&post&json&{\"subaccountId\":\"1\",\"countryIds\":[1, 2, 3]}&<some_token>",
    "response": {
      "territoryRestrictionIds": [
        4977,
        4978,
        4979
      ]
    }
  }
}


+ **Required Parameters**

    + subaccountId , countryIds


## PUT [/vectorapi/subaccountterritoryrestriction/put{?id,data,access_token}]

Update restricted territories for given subaccount.

### Put [PUT]

+ Parameters

    + id (required,number,`2872`)
    + data (varchar, `{"subaccountId":"17","countryIds":[6]}`)
    + access_token (varchar, `some token`)

+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "testing.vapi.devorch.com",
      "httpStatusCode": 200
    },
    "request": "subaccountterritoryrestriction/put?params=vectorapi&subaccountterritoryrestriction&put&json&2872&{\"subaccountId\":\"17\",\"countryIds\":[6]}&<some_token>",
    "response": {
      "subaccountTerrirtoryRestriction": {
        "territoryRestrictionId": 2872,
        "lastUpdated": "2013-02-07 12:24:43",
        "updatedBy": "643",
        "Country": {
          "id": 19,
          "name": "Algeria",
          "abbrivation": "DZ",
          "continent": "Africa"
        },
        "Subaccount": {
          "subaccountId": 17,
          "subaccountName": "Fat Wreck Records Text"
        }
      }
    }
  }
}



## Delete [/vectorapi/subaccountterritoryrestriction/delete{?id,access_token}]

### Delete [DELETE]

+ Parameters

    + id (required, number, `1333`)
    + access_token (required ,varchar, `some token`)

+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "testing.vapi.devorch.com",
      "httpStatusCode": 200
    },
    "request": "subaccountterritoryrestriction/delete?params=vectorapi&subaccountterritoryrestriction&delete&json&1331&<some_token>",
    "response": {
      "territoryRestrictionId": "1333"
    }
  }
}


+ **Required Parameters**

    + id - Primary key of subaccount_territory_restriction table.
