2017-09-23 1 views
0
var xhttp = new XMLHttpRequest(); 
    var theUrl = "https://people.googleapis.com/v1/people/c3591871730916654475?personFields='names,photos,coverPhotos'"; 
    xhttp.open("GET", theUrl, true); 
    xhttp.setRequestHeader('Authorization', 'Bearer ' + currentSessionAccessToken) 
    xhttp.onload = function(){ 
    if(xhttp.status == 200){ 
     var profileJson = JSON.parse(xhttp.response); 
     resolve(profileJson);  
    } 
    else{ 
     if(xhttp.status == 404){ 
      resolve('No_RESULT_FOUND'); 
     } 
     else{ 
     reject(xhttp.statusText); 
     } 
    } 
    }; 
    xhttp.onerror = function(){ 
    reject(xhttp.statusText); 
    }; 
    xhttp.send(); 

Oben ist meine XMLHttpRequest. Nach der Anfrage bekomme ich einen Fehler unter:Wie kann ich den Abfrageparameter 'personFields' in Google People API anfordern?

"{ "Fehler": { "Code": 400, "message": "Invalid personFields Pfad Maske:. \" \" Namen \“Gültige Pfade bei https://developers.google.com/people/api/rest/v1/people/get dokumentiert „ ‚-Status.‘:‚INVALID_ARGUMENT‘ } } “

Kann jemand mir empfehlen einen gültigen Pfad fand ich nicht in der Dokumentation

Antwort

1

ändern personFields='names,photos,coverPhotos'-personFields=names,photos,coverPhotos ohne. die '.

+0

es hat funktioniert! Vielen Dank. –

Verwandte Themen