I want get one specific entry from JSON data and console .log it + my params don't work

Hello i am getting a JSON data from a webservice and i push parameter Code which should console.log only the specific Code data from the JSON but in result i get all the JSON data with all the codes listed.
Is there any way that i can console log only the specific Code that i want?or to set the params in a better way in order for the webservice to read them?
Thanks in advance

 getScrid(url, paramsScrid ){
    return this.http.get
    (this.url3, paramsScrid);
  }

  scrid() {
    console.log("Entered into Scrid");
    this.url = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrid;
    //this.paramsScrid.data.Code="0013168";
    this.paramsScrid = {
      type: "GET",
      headers: {
        Authorization: 'Bearer ' + this.token
      },
      data: {
        Code: "0013168"
      }
    };
    return this.getScrid(this.url, this.paramsScrid)
      .subscribe((Scrid:any) => {
        console.log(JSON.stringify(Scrid));
     });
  }

Your text and code is a bit confusing. What exactly is your problem? What is blocking you?

instead of gettting this →

[{"Mobile1":"6946504924","Code":"0007130","Name":"ΚΡΕΜΥΔΑΣ ΤΑΣΣΟΣ"},{"Mobile1":"6977263273","Code":"0007134","Name":"ΚΥΡΙΑΚΟΠΟΥΛΟΣ ΧΑΡΗΣ"},{"Mobile1":"6982773110","Code":"0007145","Name":"Καγιαμπάκη }]

To get this only in console.log–>

[{"Mobile1":"6977263273","Code":"0007134","Name":"ΚΥΡΙΑΚΟΠΟΥΛΟΣ ΧΑΡΗΣ"}]

That looks like the second entry of your list.
Do you want to extract that from the list?
Or do you want the server only to return this?

only the server to return this.

Then you have to talk to the server developer how you can achieve this.

But i have a similar file with code which takes the parameters and runs smoothly.


/*
    Following are the variables required to connect with WebAPI.
    You need to modify them accordingly. You  don;t need to change the token variable, since it will be updated by the login call.

    -- Επεξήγηση μεταβλητών --
    webapihost: the http(s) address of the WbAPI server
    scrollerid: The scroller ID (used as an example in our case)
    commandid: The automation ID (used as an example in our case)
    token: The authentication Web API token returned by the call to the Login API
   
   
*/


var webapihost = "http://192.168.0.6:81/ebswebapi/";
var scrollerid = "ES00BACKUP/KHCApp_Items"; // For our example, the View (scroller) ID that will be called
var scrid = "ES00BACKUP/KHCApp_Contacts"; 


var commandid = "";                   // For our example, the Automation Command ID that will be called
var mastertableid = "";
var token = "";

/***********  DEMO  ************/

$(document).ready(function () {

    /*
          Call login API
    */
    $.ajax({
        url: webapihost + "api/login",
        type: "POST",
        data: JSON.stringify({
            /*
             Following are the Credentials required to connect to the WebAPI server. Valiable model contains the credensial as they would be entered by an EBS user 
            */
            SubscriptionPassword: 'passx', 
            model: {
                BranchID: "01",
                LangID: "el-GR",
                UserID: "khcadmin",
                Password: "P@ssw0rd"
            }
        }),
        contentType: "application/json; charset=utf-8",
        success: function (result) {

            token = result.Model.WebApiToken;
            document.getElementById("token").innerText = token;

            /*
 After successfull loging in you may process with thw other calls, you have a valid token and you may proceed with other calls.
            */
            GetItemData(token);
		
			GetScrollerData(token,scrid);
			
        },
        error: function (error) {
            document.getElementById("token").innerText = "error:" + JSON.stringify(error);
            console.log("error:" + JSON.stringify(error));
        }

    });


    function GetItemData(token) {

        /*
            Call to get data from the View (scroller)
        */
        $.ajax({
            url: webapihost + "api/rpc/SimpleScrollerRootTable/" + scrollerid,
            type: "GET",
            headers: {
                Authorization: 'Bearer ' + token
            },
            data: {
            
                Code: "1*" //Primary Key. If it does't exist it will create new person else it will update the data of the existing objects
            },
            contentType: "application/json; charset=utf-8", // returns JSON
            success: function (result) {
                var itemdata = JSON.stringify(result);
                document.getElementById("itemdata").innerText = itemdata;
			

                if (itemdata.length > 0 || typeof itemdata != "undefined") {
               
                }

                
            },
            error: function (error) {
                document.getElementById("itemdata").innerText = "error:" + JSON.stringify(error);
                document.getElementById("itemdata").innerText = "error:" + JSON.stringify(error);
                console.log("error:" + JSON.stringify(error));
            }
        });
    }
 
        function GetScrollerData(token,scrid) {

        /*
            Call to get data from the View (scroller)
        */
        $.ajax({
            url: webapihost + "api/rpc/SimpleScrollerRootTable/" + scrid,
            type: "GET",
            headers: {
                Authorization: 'Bearer ' + token
            },
            data: {       
                Code: "0013168"//Primary Key. If it does't exist it will create new person else it will update the data of the existing objects
				
            },
            contentType: "application/json; charset=utf-8", // returns JSON
            success: function (srcresult) {
                var data = JSON.stringify(srcresult);
                document.getElementById("data").innerText = data;
			

                if (data.length > 0 || typeof data != "undefined") {
               
                }

                
            },
            error: function (error) {
                document.getElementById("data").innerText = "error:" + JSON.stringify(error);
                document.getElementById("data").innerText = "error:" + JSON.stringify(error);
                console.log("error:" + JSON.stringify(error));
            }
        });
    }

});


In your scrid() method your local variable scrid is not defined anywhere, so your this.url is incomplete and your REST api endpoint returns all items.

scrid is defined on the top of my file ,out of the class , just before @Injectable()

import { HttpClient,HttpEvent,HttpClientModule } from '@angular/common/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import {Observable} from "rxjs/Observable";
import {Storage} from "@ionic/storage";
import {LoginscreenPage} from "../../pages/loginscreen/loginscreen";
import { HttpHeaders } from '@angular/common/http';
import {isSuccess} from "@angular/http/src/http_utils";

var webApihost="http://192.168.0.6:81/EBSWebApi/";
var scrollerid="ES00BACKUP/KHCApp_Items";
var scrid = "ES00BACKUP/KHCApp_Contacts";

@Injectable()
export class LoginserviceProvider {
public token:string;
//public Mobile1:string;
  params: {
    SubscriptionPassword: string;
    model: {
      BranchID: string;
      LangID: string;
      UserID: string;
      Password: string;
    }
  };

  //scroller code below//

  paramsScroller: {
    headers: {
      Authorization: string;
    },
    data: {
      Code: string;
    }
  };
  //scrid code below//
  paramsScrid: {
    type:string;
    headers: {
      Authorization: string;
    },
    data: {
      Code: string;
    },
    contentType:string;
  };
  Mobile:string;
  Code:string;


  url = webApihost + 'api/login';
  //scroller code below//
  url2 = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrollerid;
  //scrid code below
  url3 = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrid;
  users=[];
type;
  constructor(public http: HttpClient,
              private storage:Storage) {

    console.log('Hello LoginserviceProvider Provider');
    this.url  =webApihost + 'api/login';
    this.url2 =webApihost + "api/rpc/SimpleScrollerRootTable/" + scrollerid;
    this.url3 =webApihost + "api/rpc/SimpleScrollerRootTable/" + scrid;
  }


  getWebApi(url, params) {
    return this.http.post
    (this.url, params);
  }

  getScrollerID(url, paramsScroller){
    return this.http.get
    (this.url2, paramsScroller);
  }
  getScrid(url, paramsScrid ){
    return this.http.get
    (this.url3, paramsScrid);
  }


  authenticationWebApi() {

    this.url = webApihost + 'api/login';
    this.params = {
      SubscriptionPassword: 'passx',
      model: {
        BranchID: "01",
        LangID: "el-GR",
        UserID: "khcadmin",
        Password: "P@ssw0rd"
      }
    };
    //this.token = "";
    console.log("Token Before = " + this.token);
    return this.getWebApi(this.url, this.params)
      .subscribe((data:any) => {
        console.log(JSON.stringify(data));
        this.token = data.Model.WebApiToken;
        console.log("Μόλις πήρα το Token -> " + this.token);

      });

  };

  scrollerID() {
    console.log("Entered scrollerID token? " + this.token);
    this.url = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrollerid;
    this.paramsScroller = {
      headers: {
        Authorization: 'Bearer ' + this.token
      },
      data: {
        Code: "1*"
      },
    };
    console.log("Got into  scrollerid -> " + this.token);
    return this.getScrollerID(this.url, this.paramsScroller)
      .subscribe(Scroller => {
        console.log(JSON.stringify(Scroller));
      });
  }


  scrid() {
    console.log("Entered into Scrid");
    this.url = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrid;

    this.paramsScrid = {
      type: "GET",
      headers: {
        Authorization: 'Bearer ' + this.token
      },
      data: {
        Code: "0013168"

      },
      contentType: "application/json; charset=utf-8"
    };
    return this.getScrid(this.url,this.paramsScrid)
      .subscribe((scrid:any) => {
        console.log(JSON.stringify(scrid));
      });
  }
}