I need a sunrise/sunset webservice api - web-services

Anyone know of a good webservice or api that I can use to get the sunrise/sunset times in bulk? Every thing I have found so far only gives a day at a time or has a limitation on what dates can be used.

http://sunrise-sunset.org/api
It's free to use. Just needs a credit link back to the website.

It's not a web service, but this SO question has links to algorithms, so you can create a table or your own web service with all the dates you need.

I recently found this JavaScript library that performs calculation based on date and lat/lon coordinates. It seems to be very precise.
Link: https://github.com/mourner/suncalc
It is also available as NodeJs package through npm.

NASA has the calculation in nicely laid out JS. View the source of this page:
http://www.esrl.noaa.gov/gmd/grad/solcalc/
NOTE: I'm not a lawyer but I believe the US Government cannot copyright anything, hold patents, etc. so one should be able to copy as use as one needs.

This is a nice and free sunrise and sunset times API: http://sunrise-sunset.org/api

PHP has built in functions to calculate sunrise/sunset:
http://php.net/manual/en/function.date-sunrise.php
http://php.net/manual/en/function.date-sunset.php

Weather underground has this:
wunderground astronomy feature
Keys are free and they have a pretty generous policy for volume. Been using their weather actuals and forecast json forecast for about year, couldn't be happier.

EarthTools comes up first on google here at webservices sunrise sunset

The NASA one is cool, but the US Naval Observatory has one (below) that could actually pass for an API. If you want to make it useful beyond its intended purpose:
inspect the http headers to find out what parameters are being sent
parse the hell out of the response
It was a fun exercise. You should be able to send a location (long/lat or City/State) along with a year to obtain a list of sunrise and sunset times for an entire year (and other data as well).
http://aa.usno.navy.mil/data/docs/RS_OneYear.php

Go to this website > https://www.esrl.noaa.gov/gmd/grad/solcalc/
1. Set your location
Select your location. You can zoom in to your location and move the pin manually.
2. Verify your Location and Date
Scroll down to the 'Location' under the map and verify your location.
The date is automatically taken, if not set it manually.
3. Get the details
Click the button 'Create Sunrise/Sunset Tables for the Year'.
4. Output in a Table
New window opens and all the details are displayed as table.
Thanks to #noctonura for the link.

Let's go to http://www.earthtools.org/webservices.htm
It's free web service that provides Timezone and Sun times from Latitude/Longitude location.

There is a way to calculate the sunrise/sunset without the need of an API. Its mostly based on location. Sorry I dont have much more info.

Home page
Query url
Url syntax:
http://sunpath.azurewebsites.net/api/values/LAT/LON/ALT/TIMEZONE
You must replace LAT, LON, ALT and TIMEZONE with your data
.
JSON result:
{"zenith":55.365660255995422,"azimuth180":25.434155784212443,"azimuth":205.43415578421244,"incidence":55.365660255995422,"suntransit":12.423540739046871,"sunrise":6.9577562375305817,"sunset":17.899687249200021,"time":"2016-02-23T13:49:31.3816733Z"}
Or you can access online version of SPA.c algorithm:
Online query for SPA algorithm
Output is not in JSON format, but you can specify multiple times and get multiple results:
Date,Time,Top. azimuth angle (westward from S),Topocentric sun declination,Topocentric sun right ascension,Top. elevation angle (uncorrected)
2/23/2016,0:00:00,168.224314,-10.130760,335.659091,-57.643946
2/23/2016,1:00:00,-164.161551,-10.115560,335.699290,-57.227919
2/23/2016,2:00:00,-140.171655,-10.100376,335.739465,-51.963801
2/23/2016,3:00:00,-122.026618,-10.085209,335.779585,-43.529014
2/23/2016,4:00:00,-108.202194,-10.070054,335.819621,-33.425695
2/23/2016,5:00:00,-96.857772,-10.054907,335.859549,-22.544581
2/23/2016,6:00:00,-86.694509,-10.039764,335.899355,-11.406096
2/23/2016,7:00:00,-76.801678,-10.024618,335.939030,-0.376624
2/23/2016,8:00:00,-66.440121,-10.009464,335.978575,10.203398
2/23/2016,9:00:00,-54.907983,-9.994297,336.017999,19.930206

Related

Did Google recently change UI to grant public access to bucket objects in Google Cloud Platform?

