Receiving Error 502 when uploading 125 channel using rest API

We are getting Error 502 when we are trying to add channels more than 125, as we are using Rest API to Add these channels.

Reply
1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 502 suggests the API got a responce it didn't expected, presumably from the backend. I have no insigts in the backend workings so i don't know why you would get an 502 error. would expect a 500 or something.

    I got some tips that might help.

    Make sure you add a delay of one second between the API calls. Somehow a lot is happening when you are adding a channel and it will fail if you overload it with API calls.

    Share the script either here or directly with NEEO so it's more clear what's happening or going wrong.

    Are you getting the 502 error at the exact time when you re run the script or does it differ per try?

    This is what i'm using, feel free to test this:

    // Config.
    const CHANNELS = [
      { channel: { name: "NPO1", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/245ffa6f-fc29-444c-92e0-33688ace007e.png.thumb.png" }, channelNr: "1" },
      { channel: { name: "NPO2", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/a08d2bd9-ee5c-4396-b607-633f3db8871b.png.thumb.png" }, channelNr: "2" },
      { channel: { name: "NPO3", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/2d0b6400-6351-4ae9-a793-b95da1f239e4.png.thumb.png" }, channelNr: "3" },
      { channel: { name: "RTL 4", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/d1676f5c-9a7f-4675-82dd-577cc231f0a6.png.thumb.png" }, channelNr: "4" },
      { channel: { name: "RTL 5", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/011d8b72-b110-4ec7-9a22-ce0493b2094e.png.thumb.png" }, channelNr: "5" },
      { channel: { name: "SBS 6", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/36d39139-59d2-40a3-af65-1cef24e92408.png.thumb.png" }, channelNr: "6" },
      { channel: { name: "RTL 7", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/61f1cbec-f782-42bf-a7ad-95dc30e4be57.png.thumb.png" }, channelNr: "7" },
      { channel: { name: "Veronica", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/67c32fc2-d630-44fc-a167-c4fc84568b23.png.thumb.png" }, channelNr: "8" },
      { channel: { name: "NET 5", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/32ba0888-6984-4a43-8b3b-9c267ae38a0c.png.thumb.png" }, channelNr: "9" },
      { channel: { name: "RTL 8", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/f30e435f-bb80-4928-bef8-629ece75ecd3.png.thumb.png" }, channelNr: "10" },
      { channel: { name: "FOX", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/d4e3040f-235a-408b-ad53-b34c4aa994b5.png.thumb.png" }, channelNr: "11" },
      { channel: { name: "RTL Z", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/574bdd19-3970-4b16-8719-b2f2cb64eb6d.png.thumb.png" }, channelNr: "12" },
      { channel: { name: "Disney XD", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/d18d6ded-86a8-4d7c-bab8-a49fbb5b2cb2.png.thumb.png" }, channelNr: "301" },
      { channel: { name: "Disney Junior", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/92d7f388-48a7-43c9-b536-90a3b8ee91c3.png.thumb.png" }, channelNr: "302" },
      { channel: { name: "PebbleTV", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/99fef4cb-6fa6-47ea-84ba-33ad63ce7e4d.png.thumb.png" }, channelNr: "305" },
      { channel: { name: "Nicktoons", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/3b04bbea-8457-4718-911f-70c81a1cd18a.png.thumb.png" }, channelNr: "303" },
      { channel: { name: "Nick Music", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/9e2eadef-4021-4cb7-92e4-1ee27830b633.png.thumb.png" }, channelNr: "304" },
      { channel: { name: "Nick Jr.", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/a87aaa8b-7b42-40b4-82f9-4249eb9bf4c0.png.thumb.png" }, channelNr: "306" },
      { channel: { name: "Cartoon Network", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/e7f7edf8-bab0-4150-be65-527a6d6394dc.png.thumb.png" }, channelNr: "307" },
      { channel: { name: "JimJam", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/e6e0e8a8-e2ae-46c8-8193-5fe19a0d8448.png.thumb.png" }, channelNr: "308" },
      { channel: { name: "Boomerang", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/70bd7c6b-babe-4b8f-950e-ad81b0165c62.png.thumb.png" }, channelNr: "309" },
      { channel: { name: "NPO Zapp Xtra", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/7e0aa3aa-e980-4bdc-9064-878786caf296.png.thumb.png" }, channelNr: "311" },
      { channel: { name: "RTL Telekids", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/9e3cf844-08ff-4c3f-a6be-27e227a46141.png.thumb.png" }, channelNr: "312" },
      { channel: { name: "Ziggo Sport", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/b18e1d61-8d6f-44f7-93a6-acfd123b7b02.png.thumb.png" }, channelNr: "14" },
      { channel: { name: "Ziggo", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/ee91d63b-e853-47e2-8941-6fb54cab6975.png.thumb.png" }, channelNr: "13" },
      { channel: { name: "Ziggo Sport Select", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/0ce0d3c9-a70f-4817-bf2b-8349a3335c73.png.thumb.png" }, channelNr: "401" },
      { channel: { name: "Comedy Central", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/f3e49fc4-2445-4879-96aa-53db3ff9747b.png.thumb.png" }, channelNr: "15" },
      { channel: { name: "Discovery Channel", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/127396dc-8889-45f3-85ce-a5b43d532e81.png.thumb.png" }, channelNr: "17" },
      { channel: { name: "National Geographic", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/1edd8869-592c-47b0-9b62-fbc2bd4c0d10.png.thumb.png" }, channelNr: "18" },
      { channel: { name: "SBS 9", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/e61b54c7-a8e3-4cb2-ada4-bd3c5dc5ba6e.png.thumb.png" }, channelNr: "19" },
      { channel: { name: "Eurosport", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/f3a726c3-d438-4919-822c-c2916e180e00.png.thumb.png" }, channelNr: "20" },
      { channel: { name: "TLC", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/a4f4ece8-723f-47a4-8977-53e75c5b62a9.png.thumb.png" }, channelNr: "21" },
      { channel: { name: "BBC One", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/6a62cea8-b1ce-42a5-b8d7-8c7bd1b8e47a.png.thumb.png" }, channelNr: "22" },
      { channel: { name: "MTV", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/c997938b-86e3-4094-8c73-a2a57ff3afd3.png.thumb.png" }, channelNr: "23" },
      { channel: { name: "24 Kitchen", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/6aeb040e-1d7c-4ea8-be8d-44b005b8a5ae.png.thumb.png" }, channelNr: "24" },
      { channel: { name: "XITE", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/9a0d8e5c-c58e-4b1e-b88a-d26ea84ae9f9.png.thumb.png" }, channelNr: "25" },
      { channel: { name: "Viceland", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/aef17df7-6f85-4c4f-b789-be50c316762e.png.thumb.png" }, channelNr: "26" },
      { channel: { name: "Disney Channel", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/e042c9d3-7823-455e-89b6-84691b9c5f4a.png.thumb.png" }, channelNr: "27" },
      { channel: { name: "History Channel", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/be8d8e69-3396-4c30-924f-8c340f304221.png.thumb.png" }, channelNr: "28" },
      { channel: { name: "Nickelodeon", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/fa2bcfc7-d60b-4692-8c71-e2f3b435d2e0.png.thumb.png" }, channelNr: "29" },
      { channel: { name: "Ziggo", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/ee91d63b-e853-47e2-8941-6fb54cab6975.png.thumb.png" }, channelNr: "30" },
      { channel: { name: "Ziggo", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/ee91d63b-e853-47e2-8941-6fb54cab6975.png.thumb.png" }, channelNr: "36" },
      { channel: { name: "Een", language: "nl", country: "BE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/23fef9c6-df65-44ba-98ba-f2bf0d645599.png.thumb.png" }, channelNr: "51" },
      { channel: { name: "Canvas", language: "nl", country: "BE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/fdb28710-cc78-455f-a991-550e68421ad4.png.thumb.png" }, channelNr: "52" },
      { channel: { name: "Ketnet", language: "nl", country: "BE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/de7c5945-34db-4372-8df4-8ccf8a0fadf8.png.thumb.png" }, channelNr: "53" },
      { channel: { name: "ARD Digital", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/8c6fe08e-d216-4016-a7f3-9ed84476290b.png.thumb.png" }, channelNr: "54" },
      { channel: { name: "ZDF", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/0b388188-e223-4adf-a813-6fe5ad82e55c.png.thumb.png" }, channelNr: "55" },
      { channel: { name: "WDR", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/54b9b101-7452-4014-acca-4ad03bce3f8c.png.thumb.png" }, channelNr: "56" },
      { channel: { name: "NDR", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/f80e32a4-324c-4ad5-b9f4-9b9007671a2d.png.thumb.png" }, channelNr: "57" },
      { channel: { name: "RTL", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/6368a721-e9cc-494e-b2a9-0fd52ad498c7.png.thumb.png" }, channelNr: "58" },
      { channel: { name: "Sat.1", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/5e63230a-e2f4-45b4-bf05-a409a4848996.png.thumb.png" }, channelNr: "59" },
      { channel: { name: "BBC One", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/6a62cea8-b1ce-42a5-b8d7-8c7bd1b8e47a.png.thumb.png" }, channelNr: "61" },
      { channel: { name: "BBC Two", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/fe7cbbe5-df89-47bf-af9f-9841427bc967.png.thumb.png" }, channelNr: "62" },
      { channel: { name: "TV5 Monde", language: "fr", country: "FR", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/ad0776a8-5d18-4c00-ba30-a0ce20fbf1ac.png.thumb.png" }, channelNr: "71" },
      { channel: { name: "Arte", language: "fr", country: "FR", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/b1db80d5-7b2a-4871-aac4-3c54a0be31b0.png.thumb.png" }, channelNr: "72" },
      { channel: { name: "TVE Internacional", language: "es", country: "ES", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/4a68130c-d10f-4ba1-9f41-a25d8431a9dc.png.thumb.png" }, channelNr: "73" },
      { channel: { name: "NPO Nieuws", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/d4db37c3-9a94-4e08-b0f7-ec3005340d8c.png.thumb.png" }, channelNr: "501" },
      { channel: { name: "NPO Politiek", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/8ead0b07-29b4-419c-8c43-88ec20f2a67c.png.thumb.png" }, channelNr: "502" },
      { channel: { name: "CNN", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/c1cfa6e6-afff-4f6f-a5b1-cca6312e1c02.png.thumb.png" }, channelNr: "503" },
      { channel: { name: "BBC World News", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/d66e6fbf-dcd0-4438-b871-bd20c851ac66.png.thumb.png" }, channelNr: "504" },
      { channel: { name: "Euronews", language: "en", country: "FR", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/4c6438c8-2739-4f74-911c-f1283a4b7b98.png.thumb.png" }, channelNr: "505" },
      { channel: { name: "RTV Utrecht", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/e811a3c5-3fb0-4776-a671-9b077d68fbd0.png.thumb.png" }, channelNr: "708" },
      { channel: { name: "RTV Rijnmond", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/77ec324a-b1f5-46f8-ab8c-f34f1db6da12.png.thumb.png" }, channelNr: "710" },
      { channel: { name: "CBBC", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/ae7254ad-3ceb-4a7e-b364-66f4dc393847.png.thumb.png" }, channelNr: "63" },
      { channel: { name: "BBC Four", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/92206164-cb6c-4d24-a915-b9a82f8c7aab.png.thumb.png" }, channelNr: "64" },
      { channel: { name: "BBC Entertainment", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/a0ccf2d0-6d58-4a3f-b931-b1cbee33a110.png.thumb.png" }, channelNr: "65" },
      { channel: { name: "RTL Crime", language: "de", country: "DE", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/671c2c63-877f-4e15-b42d-0b26c5f70ed5.png.thumb.png" }, channelNr: "120" },
      { channel: { name: "Comedy Central Extra", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/f1bae8b6-c1b3-4f4a-989d-b3b163f43360.png.thumb.png" }, channelNr: "124" },
      { channel: { name: "ShortsHD", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/4b386780-1370-4848-96d6-efdec70a7058.png.thumb.png" }, channelNr: "125" },
      { channel: { name: "NPO 101", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/1d6fffbf-0ecb-4cfb-b5ae-de0dc515a96b.png.thumb.png" }, channelNr: "128" },
      { channel: { name: "AMC", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/d69b4ffe-2d19-41f8-aa66-18d3342f7a1a.png.thumb.png" }, channelNr: "131" },
      { channel: { name: "CBS Reality", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/249d5c3b-aff9-4a6f-bef2-cc4907540060.png.thumb.png" }, channelNr: "132" },
      { channel: { name: "Fashion TV", language: "en", country: "FR", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/b6bdc89b-088b-453b-b48a-83877e120bf9.png.thumb.png" }, channelNr: "133" },
      { channel: { name: "MyZenTV", language: "hu", country: "HU", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/ae1be61a-e388-42a5-8d01-038eefa25889.png.thumb.png" }, channelNr: "134" },
      { channel: { name: "Food Network", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/db0dd6e4-c231-4b6a-9aaa-063af78b7ab7.png.thumb.png" }, channelNr: "138" },
      { channel: { name: "Fine Living Network", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/52194d47-1811-4909-a550-043159d4750f.png.thumb.png" }, channelNr: "139" },
      { channel: { name: "RTL Lounge", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/82fd868b-f7a6-4467-9b00-3f28825aaf5f.png.thumb.png" }, channelNr: "140" },
      { channel: { name: "Discovery Science", language: "en", country: "GB", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/58f887fb-5f81-4d34-80ec-bc94340f4733.png.thumb.png" }, channelNr: "202" },
      { channel: { name: "Discovery World", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/f53cac1c-09eb-4006-b1ae-61a311bd851e.png.thumb.png" }, channelNr: "203" },
      { channel: { name: "National Geographic Wild", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/274f5ce4-286a-4d94-8c8d-de12bc6b9880.png.thumb.png" }, channelNr: "204" },
      { channel: { name: "Animal Planet", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/0c4590a5-44e2-4aaf-bfa8-9b09aa3449c8.png.thumb.png" }, channelNr: "208" },
      { channel: { name: "Travel Channel", language: "en", country: "US", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/7e9e3c67-0a77-479e-9b97-e4afd7e94d27.png.thumb.png" }, channelNr: "210" },
      { channel: { name: "NPO Cultura", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/47bf1d9f-3dd1-4a67-8cb9-0f21c45f38ab.png.thumb.png" }, channelNr: "222" },
      { channel: { name: "Secret Circle", language: "nl", country: "NL", logoUrl: "https://neeo-channel-icons.s3.amazonaws.com/51e88959-f805-46dc-a8c4-50fe51fc5431.png.thumb.png" }, channelNr: "791" }
    ];
    
    const NEEOBRAIN = "10.63.36.2";
    const ROOM = 0;
    const DEVICE = 0;
    const TIMEBETWEENAPICALLS = 1000;
    
    // Favorite channel code.
    
    var http = require("http.min");
    let i = 0;
    
    function addchannel() {
      http.post(`http://${NEEOBRAIN}:3000/v1/projects/home/rooms/${ROOM}/devices/${DEVICE}/favorites/${i}?limit=-1`, CHANNELS[i]).then(function(result) {
        console.log("Code: " + result.response.statusCode);
        console.log("Response: " + result.data);
      });
      if (i < CHANNELS.length) {
        setTimeout(function() {
          i++;
          addchannel();
        }, TIMEBETWEENAPICALLS);
      }
    }
    
    addchannel();
    
    Like
Like Follow