Questions tagged [api-platform.com]

This tag should be used for all questions related to API Platform, a framework to create API-first web projects. API Platform contains a set of tools to build with ease fully-featured hypermedia APIs (modern formats, docs, authorization, filtering, ordering, cache, testing...) and to scaffold clients apps. It is built on top of Symfony components (PHP) and React (JavaScript).

API Platform is a next-generation web framework designed to easily create API-first projects without compromising extensibility and flexibility:

  • Design your own data model as plain old PHP classes or import an existing one from the Schema.org vocabulary
  • Expose in minutes a hypermedia REST API with pagination, data validation, access control, relation embedding, filters and error handling...
  • Benefit from Content Negotiation: JSON-LD, Hydra, HAL, YAML, JSON, XML and CSV are supported out of the box
  • Enjoy the beautiful automatically generated API documentation (Swagger/OpenAPI)
  • Add a convenient Material Design administration interface built with React without writing a line of code
  • Scaffold a fully functional Single-Page-Application built with React, Redux, React Router and Bootstrap thanks to the CRUD generator
  • Install a development environment and deploy your project in production using Docker
  • Easily add JSON Web Token or OAuth authentication
  • Create specs and tests with a developer friendly API testing tool on top of Behat
1446 questions
28
votes
1 answer

Why do I receive "This value should be of type string" when using a DateTime constraint on Symfony 5?

I have the following entity (only attached the relevant parts): use ApiPlatform\Core\Annotation\ApiResource; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ApiResource(mercure=true) *…
Toma
  • 2,764
  • 4
  • 25
  • 44
23
votes
9 answers

Symfony4: Unable to find the controller for path "/api/login_check". The route is wrongly configured

I am tyring to set up symfony4 api JSON login by JWT. The api platform core bundle is installed and I followed this instruction: https://api-platform.com/docs/core/jwt/ I created the custom user provider as described. By opening the URL…
user3684098
  • 349
  • 1
  • 3
  • 18
22
votes
4 answers

UML / API : How to model a RESTful API

I need to create a UML class diagram and a use case diagram for a RESTFul API that I developed using API Platform and Symfony 3.2 (backend) and Ionic 2 (frontend). But i dont exactly know how to describe the structure of my backend API through the…
15
votes
8 answers

How to ask for additional GET parameters in an endpoint of api-platform using swagger docs?

I have a symfony project, where I use api-platform. I have an entity, and I have data providers for it. I am in trouble with definition of additional parameters for a collection endpoint. An entity is called suggestion. It has to return collection…
pedrouan
  • 12,762
  • 3
  • 58
  • 74
14
votes
0 answers

ApiPlatform SerializeListener very slow

We're rewriting our API to use the excellent API-Platform library, but it's taking 6 seconds to return a small set of data, and 5 of those seconds are the APIPlatform SerializeListener. Is there any way we can speeed that up? It's a show-stopper.
Tac Tacelosky
  • 3,165
  • 3
  • 27
  • 28
11
votes
2 answers

Why do I get "No item route associated with the type" when using Api-Platform?

My project is built in Symfony 5 and API-Platform to consume it from a JS client. In this scenario, I have a Question entity related to an Answer entity (One-to-many respectively). Whenever I try to call /api/questions or /api/answers I get this…
Maramal
  • 3,145
  • 9
  • 46
  • 90
11
votes
2 answers

How to save a Nested Relation with Entity on API Platform

I have two entities, Question and Alternative where Question has a OneToMany relation with Alternative and I'm trying to send a JSON with a nested document of Alternative on it via POST to Question API Platform. The API Platform returns that error…
11
votes
1 answer

Symfony - API Platform - File Upload

I'm trying to implement a file upload with API PLatform following the Documentation using Vich. But it's not working, precisely, the MediaObject is not hydrated by the file I send on my request. I followed quite exactly the cookbook provided by API…
11
votes
4 answers

Using Api Platform, automatically assign user to Object (OneToMany)

Here is my scenario: I have an Article entity. Each Article has an owner (a User). A user can own many articles. The user can post an article over the API. I want to have the user_id column for the article set automatically based on the Bearer token…
Wildcard27
  • 1,437
  • 18
  • 48
11
votes
1 answer

API-Platform: Filtering Custom Data Provider

I'm currently experiencing issues when trying to filter my results when using an external API source (Stripe) in API-Platform. What I need to be able to do, is return a list of subscriptions for a specified customer. So going to…
Doug
  • 1,850
  • 23
  • 50
11
votes
2 answers

Api-Platform: Using Yaml config instead of annotations in SF 4

I'd like to use YAML instead of annotations in Api-Platform. Instead of using the Api-Platform distribution, I have added the api-pack into my existing Symfony Flex project (composer req api). The documentation says the YAML file should take place…
Ben
  • 845
  • 1
  • 8
  • 18
10
votes
2 answers

Api platform handling fille uploads

I'm trying to upload files with Api Platform and Vich Uploader Bundle. When I send POST request with multipart/form-data and Id of the entity to attach image file to, I get 200 response with my entity. But uploaded file doesn't uploads to…
Andrey Kryukov
  • 765
  • 1
  • 10
  • 23
10
votes
1 answer

API Platform - Which approach should I use for creating custom operation without entity

I'm new to API Platform. I think it's great but I cannot find any example how to create custom endpoint that isn't based on any entity. There are a lot of examples based on an entity and usually they are all about CRUD. But what about custom…
10
votes
0 answers

Api-platform filter annotation for Many To Many

I've follow the implementation of filters with annotation to load only the sources concern for one user. Very usefull, work properly. https://api-platform.com/docs/core/filters/#using-doctrine-filters BUT : I want to do the same in my entity with an…
mBbkr
  • 212
  • 3
  • 13
10
votes
1 answer

Using Doctrine extension softdeleteable with api-platform

I'm building an API with Symfony 3.4 and api-platform. I want to use soft delete on my entity. I've installed DoctrineExtensions and StofDoctrineExtensionsBundle. config.yml: doctrine: dbal: connections: default: …
Hakim
  • 1,084
  • 11
  • 28
1
2 3
96 97