-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit. * Added GET root endpoint. * Added @Aliases root POST * Refs #1393 - Add @Aliases endpoint docs * Flake8 & delete endpoint * Black Co-authored-by: Alin Voinea <[email protected]>
- Loading branch information
1 parent
bb60536
commit 4023828
Showing
5 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
html_meta: | ||
"description": "Aliases is a mechanism to redirect old URLs to new ones." | ||
"property=og:description": "Aliases is a mechanism to redirect old URLs to new ones." | ||
"property=og:title": "Aliases" | ||
"keywords": "Plone, plone.app.redirector, redirector, REST, API, Aliases" | ||
--- | ||
|
||
# Aliases | ||
|
||
Aliases is a mechanism to redirect old URLs to new ones. | ||
|
||
When an object is moved (renamed or cut/pasted into a different location), the redirection storage will remember the old path. It is smart enough to deal with transitive references (if we have a -> b and then add b -> c, it is replaced by a reference a -> c) and circular references (attempting to add a -> a does nothing). | ||
|
||
The API consumer can create, read, and delete aliases. | ||
|
||
|
||
| Verb | URL | Action | | ||
| -------- | ----------- | -------------------------------------- | | ||
| `POST` | `/@aliases` | Add one or more aliases | | ||
| `GET` | `/@aliases` | List all aliases | | ||
| `DELETE` | `/@aliases` | Remove one or more aliases | | ||
|
||
## Adding new aliases on a Content Object | ||
|
||
By default, Plone automatically creates a new alias when an object is renamed or moved. Still, you can also create aliases manually. | ||
|
||
To create a new alias, send a POST request to the `/@aliases` endpoint: | ||
|
||
```{eval-rst} | ||
.. http:example:: curl httpie python-requests | ||
:request: ../../src/plone/restapi/tests/http-examples/aliases_add.req | ||
``` | ||
|
||
Response: | ||
|
||
```{literalinclude} ../../src/plone/restapi/tests/http-examples/aliases_add.resp | ||
:language: http | ||
``` | ||
|
||
## Listing aliases of a Content Object | ||
|
||
Listing aliases of a resource you can send a `GET` request to the `/@aliases` endpoint: | ||
|
||
```{eval-rst} | ||
.. http:example:: curl httpie python-requests | ||
:request: ../../src/plone/restapi/tests/http-examples/aliases_get.req | ||
``` | ||
|
||
Response: | ||
|
||
```{literalinclude} ../../src/plone/restapi/tests/http-examples/aliases_get.resp | ||
:language: http | ||
``` | ||
|
||
|
||
## Removing aliases of a Content Object | ||
|
||
To remove aliases of an object, send a `DELETE` request to the `/@aliases` endpoint: | ||
|
||
```{eval-rst} | ||
.. http:example:: curl httpie python-requests | ||
:request: ../../src/plone/restapi/tests/http-examples/aliases_delete.req | ||
``` | ||
|
||
Response: | ||
|
||
```{literalinclude} ../../src/plone/restapi/tests/http-examples/aliases_delete.resp | ||
:language: http | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ expansion | |
actions | ||
workflow | ||
workingcopy | ||
aliases | ||
locking | ||
sharing | ||
registry | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters