"search/streams?query=" 400 error

Hi. I’m trying to make a dynamic search for FreeCodeCamp project but I’m getting error 400, status no client id is specified with every search input. I have client id, other stuff works just fine.

I want it to search streams which stream searched game and show it’s preview image, but I’m kinda stuck on that.

I will really appreciate any help!

CodePen with my project : https://codepen.io/dknvmlhok/full/eyzgVm

    $.getJSON(apiBaseUrl+"search/streams?query="+searchVal
         +"?client_id=aj6k9bb6snp76o59babzqeobxbbcgs",function(data3){
        //console.log(data3);
 
 //for(let j = 0; j < data3.length; j++){
 
 let previewImgUrl = data3.preview.template;
 let resizedPreviewImg = previewImgUrl.replace("{width}x{height}","175x100");
       //console.log(resizedPreviewImg);
      $(".liveStr-results").append('<img src="'+resizedPreviewImg+'">');
 
 //};   
});

Change ?client_id to &client_id.

When using querystrings, a ? indicates the start, and an & splits each parameter.

1 Like

I see. I didn’t know that. It finally shows something! Thanks :slight_smile:
However it still doesn’t show the preview images.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.