FORMAT: 1A

# Group Vectorapi
Group of all vectorapi-related resources.

## YoutubeChannel

Youtube Channel is used to store all details related to our partnered or future partners channels that we have linked to our Youtube CMS account. All this metadata will be used when publishing and accounting for a channel. This was a manual process, we are trying to automate. 

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

### Index [GET]

+ Parameters

    + limit (optional,number, `5`)
    + access_token (optional,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": "youtubechannel/index?params=vectorapi&youtubechannel&index&json&5&<some_token>",
    "response": {
      "youtubeChannels": [
        {
          "id": 4,
          "youtubeChannelName": "marketingtoolstest",
          "youtubeChannelUpc": [
            {
              "youtubeChannelUpcId": 1,
              "upc": "886788317079",
              "active": "N",
              "startDate": "2013-09-13 17:43:10",
              "endDate": "2013-09-17 18:12:37"
            },
            {
              "youtubeChannelUpcId": 2,
              "upc": "888003267473",
              "active": "N",
              "startDate": "2013-09-17 18:12:37",
              "endDate": "2013-09-18 15:28:25"
            },
            {
              "youtubeChannelUpcId": 3,
              "upc": "888003273146",
              "active": "N",
              "startDate": "2013-09-18 15:28:25",
              "endDate": "2014-03-02 23:34:37"
            },
            {
              "youtubeChannelUpcId": 1115,
              "upc": "888608724432",
              "active": "Y",
              "startDate": "2014-03-02 23:34:37",
              "endDate": null
            }
          ],
          "youtubeChannelCategoryName": null,
          "monetizationStatus": "monetizing",
          "dateInitiated": "2013-08-09",
          "dateConnected": "0000-00-00",
          "notes": "",
          "lastUpdated": "2013-08-09 02:07:54",
          "autoClaim": "yes",
          "youtubeChannelServiceTierName": "Basic",
          "youtubeChannelPartnerStatusName": "Connected",
          "youtubeChannelId": "UCE57r52SOwfs-qiAvv6qteA",
          "language": "English",
          "countryName": "USA",
          "artistId": "653335",
          "artistName": "159161",
          "vendorId": "16055",
          "vendorName": "",
          "company": "Distribution Inc"
        },
        {
          "id": 5,
          "youtubeChannelName": "allewismusic",
          "youtubeChannelUpc": [
            {
              "youtubeChannelUpcId": 170,
              "upc": "887396067073",
              "active": "Y",
              "startDate": "2013-10-04 16:36:10",
              "endDate": null
            }
          ],
          "youtubeChannelCategoryName": "Indie",
          "monetizationStatus": "monetizing",
          "dateInitiated": "2012-05-31",
          "dateConnected": "2012-05-31",
          "notes": "",
          "lastUpdated": "2013-08-22 14:08:21",
          "autoClaim": "yes",
          "youtubeChannelServiceTierName": "Basic",
          "youtubeChannelPartnerStatusName": "Connected",
          "youtubeChannelId": "UCZkhW42Gre3_h70akjj-ruQ",
          "language": "English",
          "countryName": "United Kingdom",
          "artistId": "199826",
          "artistName": "Al Lewis",
          "vendorId": "16531",
          "vendorName": "Fraser Kennedy",
          "company": "Al Lewis"
        }
      ],
      "paginationOption": {
        "limit": "5",
        "offset": null,
        "pageNumber": 1,
        "totalRecords": "1330"
      },
      "sortOption": {
        "columnName": null,
        "orderBy": null
      },
      "totalRecords": "1330"
    }
  }
}




+ **Other Optional Parameters**

    + limit
    + offset
    + pageNumber
    + totalRecords
    + autoClaim // value should be "yes" or "no"

+ **Sort Options (optional)**  
    + sortBy
    + artistName
    + channelName
    + countryName
    + language
    + youtubeChannelCategoryName
    + youtubeChannelPartnerStatus
    + youtubeChannelServiceTier
    + monetizationStatus
    + mcnTeam
    + notes
    + dateConnected
    + sortOrder


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

### Index [GET]

+ Parameters

    + limit (optional,number, `5`)
    + access_token (optional,varchar, `some token`)
    + id (required,number, `506`)


