문제

I'm working on building a block on my site that contains the top 5 most shared urls on my domain via the sharethis api, I've been testing it and have gotten some unexpected results...

when I check the domain statistics api, I get the expected results:

request:

http://rest.sharethis.com/analytics/V2/getDomainStats.php?domain={my-domain}&pub_key={my-publisher-key}&access_key={my-secret-key}

response:

{"status":"SUCCESS","from_date":"20120620","to_date":"20120627","data":
{"domain_summary":[{"clicks":1092,"shares":134,"traffic":1393,"date":"06\/20","channel_stats":
[{"shares":86,"clicks":404,"traffic":412,"channel":"facebook"},
{"shares":25,"clicks":617,"traffic":898,"channel":"email"},
{"shares":12,"clicks":0,"traffic":0,"channel":"fblike"},
{"shares":7,"clicks":42,"traffic":31,"channel":"twitter"},
{"shares":3,"clicks":0,"traffic":0,"channel":"plusone"},
{"shares":1,"clicks":0,"traffic":0,"channel":"pinterest"},
{"shares":0,"clicks":17,"traffic":19,"channel":"blogger"},
{"shares":0,"clicks":12,"traffic":33,"channel":"google_bmarks"}]}.....

I've truncated those results obviously since they go back for a week...

when I try to find out what urls are the most active from my domain:

request:

http://rest.sharethis.com/analytics/V2/getTopUrlStats.php?domain={my-domain}&from_date=2012-06-27&to_date=2012-01-01&pub_key={my-publisher-key}&access_key={my-secret-key}

response:

{"status":"SUCCESS","from_date":"20120627","to_date":"20120101","last_batch_date":"20120626","data":{"top_urls_summary":[]},"today":""}

Obviously this is not what I'm looking for, I have the clicks and on the sharethis site I can go to my metrics and view the info I'm looking for with no problem, but the api is not answering with any data. I have tried changing the date range or omitting it completely (which for some reason returns an empty data set) to no avail. Has anyone else run into a similar problem?

도움이 되었습니까?

해결책

Ok Sharethis support finally got back to me about the problem:

According to sharethis api :

To Date End date for data. Note: date must be in yyyy-mm-dd format. Default is 7 days ago.

From Date Start date for data. Note: date must be in yyyy-mm-dd format. Default is 'today'.

These are backwards, that's 1 reason why my call wasn't working, "To date" should be the more recent date when defining the date range... the "defaults" don't work so you must enter both values, and when you enter todays date as the "To Date" it may return "collection failed", so best to start with yesterday

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top