Jawbone API integration with our health wealness app not returns data - jawbone

We have integrated Jawbone web API with our health tracker app.
We are using the device, Jawbone UP 24 for our testing.
The Connect part has been working well from our App. But the syncing always return empty response as below.
data response {"meta":{"user_xid":"RCLWx75WGKTdnY0L4UyFZg","message":"OK","code":200,"time":1464848584},"data":{"items":[],"size":0}}
Jawbone User Access token sent in header :
Je5CDuGC9OSc-05UAifnK9kVk6thTRHewCwuwXuPuTo7mW7qLWnnd2I4ljqtCw-RlXB3v78Ji6VXW2MSxp0B_VECdgRlo_GULMgGZS0EumxrKbZFiOmnmAPChBPDZ5JP
StepRequest URL:
https://jawbone.com/nudge/api/v.1.1/users/#me/moves?start_time=1464796800000&end_time=1464848584617
We follow the steps as per the document in this link - https://jawbone.com/up/developer/.
We are worried that it's not working because the API supports only the new devices (Jawbone UP 2, 3 and 4) not for the Jawbone UP 24.

The issue is that your start_time and end_time are in milliseconds whereas they should be seconds.
This request should get the step data you're looking for:
https://jawbone.com/nudge/api/v.1.1/users/#me/moves?start_time=1464796800.000&end_time=1464848584.617
Here's the definition of start_time and end_time from the documentation for the moves endpoint:
And the Wikipedia page for Unix Time defines Epoch time as:
Unix time (also known as POSIX time or Epoch time) is a system for
describing instants in time, defined as the number of seconds that
have elapsed since. . .

Related

How to get liveBroadcast Schedule time using channel ID

I am working with youtube data api and trying to get Live Broadcast schedule time not publish time.
Example
Apr 10, 2022
ScheduledFor more details image attached here
Please answer the relative answer if you know your answer will be highly appreciated.
I don't think it's possible with the YouTube Data API.
You could use the "search" endpoint for retrieve the "upcoming" videos from a given channel - see example - and then use another tool for extract (i.e. web scraping) the videos obtained from the previous search request for get the values "scheduledStartTime" and "startTimestamp" in the embed javascript code - both contains the scheduled time in UNIX and Date Time value respectively.
Also, check in Issue Tracker if there is an official response.

Constraining API Call / Fetch to once per day / usage - React Native

I have searched everywhere and just cannot find an answer for this. What I want to do can be described as follows:
On a user's first time opening the application for a given day, make an API call. Store the API call in local storage, and then for the rest of the day, simply rely on the stored data in local storage (data comes from local storage as opposed to API call now).
However, once that full day passes, a new API call is made the next time the user opens the application and that data is used to update the data in local storage. Rinse and repeat. Is there a way to do this?
You can store the date of when the last API call was made, for example, lastAPIFetchDate, then each time the app opens you compare lastAPIFetchDate with today's date and if the lastAPIFetchDate is before today's date, make the API call, if not, get the data from the storage.

"No 'Access-Control-Allow-Origin' header" error when making a request to a public API

This is the documentation of the API I'm trying to make a request to.
Relevant section:
Public Data Functions
Ticker
GET https://kiwi-coin.com/api/ticker/
Returns JSON object:
last - last BTC price
date - price date
high - last 24 hours till date price high
low - last 24 hours till date price low
vwap - last 24 hours till date volume weighted average price: vwap
volume - last 24 hours till date volume
bid - highest buy order
ask - lowest sell order
Here's my code:
$.ajax({
type: "GET",
url: "https://kiwi-coin.com/api/ticker/",
});
Yep, there's no way of handling the response. Ignore this for now,
I'm just focusing on getting the request to work.
Here's the error I get in the console:
Failed to load https://kiwi-coin.com/api/ticker/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://cloud-rooster.glitch.me' is therefore not allowed access.
What am I doing wrong? This API works for other users (e.g. bots).
I checked out the other questions with a similar title, but from what I could make out the answers all involved making changes to the server, which isn't an option in this case.
If the API server doesn't support CORS, there are two options:
JSONP. Though you can't make cross-origin XHRs without adequate permission, you CAN include a JavaScript file from anywhere. If the API server returns something like callback({ json data ...}), then you can use the data without having to jump through hoops. However, it doesn't seem like KiwiCoin supports that.
Run your own server from the same origin as your client application (probably the same server that hosts your HTML/JS files), and have endpoints on your server that forward to the API server. This is foolproof.
One thing I noticed from looking at your code is that you have calls to process.env, which doesn't exist in the browser. That might be the sign you need to try option #2!
It turns out I was running the function from the client-side (in the browser), rather than server-side (in a Node.js environment).
Duh!
Problem solved.

