나는 cosm.com에 센서 데이터를 업로드하는 arduino가 있습니다. 로컬 웹 서버에서 간단한 웹 페이지를 만들어 cosm.com API를 쿼리하고 값을 출력했습니다.JSONP 패스 API 키
다른 탭에서 cosm.com에 로그인하지 않으면이 팝업이 표시됩니다.
이 솔루션은 cosm.com 내 공개 키를 전달하는 것입니다,하지만 난 여기에 내 머리 방법입니다.
문서는 컬에서 작업을 수행하는 방법의 예를 제공하지만, 자바 스크립트되지
curl --request GET --header "X-ApiKey: -Ux_JTwgP-8pje981acMa5811-mSAKxpR3VRUHRFQ3RBUT0g" https://api.cosm.com/v2/feeds/120687/datastreams/sensor_reading
나는 URL?
function getJson() {
$.ajax({
type:'GET',
url:"https://api.cosm.com/v2/feeds/120687/datastreams/sensor_reading",
//This line isn't working
data:"X-ApiKey: -Ux_JTwgP-8pje981acMa5811-mSAKxpR3VRUHRFQ3RBUT0g",
success:function(feed) {
var currentSensorValue = feed.current_value;
$('#rawData').html(currentSensorValue);
},
dataType:'jsonp'
});
}
업데이트 : 가능해야합니다. hurl.it이 API를 http://www.hurl.it/hurls/75502ac851ebc7e195aa26c62718f58fecc4a341/47ad3b36639001c3a663e716ccdf3840352645f1
업데이트 2를 조회 할 수 있기 때문에 : 나는이 작업을 진행 한 적이 있지만, 나는 주위에 일을 발견했다 . Cosm은 내가 원하는 것을 수행하는 자체 자바 스크립트 라이브러리를 가지고 있습니다. http://jsfiddle.net/spuder/nvxQ2/5/
감사합니다. 이것이 제가 끝내 준 것입니다. https://github.com/spudstud/Foosball – spuder