api-platform.com

401 JWT Token not found

守給你的承諾、 提交于 2019-12-22 17:57:17
问题 I provided two versions of the security.yaml file. The second version according to API Platform documentation. API Platform sends to the creation a custom user provider. For the second option security.yaml recommended at API Platform docs, I need to create two additional files. I did not attach them to the topic, but will do it if necessary. But I think that problem it is in JWT. Environment: node v8.9.4 chrome 64.0.3282.119 Ubuntu 16.04 axios version: 0.16.2 Vue.js 2.4.2 vue-axios 2.0.2 api

Custom Symfony Action with API Platform bundle

牧云@^-^@ 提交于 2019-12-22 10:27:20
问题 I try to build an API with the Symfony bundle API-Platform. Api resource offer automatic CRUD action with the HTTP verbs POST, GET, PUT, DELETE. What I want is adding an endpoint to handle a custom POST action, with a custom payload/body, not depending on any resource. Where I block it is to add this endpoint to the automatic API-Platform documentation. When looking for this kind of issue on GitHub, I found that the API-Platform v2 should be able to do it. See Issue #385 : Custom action +

Unable to generate an IRI for the item of type

╄→尐↘猪︶ㄣ 提交于 2019-12-16 18:04:31
问题 I am actually building an API based on: symfony/flex: v1.0.61 symfony: v4.0.3 api-platform/api-pack: v1.0.1 api-platform/core: v2.1.4 The CRUD operations were easy to implement. Nevertheless, the custom operation does not seem to be straightforward. The custom operation I am trying to implement will simply return a App\Entity\Product based on a given $slug . the route is: /api/products/by-slugs/{slug} the method is: GET the operation type is: itemOperations This is how things are being done:

Best practice to return custom JSON on API-platform

流过昼夜 提交于 2019-12-13 08:49:01
问题 I want to update my existing API (created with FOSRest). I have lots of routes that return custom JSON objects, different from my entities. For example, I have an Offer entity <?php // api/src/Entity/Offer.php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * An offer from my shop - this description will be automatically extracted form the PHPDoc to document the API. * * @ApiResource

Request validator : validate an IRI

こ雲淡風輕ζ 提交于 2019-12-13 05:09:43
问题 I'm currently working with api-plateform which has been a great tool so far. I'd like to add some validator before my datas are stored into my database. Api-platform works with IRI instead of plain id (even if you can change this behavior). I was wondering what would be the best way to validate an IRI. Let's say I receive for instance "api/users/1". I would like to make sure that this IRI is actually valid (i.e the id exists in the table "user"). I could create a custom validator rule which

API Platform Did not show First Name And Last Name Upon normalizationContext and denormalizationContext

好久不见. 提交于 2019-12-13 04:27:29
问题 I am new to API Platform and I have some problem with normalizationContext and denormalizationContext for my User Entity on the API platform. When I added the normalizationContext and denormalizationContext to ApiResources, and yes I did add in as @Groups({"user:read", "user:write"}) above my first_name and last_name variable. But when trying to post data from the api platform, I didn't see my first_name and last_name variable option. This is my User entity <?php namespace App\Entity; use

Filter required in Api Platform

无人久伴 提交于 2019-12-13 03:40:58
问题 Im using API Platform and I have defined a custom filter following https://api-platform.com/docs/core/filters/#creating-custom-filters It works ok, but I need to that filter is required everytime that application do a GET HTTP Request of particular entity (where the filter is set). I have check this code: // This function is only used to hook in documentation generators (supported by Swagger and Hydra) public function getDescription(string $resourceClass): array { if (!$this->properties) {

how to debug “ ”Unable to get a property on a non-object." in custom operations?

北城余情 提交于 2019-12-13 03:34:57
问题 I'm getting the error "hydra:description": "Unable to get a property on a non-object.", when trying to implement a custom operation. I'm trying to figure out what causes this problem and while I've found a dozen or so wild guesses on both stackoverflow and elsewhere, none of the solutions posted there work for me. I'm trying to figure out how to debug this problem. The trace and info included with the error message is less than helpful: { "@context": "/api/contexts/Error", "@type": "hydra

How to install api-platform in existing symfony 3.4 application without flex?

馋奶兔 提交于 2019-12-11 18:35:11
问题 I try to install api-platform on an existing Symfony 3.4 application, which is installed without flex. When I try to install it with composer require api-platform/core , an error occured: Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - Conclusion: don't install api-platform/core v2.4.3 - Conclusion: don't install api-platform/core v2.4.2 - Conclusion: don

API Platform filter entity data

若如初见. 提交于 2019-12-11 17:52:43
问题 I just start to use Api platform and immediately stuck with problem how to filter data. I have entity User and i want to filter data that are present in response ( JSON API format) { "links": { "self": "/api/users" }, "meta": { "totalItems": 2, "itemsPerPage": 30, "currentPage": 1 }, "data": [ { "id": "/api/users/1", "type": "User", "attributes": { "_id": 1, "username": "jonhdoe", "isActive": true, "address": null } }, { "id": "/api/users/3", "type": "User", "attributes": { "_id": 3,