+ 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": "youtubechannel/get?params=vectorapi&youtubechannel&get&json&5&<some_token>&506",
    "response": {
      "youtubeChannel": {
        "id": 506,
        "youtubeChannelName": "irinaflorinofficial",
        "monetizationStatus": "monetizing",
        "dateInitiated": "2013-07-01",
        "dateConnected": "2013-07-01",
        "notes": "",
        "lastUpdated": "2013-10-11 12:14:19",
        "autoClaim": "yes",
        "youtubeChannelServiceTierHistory": "Basic",
        "youtubeChannelPartnerStatusHistory": "Connected",
        "youtubeChannelId": "UCu8ADd5qM4q_tMjNXcnHHqw",
        "youtubeChannelUpc": [
          {
            "youtubeChannelUpcId": 383,
            "upc": "888002866950",
            "active": "Y",
            "startDate": "2013-10-11 12:15:16",
            "endDate": null
          }
        ],
        "language": {
          "languageCode": "BUL",
          "languageName": "Bulgarian"
        },
        "country": {
          "countryId": 39,
          "countryName": "Bulgaria"
        },
        "artist": {
          "artistId": 116729,
          "artistName": "Various Artists"
        },
        "vendor": {
          "vendorId": 9090,
          "vendorName": "Bobby Ivanchev",
          "vendorCompany": "VTY Music, Ltd.",
          "isDistributor": "N"
        },
        "clientManager": {
          "clientManagerId": 846,
          "clientManagerFName": "Olya",
          "clientManagerLName": "Moldavskaya"
        },
        "youtubeChannelCategory": {
          "id": 1,
          "youtubeChannelCategoryName": "Pop"
        },
        "accountManager": {
          "orchadminUsersId": 761,
          "fName": "Ben",
          "lName": "Markowitz"
        }
      }
    }
  }
}

+ **Required Parameters**
     + id // This is primary key of youtube_channel table.

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

### Post [POST]

+ Parameters

    + data (required,varchar, `{"youtubeChannelName":"sdsfaw2dasd45el18","artistId":"179552","countryId":"1 ","languageCode":"GER","youtubeChannelCategoryId":"3","youtubeChannelPartnerStatus":"Pending","youtubeChannelServiceTier":"Basic","monetizationStatus":"Pending","mcnTeam":"programming","notes":"This is dummy text","dateInitiated":"2012-11-06","dateConnected":"2012-11-06","autoClaim":"yes","youtubeChannelId":"dfdfsdml4asE45IPqyhs","upc":"886788070806"}`)
    + access_token (optional,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": "youtubechannel/POST?params=vectorapi&youtubechannel&POST&json&{\"youtubeChannelName\":\"DummyChannel158\",\"artistId\":\"179552\",\"countryId\":\"1 \",\"languageCode\":\"GER\",\"youtubeChannelCategoryId\":\"3\",\"youtubeChannelPartnerStatus\":\"Pending\",\"youtubeChannelServiceTier\":\"Basic\",\"monetizationStatus\":\"Pending\",\"mcnTeam\":\"programming\",\"notes\":\"This is dummy text\",\"dateInitiated\":\"2012-11-06\",\"dateConnected\":\"2012-11-06\",\"autoClaim\":\"yes\",\"youtubeChannelId\":\"UCoxg3Kml41wE3IPqyhs\",\"upc\":\"886788070806\"}&<some_token>",
    "response": {
      "youtubeChannelId": 1334
    }
  }
}

+ **Required Parameters**
     + artistId
     + channelName
     + dateInitiated
     + youtubeChannelId
     + upc

+ **Optional Parameters**
     + countryId
     + languageCode
     + youtubeChannelCategoryId
     + youtubeChannelPartnerStatus
     + youtubeChannelServiceTier
     + monetizationStatus
     + mcnTeam
     + notes
     + dateConnected
     + autoClaim

+ **Validation**
     + artistId – should be valid artist's id
     + channelName - should be unique and length should be minimum 2 or maximum 20 characters
     + youtubeChannelId - should be unique.
     + countryId - Valid country abbreviation from country table.
     + languageCode - Valid language code from language table
     + youtubeChannelCategoryId - Valid category Id from ytc_category
     + autoClaim - boolean yes/no values only

