🔍Checking if a Link Exists
If you try to create a link with a path that’s already taken, the API will respond with a 422
error.
To avoid this, you can proactively check whether a given path is already in use.
Use the q[path_eq]
query parameter in the get links request:
/api/v1/links?q[path_eq]=myPath
In response, you will get a list of links that match the path:
{
"links": [
{
"id": "0196c8fc-3dde-7902-857f-8f115346324d",
"name": "My Link",
}
],
"meta": {
"page": 1,
"count": 1,
"limit": 20
}
}
If the links
array is empty, the path is available. Otherwise, it’s already taken.