시간을 많이 써서이 문제를 해결하려고 노력했지만 해결책을 찾지 못했습니다.XML HTTP 요청 Jodel
내 jodelclient 객체 내의 함수입니다. "위치 누락 된 필수 속성"
this.sendPost = function(JodelPost)
{
var httpRequest = new XMLHttpRequest(); //create new httpRequest
httpRequest.onreadystatechange = function (data) //This is the function that gets called when you recieve the server response
{
console.log(data); //Prints out the server response
}
var url = 'https://api.go-tellm.com/api/v2/posts/?'; //BaseUrl for jodel api
httpRequest.open('POST', url+JSON.stringify(JodelPost));
httpRequest.setRequestHeader('Authorization', 'Bearer ' + this.token); //For a valid authirazation
httpRequest.send(); //send it flying!
};
서버의 응답
? "POST https://api.go-tellm.com/api/v2/posts/ 400 (잘못된 요청)"
및
입니다
JodelPost 변수를 문자열로 변환 한 결과의 예입니다.
{
"color": "FFBA00",
"location": {
"city": "Uppsala",
"country": "46",
"loc_accuracy": 0,
"loc_coordinates": {
"lat": "68.805532",
"lng": "2.943903"
},
"name": "Uppsala"
},
"message": "HelloWorld"
}
이 문제를 해결하기 위해이 github 저장소가 파이썬에서 동일한 작업을 수행하고 있음을 발견했습니다. 거기에 유용한 정보 일 수도 있습니다. 사전에
감사합니다! 나는 이것에 아주 새롭다 그래서 간단한 설명은 평가된다.
너무 감사합니다! – Shroom
당신을 진심으로 환영합니다. 즐거운 프로그래밍! – stevenelberger