gstreamer0.10-ffmpeg
gstreamer0.10-plugins-good
packages.
Yep, we need cover a bit of theory. Wait, come back! This stuff is super important and fascinating too. Put on your thinking cap and let’s get to it!
Everything starts with HTTP: the acronym that describes the format of the request message that a client sends and the response that our server sends back. If you think of an API like a function, the request is the input and the response is our output. It’s that simple.
GET /api/programmers HTTP/1.1
Host: CodeBattles.io
Accept: application/json,text/html
This is a basic request and it has 3 important pieces:
With that in mind, a POST request might look like this:
POST /api/programmers HTTP/1.1
Host: CodeBattles.io
Authorization: Bearer b2gG66D1Tx6d89f3bM6oacHLPSz55j19DEC83x3GkY
Content-Type: application/json
{
"nickname": "Namespacinator"
}
It’s the same, except the method is POST and we’re sending data in the body of the request. We also have 2 extra headers, one for authentication and one that tells the server that the body has JSON-formatted stuff in it.
The response message is similar:
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache, private
{
"nickname": "Namespacinator",
"avatarNumber": 5,
"tagLine": "",
"powerLevel": 25
}
The 200 status code is the first important piece, and of course means that everything went just great. Status codes are a big part of APIs. But people also like to argue about them. We’ll see the important ones as we build.
The headers tell the client that the response is JSON and that the response shouldn’t be cached. And of course, the JSON body is at the end.
HTTP is awesome and really simple. Got it? Great, let’s move onto something harder.
// composer.json
{
"require": {
"silex/silex": "~1.0", // v1.3.2
"symfony/twig-bridge": "~2.1", // v2.7.3
"symfony/security": "~2.4", // v2.7.3
"doctrine/dbal": "^2.5.4", // v2.5.4
"monolog/monolog": "~1.7.0", // 1.7.0
"symfony/validator": "~2.4", // v2.7.3
"symfony/expression-language": "~2.4" // v2.7.3
},
"require-dev": {
"behat/mink": "~1.5", // v1.5.0
"behat/mink-goutte-driver": "~1.0.9", // v1.0.9
"behat/mink-selenium2-driver": "~1.1.1", // v1.1.1
"behat/behat": "~2.5", // v2.5.5
"behat/mink-extension": "~1.2.0", // v1.2.0
"phpunit/phpunit": "~5.7.0", // 5.7.27
"guzzle/guzzle": "~3.7" // v3.9.3
}
}