Building an API in 60 seconds, without any server setup
api.blockspring.com
api.blockspring.com
This seems to think very differently about APIs. As if APIs are somehow tied to a specific language? When they use the term API, do they maybe mean library?
I think that under the hood, the idea is that, if you want to do something, in another language (rather than just writing it in the language) you somehow generate a stub in both languages and then proxy through a (network?) connection?
To make this more complex, it seems that the proxy connections are not just on the local machine, but over the internet to another machine. Presumably you have to pay for this?
Am I right? This seems like a lot of effort to go through just to avoid figuring out how to do something directly. With really sucky performance implications. I guess it depends on what you're doing. Most languages support a foreign interface to C, so maybe that is a more sensible way to do this rather than setting up "servers" and tunnelling commands and data back and forth.
EDIT: I just had another look at the website. So, when they use the term API - it would seem that they mean some sort of an HTTP based web interface? The idea is that you have some kind of script that does something for you and you can query it from you local script. I still don't understand why you'd want to do this over running it locally?
You're totally right. I'm not sure API is the best word for it, but haven't found a better one. Would love your thoughts!
I've heard a bunch of crazy usecases from HN over the past day but my original one was to simply take some of the python and R scripts I had, and without much work (a few clicks actually) be able to execute them from my frontnd js, or from rails workers. It worked really well so we decided to see if others might find it useful too.
It's badass to see what others are coming up with in the API Library, hoping that can be a valuable page for everyone. And I imagine when we figure out fair pricing, we can actually make this significantly cheaper than a dedicated server for these processes.
Please, continue to send feedback like this. You're awesome.
I think perhaps the most interesting part of this is that they're apparently spinning up/down Python (and other languages) sandbox environments on the fly, nearly instantaneously.
Running the script directly requires a correctly-configured environment for each scripting language you want to support on each device. If a script has additional dependencies or libraries, those must also be installed locally if you want to run the script locally. By putting the script behind an HTTP API, it just needs to be correctly configured once on a single device (the API server), and then the requirement for using the script on all other devices is just plain old HTTP.
Suppose you have five different scripts each written in a different language (because languages have their own strengths and weaknesses). And suppose you need to run all of these scripts on three completely different devices (say, a phone, a laptop, and an Arduino). If you want to run the scripts directly on each device, then you need to set up 5*3=15 runtime environments and make sure they all function correctly (and don't break with updates). To save effort, it might make sense to put these scripts behind an HTTP API, and then just use simple HTTP requests from each device to access all scripts in a uniform manner. Note that in reality, you'll probably want to be targeting much more than three devices, so the savings can stack up quickly.
For such people, I propose the metaphor that HTTP APIs are a form run-time linking where the root URL (api.example.com) is the "library" and the valid URIs (api.example.com/list_of_cats) are the exported "symbols" you can reference from your program. Performing a GET on such a "symbol" is like dereferencing the pointer you get from calling dlsym. The 400 and 500 range status codes are like dlsym's error codes: 404 is a failure to find the symbol, 500+ is various run-time errors, etc.
I think the confusion comes from a slow divergence of terminology. Web providers offered "API's" to allow people to access their services, these were kind of API's in the sense that an application could use them. However, it seems that for the web development community has begun to think that an API and an HTTP based API are synonymous (they are not!). Hence my confusion here.
Great questions. Let me answer them one at a time!
Where is the code running? Every script run happens in its own sandbox on our machines. We use docker, it's awesome. People are asking for dedicated machines specifically for their company, and others are asking to hook into their own machines. Once we figure out how people/companies want to use the site, we'll put up some options for where code will be run. I'm totally open to feedback and would love to hear what you think.
I'm measuring costs right now. But I'm seeing that when we get a fair pricing model up - if you could hit these api's only when you need them, rather than have a dedicated server for them, you'd save a money. A really different way of looking at PaaS + Apis... and I'm super excited about it. Right now, I'm just trying to collect as much awesome feedback as possible for use cases, and then we'll have a better idea for how users would want to be charged. Right now, people are asking for a simple request-based model. Would love your thoughts on this as well.
Thanks again for the questions. You're awesome.
paul@blockspring.com 312.834.7265
How are you securing the Docker containers since Docker hasn't yet added user namespaces?
Note that ZeroVM isn't an x86 VM, so you need a custom Python (which that Dockerfile downloads). There are also no network sockets, so some things are difficult to make work, but you can work around that by using network code in the Docker container, and riskier code in ZeroVM.
I'd be pretty confident in that security model.
However, it's six months old now, and likely to need some updating. ZeroVM was changing pretty quickly when I was working on it.
[1] https://github.com/nlothian/Acuitra/tree/master/infrastructu...
Please buy these guys and enable this functionality for gists.
Do you have example gists you've want API'd? We could take a look tonight about how to implement this
PS - to see the libraries we currently support, check out: https://api.blockspring.com/documentation
Yeah. I don't have a use for this as-yet but I can see organisations wanting to import their preconfigured envs in.
Bonus points if one can make an ORM out of it, e.g.
for article in get_api('reddit.com').todayilearned.filter('new').limit(100):
... do something ...
Where a call to get_api() dynamically fetches the latest scraping functions, in case reddit's page design has changed.Triple bonus points if the system can be designed in a de-centralized fashion to defend against ToSes that try to disrciminate between human eyes and machine eyes.
Or if someone on here knows how to do this, and wants to throw up an API on Blockspring for it, we'd all love it :)
The API generation with Blockspring and Kimonolab is very nicely done but I like to focus solely on the web scraping more, as it represents very difficult set of challenges.
Is there a way to sign up for a paid account or a credit system? I don't want to burden you guys with the costs of my API requests.
People have messaged me asking for pricing tiers based on rate limits / usage, or purchasing company machines to run all apis from, or even paying for extra privacy (like on github).
What's most fair / makes most sense for you?
Good luck!
containers, bytestring, mtl, text, transformers, time, array, aeson, split, blaze-builder, blaze-html lens, safe, resourcet
I'm sure aeson examples would be very popular. mtl/transformers examples for those who are getting to them in the learning process.
Here is a complete list of the top reverse dependencies for libraries on hackage:
https://docs.google.com/spreadsheets/d/1o7K_tEDIULPHNv8RpP0E...
"STDOUT and STDERR from cmd will be dumped to the response body."
"HTTP headers and query parameters will be passed as environment variables."
Uhhh, your friend just reinvented CGI: https://en.wikipedia.org/wiki/Common_Gateway_Interface
Paul@blockspring.com
3128347265
I'm a really big believer in sites that provide a ton of utility for free, and only charge you when you're actually costing the company something.
That said if you do want to use a ton of CPU, that gets expensive for us - so we may make paid accounts for people that use CPU heavy API's. We realized Blockspring would still be a lot cheaper than keeping your own EC2 server up all the time, so that's sorta cool!
Also if you wanted it set-up locally at your company and 24/7 phone support (from the two of us), we'd have a paid account to cover our time.
Obviously if you have ideas let us know!
But project no longer in developing, so i guess maybe someone wants to reanimate codecube? On weekends for example, contact me: iamjacke AT gmail.com
I already knew how to do screenshots in Python, and was tired of relearning this stuff in a different language for each project.
So I made an API that takes a screenshot, and now I don't need to learn it ever again :)
https://api.blockspring.com/users/mapsup/blocks/07b6410853fa...
I used to just run that python script manually on my computer. Now I can just call it from my front-end js when users upload images and return back some text about the image.
https://api.blockspring.com/users/pkpp1233/blocks/5a1b66ef20...
But you can do just about anything. Users have done r statistics from js. Or python sentiment analyses (lots of good libraries there) whenever they get user comments in their rails app.
I was thinking about intercepting the requests it makes and making an open source extension that does the same thing, but I haven't had the time yet.
[1] https://chrome.google.com/webstore/detail/search-by-image-by...