Coding the API Upload Endpoint
…back
down to setOriginalFilename() and paste! And if for some reason it's not set,
we can still use $filename as a backup. But that's definitely impossible for our
API-style thanks to the validation rules.
Deep breath. Let's try it again. Woh…
The POST Create API
We now GET and DELETE the rep logs via the API. The last task is to create
them when the form submits. Look back at RepLogController: we can POST
to /reps to create a new rep log. I want to show you just a little…
Testing your API with PHPUnit
Testing your API with PHPUnit¶
What, a testing chapter so early? Yep, with API’s, you really can’t avoid
it, and that’s a good thing. One way or another, to develop, test and debug
each endpoint, you’ll need to either write some…
JSON Errors in your API
Whenever something goes wrong in our API, we have a great setup: we always get
back a descriptive JSON structure with keys that describe what went wrong:
I want to do the exact same thing when something goes wrong with authentication.
Open up the TokenControllerTest…
A Homepage for your API?
…again!
Now, we need the name of the route. So let's go give this new route a name:
api_homepage:
We'll use this in the Relation. And because there aren't
any wildcards in the route, we don't need any parameters.
Cool…
Symfony RESTful API: Authentication with JWT (Course 4)
After 3 tutorials, we've got a nice API, But we've been completely ignoring
authentication. What about API tokens? Or properly handling errors? Thanks to some modern tools, this will be such a treat:
Understanding JSON web tokens (JWT)
Creating, signing & returning JWT's…
Symfony RESTful API: Errors (Course 2)
…which
is why we're covering this in episode 2.
So, let's handle errors, and let's do it gracefully:
Handling Form Validation errors and response
Disabling csrf_protection
Introducing the api-problem JSON format
Exception Listener!
Consistent errors everywhere: 404's, 500's…
ReactJS talks to your API
…parent block, and then we can put our
cool stuff below that.
Here's the goal: add some JavaScript that will make an AJAX request to the notes
API endpoint and use that to render them with the same markup we had before. We'll…
Facebook: Using the API, Logging in and Failure
…it:
Refresh the page to try it out. It prints out an array with an id and
a long number string. The response from api is specific to what you're
trying to do. In this case, this is the ID of the new post…
Symfony RESTful API: Hypermedia, Links & Bonuses (Course 5)
…These can make your API awesome, or could bring
you to your knees with fuzzy details, missing best practices and complexity.
Let's make our API awesome:
Linking to Resources (and Hypermedia) without hating it
Controlling your JSON fields with VirtualProperty and SerializedName
Customizing your…
Symfony RESTful API: Basics++ (Course 3)
…
Errors, double check!
Now let's get back to some core API concepts and take things up a level by covering a bunch of features that you need... but sometimes can't find related to REST!
REST Pagination
Including next/prev pagination links
Filtering collections…
Symfony RESTful API: Course 1
…same API in the
REST series, but leveraging
all the amazing tools and libraries of the Symfony framework. If terminology
like representations, resources, and hypermedia are new to you, start
with the REST series and
then come back. And get ready to get your (API…
The Twig Service & Profiler for API Requests
…seeing all the log messages
that were made only during that last request to the homepage.
Great! Except that... our log message is made on an API endpoint... and API
endpoints don't have a web debug toolbar we can click! Are we stuck? Nope…
Creating Token Resources in the API
…like a programmer
resource. So the scenario for this is going to look really similar. The only
difference is that we can’t authenticate with an API token, because that’s
what we are trying to get. So instead we’re going to authenticate with…
Symfony Serializer - nasz przyjaciel w pracy z API (Paweł Skotnicki)
Jako programiści aplikacji internetowych często stykamy się z różnymi API - jako dostawcy i konsumenci - a to oznacza konieczność serializacji i deserializacji.
To bardzo szerokie zagadnienie, ale Symfony dostarcza nam komponent, który pomoże nam rozwiązać większość problemów z którymi się spotkamy.
W prezentacji przedstawię użycie komponentu…
`api_platform:
resource: .
type: api_platform
prefix: /api
`
in api_plataform.yaml not work for me , I have to put in route.yaml of config
API Platform first please! :)
Strange Api-platform activity. It looks like ApiProperty Attribute doesn't work with json format. Why? And how to make ApiProperty to work on json format too?
I have simple ApiResource example
```
#[ApiResource()]
class UserApi
{
public ?int $id = null;
public ?string $firstName = null…
Historically API Platform would essentially treat PUT operations as PATCH operations and be used for partially updating resources. I believe in latest versions of API Platform the PUT operation now actually acts like a true PUT, where where all non-specified fields are removed (set…
x
1000+