Ok, I've been using Google Cloud Platform for some video files
that are are viewable from a few web pages I built. I started this two or three years ago, and I have loved it.
But, now it appears they broke it, without warning/telling us.
So, in the platform's console, yesterday (for first time since a month or two ago), I uploaded another video...that part went fine. But, when it came time to click on the checkbox to grant public access, the checkbox is now GONE. (The only part of the UI that looks NEW,
is the column labeled 'public access'. Instead of just a check-box to toggle on or off, now there's a yellow-triangle and an oval-shaped symbol. Once or twice, I was able to get a popup to appear saying 'edit permission', but that quickly led into the weeds.)
After half an hour or so, I finally thought to call platform support, and explained my problem to a guy (with just enough Australian accent to cause me to have to ask for repeats quite a bit...sigh).
So, they logged me a case# and I suggested I was headed to bed, and asked that we now use email (rather than the phone) to continue. Just before bed, I got the case#, and a query about whether it was ok for them to 'change my console'. I replied to the email, saying yes, and went to bed.)
So that was last nite. This morning, re-reading their email, it seems to say that it could be 3 or 4 days, before a more technical person will contact me.
Some re-reading their platform-console docs, I'm now GUESSING that maybe they just nuked the public-access checkbox, and that now I'm supposed to spend hours (days?) taking a short-course on IAM-permmissions, and learn some new long-winded method.
(This whole mess could have been avoided, if they'd just emailed us an informational warning of this UI-change, with some new 5-step short list or tutorial of how to learn to use their 'new, much more complicated,
way to specify public-access'. From where I sit, this change is equivalent to Microsoft saying 'instead of that checkbox, you'll need to learn to make registry edits...see our platform docs on how to do that.)
Right now, I have more than half-a-mind, to seriously consider bailing out of Google's cloud storage, and consider switching to one of the others. But, I'm not quite ready yet, to make that jump (from the frying-pan into the fire?). :^)
Anyone else been down this road? What meeting did I miss? Is there a quicker way out of my dilemma, than just waiting for Google-support to get back to me?
It looks like the change you mention was introduced on July 18th. I’m not sure why, but judging by the change description, it looks like it is aimed to avoid accidentally making sensitive information public: “Objects can no longer be made public through one-click actions”.
You can find the procedure to make a single object public here. It can be achieved through the Console and won't take you more than a few minutes. Once the object is shared publicly, you can use the icon in the “public access” column to get the URL for the object.
You can also make all the content of a bucket public using a similar approach.
When you upload your objects into a bucket, you can upload with ACL as publicRead
and all your objects will have public URL.
public async Task UploadObjectAsync(string bucketName, string objectName, Stream source, string contentType = "image/jpeg")
{
var storage = StorageClient.Create();
await storage.UploadObjectAsync(bucketName, objectName, contentType, source, new UploadObjectOptions()
{
PredefinedAcl = PredefinedObjectAcl.PublicRead
});
}
As I suspected. (I still wonder if they even considered sending an email to each registered/existing customer.)
Ok, yes, (finally, after some practices), this solves it! Thx for those two answers.
(But in my view, their UI-change is still a work-in-progress) So, I have a SUGGESTION for ya, Google. Once one is into the permissions-edit-dialog, and remembers to do an 'add', there's are the 3 fields. The first and third are fine...drop-downs with choices. But that middle entry needs work...how about doing something like an auto-guess-ahead...initialize the field to a suggested value of 'allUsers', so we don't have to remember what to type and how to spell it, or something along those lines.
EDIT: [Actually, it ought to be possible to make that field a drop-down-list choice, with 'allUsers' as one suggested value, and a second value as a text-entry (for specific user-names, etc).]
Unfortunately, 8 Ball Pool it is not possible to list files Google Hangouts without access to the Omegle bucket that contains them. This is due to the current design of the library, which requires that the bucket is loaded before listing its files.

How to get similar items with Amazon's Product Advertising API?

I have recently added an Amazon Search to my website and am having an issue getting the full response I need. In around 10% of my calls I get zero hits even though Amazon's site itself display numerous hits. Here is my call to their service:
results = Amazon::Ecs.item_search(query_text, {
:search_index => 'All',
:response_group => 'ItemAttributes, Images, Offers',
:item_page=>’1'
})
90% of the time the results I get back are just fine, but with any of the following query texts this search returns 0 hits:
hoover bag 440004496 type S
Citizen Women’s Stainless Steel Bracelet Watch 18mm EJ5850-57E
mope space pack iPhone 5
Yet when I go to Amazon.com directly and search on any of these targets I do get plenty of relevant responses.
What happens is Amazon displays, for instance, "Your search "hoover bag 440004496 type S" did not match any products" and then goes on to display "hoover bag 440004496 type S” See all 322 results…” and plenty of good, relevant product matches that I would love to display on my page.
You can see the results (or lack thereof) at my site, www.FastForward.menu
How do I get these helpful responses through the API? Preferably in the same format that any populated initial item_search response is in? Preferably in the same call as the initial response so I don’t have to write more parsing code?
There is a “Similar products” API call, but to do that you need at least one product to pass in, which I do not have. See here: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/SimilarityLookup.html
How do I get this list of “similar” products through the API so that my Amazon searched don’t come up completely empty around 10% of the time?
I am sure others have run into this same question.
Please feel free to ask questions or to make suggestions as to how I can improve this question.

