Smurfs API

The Smurfs API is a sample API intended to provide new developers with a basic example of how to integrate code with an API and how to build an API.

To make working with the Smurf API simple, all responses are JSON, there is no authentication, and all CORS restrictions have been removed.


Smurf Insult API

The Smurfs Insult API doesn't require any input parameters. Just call the endpoint and get an insult as a response:

https://pages.codeadam.ca/smurfs/api/insult

Try it! Just open that URL in a browser and you will receive a different insult each time.

Here is an example using curl from the command line:

$ curl https://pages.codeadam.ca/smurfs/api/insult

And a sample response:

{
    "error":"false",
    "message":"Insult retrieved successfully",
    "insult":"Your job's so dull, even Smurfette fell asleep!"
}

Smurf Translator API

The Smurfs Translate API requires one parameter, the text you would like to translate. Just call the endpoint with a text paramter and it will return the translation:

https://pages.codeadam.ca/smurfs/api/translate
Parameter Description
text A plain text sentence to be translated to how a Smurf would say it. Can be provided using GET or POST.

Open that URL in a browser with a GET parameter for the text to translate.

Here is an example using curl from the command line:

$ curl 'https://pages.codeadam.ca/smurfs/api/translate?test=Hello, how are you feeling%3F'

And a sample response:

{
    "error":"false",
    "message":"Insult retrieved successfully",
    "translation":"Smurf, how smurf you?"
}

The Smurfs API is rouighly modeled off the Pirate API by Tim Moses.