+ **Other Requirements**

     service tier should be stored into the ytc_service_tier_history table and only the id that is created from that insert to be stored into the ytc table.

     vendorId - Will be populated from artist data if artistId is provided.

     special mapping since country table needs to be updated (or until country table is updated):

    - if the abbrv is CS, then give them RS & ME instead
    - if the abbrv is AN, give the NL and AW instead

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

### PUT [POST]

+ Parameters

    + data (required,varchar, `{"youtubeChannelName":"Dussdss85ansd158","artistId":"179552","countryId":"1 ","languageCode":"GER","youtubeChannelCategoryId":"3","youtubeChannelPartnerStatus":"Pending","youtubeChannelServiceTier":"Basic","monetizationStatus":"Pending","mcnTeam":"programming","notes":"This is dummy text","dateInitiated":"2012-11-06","dateConnected":"2012-11-06","autoClaim":"yes","youtubeChannelId":"3ffd57qg54ml41aswE3IPqyhs","upc":"886788070806"}`)
    + access_token (optional,varchar, `some token`)
    + id (required,number,`1334`)


+ 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": "youtubechannel/put?params=vectorapi&youtubechannel&put&json&{\"youtubeChannelName\":\"DusasgChannel158\",\"artistId\":\"179552\",\"countryId\":\"1 \",\"languageCode\":\"GER\",\"youtubeChannelCategoryId\":\"3\",\"youtubeChannelPartnerStatus\":\"Pending\",\"youtubeChannelServiceTier\":\"Basic\",\"monetizationStatus\":\"Pending\",\"mcnTeam\":\"programming\",\"notes\":\"This is dummy text\",\"dateInitiated\":\"2012-11-06\",\"dateConnected\":\"2012-11-06\",\"autoClaim\":\"yes\",\"youtubeChannelId\":\"3ffdgdfgghKml41wE3IPqyhs\",\"upc\":\"886788070806\"}&<some_token>&1334",
    "response": {
      "youtubeChannelId": {
        "id": 1334,
        "youtubeChannelName": "DusasgChannel158",
        "monetizationStatus": "Pending",
        "dateInitiated": "2012-11-06",
        "dateConnected": "2012-11-06",
        "notes": "This is dummy text",
        "lastUpdated": "2014-06-06 03:18:10",
        "autoClaim": "yes",
        "accountManager": null,
        "youtubeChannelServiceTierHistory": "Basic",
        "youtubeChannelPartnerStatusHistory": "Pending",
        "youtubeChannelId": "3ffdgdfgghKml41wE3IPqyhs",
        "youtubeChannelUpc": [
          {
            "youtubeChannelUpcId": 1298,
            "upc": "886788070806",
            "active": "Y",
            "startDate": "2014-06-06 03:18:10",
            "endDate": null
          }
        ],
        "language": {
          "languageCode": "GER",
          "languageName": "German"
        },
        "country": {
          "countryId": 1,
          "countryName": "USA"
        },
        "artist": {
          "artistId": 179552,
          "artistName": "Agnostic Front"
        },
        "vendor": {
          "vendorId": 7123,
          "vendorName": "",
          "vendorCompany": "Test Label",
          "isDistributor": "N"
        },
        "clientManager": {
          "clientManagerId": 272,
          "clientManagerFName": "Arthur",
          "clientManagerLName": "Painvin"
        },
        "youtubeChannelCategory": {
          "id": 3,
          "youtubeChannelCategoryName": "  "
        }
      }
    }
  }
}


+ **Required Parameters**
     + id
     + upc

+ **Optional Parameters**
     + countryId
     + languageCode
     + youtubeChannelCategoryId
     + youtubeChannelPartnerStatus
     + youtubeChannelServiceTier
     + monetizationStatus
     + mcnTeam
     + notes
     + dateConnected
     + autoClaim
     + artistId
     + channelName


+ **Validation**
     + artistId – should be valid artist's id
     + channelName - should be unique and length should be minimum 2 or maximum 20 characters
     + youtubeChannelId - should be unique.
     + countryId - Valid country abbreviation from country table.
     + languageCode - Valid language code from language table
     + youtubeChannelCategoryId - Valid category Id from ytc_category
     + autoClaim - boolean yes/no values only

+ **Other Requirements**

     service tier should be stored into the ytc_service_tier_history table and only the id that is created from that insert to be stored into the ytc table.  (It will always be an insert to the history table. Never update. It will be an update to the ytc table for the id.)

     vendorId - Will be populated from artistId.