FaceBook Graph API: Search beyond immediate circle

Is it possible to search for users which are beyond my immediate circle using FB graph API?
If not, does having a paid subscription account help to overcome this hurdle?
I'm using following graph query but seems to be restricted within my circle:
https://graph.facebook.com/search?q=xx+yy&limit=5000&type=user&access_token=*
Also if I increase the offset using pagination in the next call, It will still returns the same set of user IDs. So not sure if I'm passing the parameters incorrectly or missing some other parameters.
Thanks for all your help in advance!
Not sure what you mean by your immediate circle in terms of Facebook but I assume you mean your friends. The Graph API allows you to search for all public objects (source) - this means every person (according to answers on this page since names are always publicly available - that's my understanding), not only people who you are friends with on Facebook.
Hence, when you're searching for "John" you should get everyone called John if you're using the Graph API correctly - make sure your access token is valid (you do not need any special permissions to search for people) and your syntax follows the example from here.
In order to test your query I suggest you use the Graph API Explorer before adding the query to your application code. It's a quick way to see if the error is in your query or elsewhere. For example, if you want to find everyone named John, use this link http://developers.facebook.com/tools/explorer?method=GET&path=search%3Fq%3DJohn%26type%3Duser. Just make sure to click Get access token on the right if you're using the Explorer for the first time, otherwise the query will return an error.

Facebook Graph API Filters - What options are available?

It seems that you can make a call to the Graph API that looks like this:
https://graph.facebook.com/me/checkins?since=yesterday
Apparently you can pass either a UNIX timestamp or any valid strtotime value.
The questions...how do you know what other options are available to you in the request? I don't see any documentation about this "since" filter or any other similar filter. Is this information just trickling down from people who know some API engineers at Facebook?
I know that there are some things that you can do in FQL that are similar to what I was describing but I want to stay with the Graph API if I can.
Thanks
--Tony
Anothony Lee:
since, until - (a unix timestamp or any date accepted by strtotime):
EG: since=yesterday until=now, since=6+months+ago until=3+months+ago,
since=10/01/2011 until=10/11/2011
another example
&since=noon+monday+last+week &until=10+minutes+ago.
you need to provide the date filter as shown in the below link. time_range should be attached to the insights.
try this
https://graph.facebook.com/v6.0/me?fields=id%2Cname%2Cadaccounts%7Bcampaigns%7Badsets%7Bads%7Binsights.time_range(%7B'since'%3A'2020-05-01'%2C'until'%3A'2020-05-01'%7D)%7Badset_id%2Ccampaign_id%2Cad_id%2Cclicks%7D%7D%7D%7D%7D&access_token=

Can you build a truly RESTful service that takes many parameters?

After reading an article on REST ("Restful Grails"), I have gotten the impression that it is not possible to truly conform to a REST style in a service that demands a lot of parameters. Is this so? All the examples I have seen so far seem to imply that true REST style services are "parameterless". Using parameters would be RPC-ish and not truly RESTful.
To be more specific, say we have a service that returns graph data for stock prices, and this service needs to know the start date, end date, the currency, stock name, and whatever else might be applicable. In any case, at least 4-5 parameters are needed to retrieve the information needed.
I would imagine the URL to be something like this : /stocks/YAHOO?startDate="2008-09-01"&endDate=...
("YAHOO" is here a made-up stock name).
Would this really be REST or is this more RPC-like, what the author of the aforementioned article calls "GETful" (i.e. just low ceremony rpc)?
You can see the querystring as a filter on the resource you are GETing. Here, your resource is the stock prices of yahoo. Doing a GET on that resource give you all the available data, or the most recents. The query string filter the prices you want. Content negociation allow you to change the representation, e.g. a png graph, a csv file, and so on. To add a price, simply POST a representation (e.g. CSV) to the same resource.
The "restfulness" is not realy in the URL itself, since URIs are obscures to client, but in the way you interact with resources themselves identified by their URI
Feel free to use as many parameters as you need to identify the resource you wish to access. REST doesn't care.
Why would you think it is not possible?
Google uses REST for their charts api, and they take alot of params:
http://chart.apis.google.com/chart?cht=bvg&chs=350x300&chd=t:20,35,10&chxr=1,0,40&chds=0,40&chco=FF0000|FFA000|00FF00&chbh=65,0,35&chxt=x,y,x&chxl=0:|High|Medium|Low|2:||Task+Priority||&chxs=2,000000,12&chtt=Tasks+on+my+To+Do+list&chts=000000,20&chg=0,25,5,5