-
Hello, When I create a new url via the API, but the keyword already exists, it returns an error telling me that it already exists but it doesn't give me the url. Because at the moment, when the word already exists, I haven't found any other solution other than going manually to the interface to find the url of the link. thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The way the If you get this error when calling the |
Beta Was this translation helpful? Give feedback.
-
I didn't thank you. Especially since the documentation is not very clear and the API is not at all consistent. The response from the shorturl action returns:
And in the expand API, when it asks for the "shorturl" parameter, you have to put the keyword and not the real "shorturl".
The API's response is also not very consistent, as the status is no longer returned in the "status" field but "message" (unlike the shorturl call) |
Beta Was this translation helpful? Give feedback.
The way the
shorturl
action checks for a keyword already in use also checks if the keyword is reserved or banned, so there might not be a long URL to return in this case (error:keyword
).If you get this error when calling the
shorturl
action, the simplest next step if you want any long URL associated with the keyword is to call theexpand
action. If the keyword is in use, the link already associated with that keyword will be returned in thelongurl
field. You will get a 404 status code if the keyword is not in use (i.e. reserved). See the API tab ofhttps://your.yourls.site/readme.html
for more information about available API methods.