How do I send a Purge Request - akamai

I'm trying to purge several URLs via php of Akamai servers. So far I've been using the CCU Rest Api which simply sends a HTTP-Request with the urls and options encoded in json. I've heard that the support of this API will end soon so I wanted to use a different API to do it.
I wanted to use this one
Since the documentation is really unstructered and does not tell anything how to send the credentials to the server. I already found their GitHub repositry but I didn't understand anything because I'm pretty new to PHP.
Can someone please explain me how to send only the Purge Request? Validation and checking the results is a piece of cake, the Request is the point where I'm struggeling.
Thanks a lot

You can use the newer OPEN API, I've written a blog post telling you how to get started
https://community.akamai.com/community/developer/blog/2015/08/20/getting-started-with-the-v2-open-ccu-api
The older API is much less secure, and the newer method will allow, very soon, for 5 second purges.
Let me know if you have any more questions,
Thanks,
Kirsten

Related

Google Home API for going to a URL and login

I am a very new developer who can write basic HTML (yes I know it's English), and is looking for a solution to a problem that I basically invented.
I recently bought a product called Doorbird, a very cool and well engineered IP Doorbell. The reason I bought it, is because it has an App, and integrates with IP phones and support video, and has a few bells and whistles, if you're not familiar with this product, I highly recommend looking at it.
The "problem" is that it does not integrate with Google Home, or Amazon Echo. However, it does have an API that allows you to go to the URL, login and unlock the door. I was looking into creating my own action that would have the Google Home login to the Doorbell and go to the unlock URL.
My issue is, I have no experience with this, but I pick things up very quickly, and believe in myself!
I already looked at the api.ai site from Google, and have signed up. It looked simple, but upon further investigation looks very complicated.
If anyone would be able to point me in the right direction I would be greatly appreciative.
Thanks in advance,
-Jack G
You need them to publish their REST api so that you can call the 'action' to unlock directly vs. having to go to a login page. You would probably set up oauth to have your server talk to theirs or use web headers. Ask their tech support if they support direct REST api using a security model.

How to make Django pass cookies when communicating with Node.js server using socket.io?

I am currently developing an instant messaging feature for my apps (ideally cross platform mobile app/web app), and I am out of ideas to fix my issue.
So far, I have been able to make everything work locally, using a Node.js server with socket.io, django, and redis, following what most tutorials online suggest.
The step I am now at consists in putting all that in the cloud using amazon AWS. My Django server is up and running, I created a new separate Node.js server, and I am using Elasticache to handle the Redis part. I launch the different parts, and no error shows up.
However, whenever I try using my messaging feature on the web, I keep getting an error 500:
handshake error
I then used the console to check the request header, and I observed that the cookies are not in there, contrary to when I am on localhost. I know it is necessary to authorize the handshake, so I guess that's where my error is coming from..
Furthermore, I have also checked that the cookies do exist, they are just not set in the request header.
My question is then: How can I make sure Django or socket client (not sure who's responsible here..) puts the cookies in the header??
One of my ideas was that maybe I am supposed to put everything on the same server, with different ports, instead of 2 separate servers? Documentation on that specific architecture problem is surprisingly scarce, compared to the number of tutorials describing how to make it work on local.
I hope I described the problem accurately enough! :)
Important note: I am using socket.io v0.9.1-1, only one compatible with a titanium mobile app.
Thank you for any help!
All right, so I've made some progress.
The cookie problem came from the fact I was making cross-domain request, adding a few lines enabled CORS, which didn't solve the cookie issue, but allowed me to communicate between servers (basically I set the headers of the response using express. I then passed necessary data in the query, even if not the most secure way to do it, I'm just building an MVP, and it's enough for now.
I haven't been able to make the chat work from my Titanium mobile app, but since I can use a webview to handle it, I will be fine.
Hopefully that will help someone.. If anyone needs me to post some code snippets I will gladly do so upon request!
Cheers

how connect to echonest from enyo

I am new to Enyo and web services. I am looking to build a web page with Enyo that will require use of Echonest. Can anyone help me understand how to connect to the Echonest service from inside Enyo and whether to use SOAP, REST, or something else?
I assume you are talking about the Echo Nest found here: http://the.echonest.com ?
Briefly glancing at their API, you may not have to use SOAP or REST since everything is accessible with simple GET requests through the Web service. It looks like the hardest part of using their API will be generating OAuth signatures for authenticated requests.
As far as the enyo.WebService, http://enyojs.com/api/#enyo.WebService, goes, you should be able to include the kind, set the URL and call the .send() method on it. Then you response handler would get the data back (I recommend json) so you can do what you will with it.
Another option would be to use enyo.Ajax, http://enyojs.com/api/#enyo.Ajax, directly. enyo.WebService wraps that and provides a familiar (to Enyo 1 developers) way to use it.

How to use NowJS to provide notifications to user in django framework

I have built a website in django framework. It has a lot of features such as blog, discussion forum, basically there are lots of ways users can interact. I have built a basic notification framework where a user gets notified when somebody comments on their blog, or answers their question in the forum.
Since the notifications are stored in db, new notifications are displayed only when a page refresh is done. I would like to make it real time using some push server using something like long polling technique.
I have come across NowJS which seems to be pretty handy for this, but in all the examples that are given I could not see any example where there was any interaction with the database. In all the cases there was some information sent by one client and it was displayed to one or more clients.
What I actually want to do is to call a function using NowJS, and make it go to sleep until a new notification is added in the database. When a new notifications comes in the server responds back with the notification and a new request is done immediately.
I can figure out all other parts except how to access the database from Node server that is used by NowJS. Any help or guidance is appreciated.
Either:
Have your node.js server make an http call to the Django server via something like a REST api to get info back
Google for a database connector for node.js - I found enough evidence for a MySQL one, and rumours of a PostgreSQL one. Note this won't get you access to the Django DB API, so you'll have to work out all your related queries and craft your SQL by hand (make sure Bobby Tables doesn't bother you: http://www.xkcd.com/327)
Re-implement the NowJS protocol so that you can write a django server for it, keeping the same JS client code on the clients... but then you may as wel.....
...use django-socketio http://blog.jupo.org/2011/08/13/real-time-web-apps-with-django-and-websockets/

What is the most RESTful form of authentication? Who is using it?

Duplicate: this must be a duplicate of one of the questions that come up in the following search: Please close it as a duplicate if you agree, and add any answers to one of the other questions.
What is the most RESTful form of authentication? What websites use it? (so I can go look at the documentation).
Looking at some APIs that claim to be REST are really POX
(ex. Remember the Milk - http://www.rememberthemilk.com/services/api/methods/)
I don't know if this is the 'most RESTful' form, but Amazon's S3 uses an authentication method which is documented here. Each request is signed, so there is no session to track on the backend, but you can still securely verify what user issued the request.
The most RESTful authentication method is probably HTTP Basic. Because it has some significant weaknesses (replay attacks), most APIs tend to shy away from it.
Open Sourcery has a well-thought-out article on RESTful authentication. Sounds like there are no awesome solutions right now beyond simple user/pass auth over SSL and then keeping auth info in subsequent request headers.