mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-23 07:33:58 -06:00
Updated edit short URL endpoint to be used with patch instead of put
This commit is contained in:
parent
25a785dfa7
commit
988de0b96e
@ -81,7 +81,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"put": {
|
"patch": {
|
||||||
"operationId": "editShortUrl",
|
"operationId": "editShortUrl",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Short URLs"
|
"Short URLs"
|
||||||
@ -169,6 +169,95 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"put": {
|
||||||
|
"deprecated": true,
|
||||||
|
"operationId": "editShortUrlPut",
|
||||||
|
"tags": [
|
||||||
|
"Short URLs"
|
||||||
|
],
|
||||||
|
"summary": "[DEPRECATED] Edit short URL",
|
||||||
|
"description": "**[DEPRECATED]** Use [editShortUrl](#/Short_URLs/getShortUrl) instead",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "shortCode",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The short code to edit.",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "Request body.",
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"validSince": {
|
||||||
|
"description": "The date (in ISO-8601 format) from which this short code will be valid",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"validUntil": {
|
||||||
|
"description": "The date (in ISO-8601 format) until which this short code will be valid",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"maxVisits": {
|
||||||
|
"description": "The maximum number of allowed visits for this short code",
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKey": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "The short code has been properly updated."
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Provided meta arguments are invalid.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "No short URL was found for provided short code.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Unexpected error.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"delete": {
|
"delete": {
|
||||||
"operationId": "deleteShortUrl",
|
"operationId": "deleteShortUrl",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"name": "X-Api-Key"
|
"name": "X-Api-Key"
|
||||||
},
|
},
|
||||||
"Bearer": {
|
"Bearer": {
|
||||||
"description": "**[Deprecated]** The JWT identifying a previously authenticated API key",
|
"description": "**[DEPRECATED]** The JWT identifying a previously authenticated API key",
|
||||||
"type": "http",
|
"type": "http",
|
||||||
"scheme": "bearer",
|
"scheme": "bearer",
|
||||||
"bearerFormat": "JWT"
|
"bearerFormat": "JWT"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Authentication",
|
"name": "Authentication",
|
||||||
"description": "**[Deprecated]** Authentication-related endpoints"
|
"description": "**[DEPRECATED]** Authentication-related endpoints"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ use function sprintf;
|
|||||||
class EditShortUrlAction extends AbstractRestAction
|
class EditShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-urls/{shortCode}';
|
protected const ROUTE_PATH = '/short-urls/{shortCode}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH, self::METHOD_PUT];
|
||||||
|
|
||||||
/** @var ShortUrlServiceInterface */
|
/** @var ShortUrlServiceInterface */
|
||||||
private $shortUrlService;
|
private $shortUrlService;
|
||||||
|
@ -44,7 +44,7 @@ class CrossDomainMiddleware implements MiddlewareInterface, RequestMethodInterfa
|
|||||||
|
|
||||||
// Add OPTIONS-specific headers
|
// Add OPTIONS-specific headers
|
||||||
foreach ([
|
foreach ([
|
||||||
'Access-Control-Allow-Methods' => 'GET,POST,PUT,DELETE,OPTIONS', // TODO Should be dynamic
|
'Access-Control-Allow-Methods' => 'GET,POST,PUT,PATCH,DELETE,OPTIONS', // TODO Should be dynamic
|
||||||
// 'Access-Control-Allow-Methods' => $response->getHeaderLine('Allow'),
|
// 'Access-Control-Allow-Methods' => $response->getHeaderLine('Allow'),
|
||||||
'Access-Control-Max-Age' => '1000',
|
'Access-Control-Max-Age' => '1000',
|
||||||
'Access-Control-Allow-Headers' => $request->getHeaderLine('Access-Control-Request-Headers'),
|
'Access-Control-Allow-Headers' => $request->getHeaderLine('Access-Control-Request-Headers'),
|
||||||
|
Loading…
Reference in New Issue
Block a user