Amazon Product Advertising API, timestamp issue

Integrated Amazon Product Advisement API with my own application, It's working fine but the problem is:
To access the API we need time stamp, when I put the code on the server ( which is in other country), and used the server time stamp, then API gave the following error in the XML: "Request has expired. Timestamp date is XXXX-XX-XXTXX:XX:XXZ",
but when I enter my own time zone where currently I am, then its start working fine. Why API is working fine with client side timestamp, on the other hand all calculation related to API are happening on the server side.
I consult the following Developer document of Amazon API, but no avial.
Product Advertising API Developer GuideAPI Version 2011-08-01
var currentdate = new Date();
currentdate.toISOString();
This is how I got the time stamp for Product Advertising Api.
I consult the following Developer document of Amazon API, but no avial. Product Advertising API Developer GuideAPI Version 2011-08-01
Hum, this document clearly state the Timestamp parameter MUST be represented in Universal Time (UTC); You cannot send a local time, unless, by chance (which might be the case for your personal location) you happen to be on the same time as UTC:
"• Timestamp—Required. There is no default value. The time stamp you use in the request must be a
dateTime object, with the complete date plus hours, minutes, and seconds (for more information, go
to http://www.w3.org/TR/NOTE-datetime).This is a fixed -length subset of the format defined by ISO
8601, represented in Universal Time (GMT): YYYY-MM-DDThh:mm:ssZ (where T and Z are literals).
Important
If you are using .NET you must not send overly specific time stamps, due to different
interpretations of how extra time precision should be dropped. To avoid overly specific time
stamps, manually construct dateTime objects with no more than millisecond precision."

Instagram API Real Time geography subscriptions - too few requests

I've implemented the real time functionality on the Instagram API by subscribing to 5 geographies.
These geographies pretty much cover the area of Bucharest, so I'm thinking I should get a lot of action from Instagram's servers.
Here's the way I implemented everything in PHP (CodeIgniter):
I created a callback page for all 5 geographies which analyses the raw post from the Instagram API, gets the geography ID and then requests the recent photos uploaded from that area to the geography endpoint based on the respective geography ID
I parse this response and I cache the photos' data so I can retrieve it later
I show the last 30 results on http://hipstagram.ro/
The problem is that I've made a few tests by taking photos with my phone from one of these areas and sometimes my photo shows up, and sometimes it doesn't. The implementation isn't throwing any errors, but it works strangely. Thus... I have a couple of unanswered questions:
Q: Could I be missing requests? It says in the Instagram API docs that I should acknowledge the request in less than 2 seconds. Here's how my code looks like in the callback method (PHP CodeIgniter):
if ($_SERVER ['REQUEST_METHOD'] == 'POST') {
header("Content-Length: 0");
header("Connection: close");
flush();
// do stuff with file_get_contents('php://input')
// also, get new photos...
$data = json_decode (file_get_contents('php://input'));
if (is_array ($data))
foreach ($data as $geo) {
$this->db->query ("LOGGING SOMETHING HERE...");
// make some a cURL request to the geography endpoint
// get the photos, save them in the database
$this->live->updateGeo ($geo->object_id);
}
}
Q: If I'm missing requests:
is it because the callback takes too long due to the added time of $this->live->updateGeo (which waits for the cURL call to end)?
is it because my server is in Romania and all the requests from Instagram come from USA IPs?
I've analysed the raw access logs and from time to time I get a spike of requests, then a long span of silence. I'm thinking it's either because the Instagram API is not posting anything to me or because I'm not responding in less than 2 seconds. Otherwise... why are those requests taking place all at once (5-10 requests in a couple of seconds)? It's not like 5-10 people just happen to take photos all at the same time and then everybody just puts their phone back in the pocket :)