YOURLS Link API

the YOURLS link API, as a web service

See here for a complete list of operations.

YOURLS Link API

The following operations are supported. For a formal definition, please review the Service Description.

This web service is using http://tempuri.org/ as its default namespace.
Recommendation: Change the default namespace before the XML Web service is made public.

Each XML Web service needs a unique namespace in order for client applications to distinguish it from other services on the Web. By default, ASP.NET Web Services use http://tempuri.org/ for this namespace. While this is fine for XML Web services under development, it must be changed before the service is made public.

CreateLink

Makes a short link for an address. Free, no sign-up and no key. The same address always gives the same short link, and links do not expire.

Test

To test the operation using the HTTP GET protocol, press the 'Invoke' button.

ParameterValue
url:
keyword:

The second parameter is optional: it picks the short name yourself. Add + to a short link to see where it leads.

Usage

Most callers are programs. A plain GET is enough.

YOURLS Link API: a YOURLS link shortener with a GET and POST API. No account and no API key.

Make a link. The answer is JSON and the short link is in "shorturl":

    https://www.yourlslinkapi.com/api/shorten.php?url=https%3A%2F%2Fexample.com%2Fa%2Flong%2Faddress

From a shell, as a GET, a form or JSON:

    curl -G https://www.yourlslinkapi.com/api/shorten.php --data-urlencode 'url=https://example.com/page?a=1&b=2'
    curl https://www.yourlslinkapi.com/api/shorten.php -d 'url=https://example.com/a/long/address'
    curl https://www.yourlslinkapi.com/api/shorten.php -H 'Content-Type: application/json' -d '{"url":"https://example.com/page"}'

Pick the keyword yourself, 1 to 64 letters, digits, - or _:

    https://www.yourlslinkapi.com/api/shorten.php?keyword=my-name&url=https%3A%2F%2Fexample.com%2Fa%2Flong%2Faddress

Follow a link, or see where it leads without going there:

    https://www.yourlslinkapi.com/<keyword>         redirects
    https://www.yourlslinkapi.com/<keyword>+        the address as text

Percent-encode url, or put it last: an address written out as it is
runs to the end of the line, with its own ? and & in it.

The same address gives the same short link every time, unless you name
it yourself. A keyword that is taken answers 409. Links do not expire.

SOAP

The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.

POST /CreateLink HTTP/1.1 Host: string Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/CreateLink" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CreateLink xmlns="http://tempuri.org/"> <url>string</url> <name>string</name> </CreateLink> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CreateLinkResponse xmlns="http://tempuri.org/"> <CreateLinkResult>string</CreateLinkResult> </CreateLinkResponse> </soap:Body> </soap:Envelope>
This page was generated from the service description. Service description for a public YOURLS link service. Service | Documentation | Plain text | Login