core
core copied to clipboard
Accept absolute URLs for ApiResource URI template.
Description
If the API use a remote API for a relation (with a local database cache), it would be a nice features for IRIs to point to the resource on the remote API:
Example
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
#[ApiResource(
uriTemplate: 'https://remote.api/custom/api/brands/{id}',
provider: null,
)]
#[Get]
final readonly class Brand
{
With API Platform 4.1.11, this generates /api/https://remote.api/custom/api/brands/d1d08e37-1234-4567-918c-354b6b210ae1.
It would be nice to allow it to generate https://remote.api/custom/api/brands/d1d08e37-1234-4567-918c-354b6b210ae1
@landure Can you test with
#[ApiResource(
uriTemplate: '/custom/api/brands/{id}',
host: 'remote.api',
urlGenerationStrategy: UrlGeneratorInterface::ABS_URL,
)]
#[Get]
final readonly class Brand
{
``