Code Monkey home page Code Monkey logo

freedictionaryapi's Introduction

Free Dictionary API

There was no free Dictionary API on the web when I wanted one for my friend, so I created one.

Important Note

The API usage has been ramping up radidly making it difficult for me to keep the server running due to increased AWS costs.

Your support directly helps the development of Dictionary API and keeps the server running.

Getting Started

Usage

The basic syntax of a URL request to the API is shown below:

https://api.dictionaryapi.dev/api/<--version-->/entries/en/<--word-->

As an example, to get definition of English word hello using v2, you can send request to

https://api.dictionaryapi.dev/api/v2/entries/en/hello, result returned will be,

[
    {
        "word": "hello",
        "phonetics": [
            {
                "text": "/həˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3"
            },
            {
                "text": "/hɛˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_2_rr.mp3"
            }
        ],
        "meanings": [
            {
                "partOfSpeech": "exclamation",
                "definitions": [
                    {
                        "definition": "Used as a greeting or to begin a phone conversation.",
                        "example": "hello there, Katie!"
                    }
                ]
            },
            {
                "partOfSpeech": "noun",
                "definitions": [
                    {
                        "definition": "An utterance of “hello”; a greeting.",
                        "example": "she was getting polite nods and hellos from people",
                        "synonyms": [
                            "greeting",
                            "welcome",
                            "salutation",
                            "saluting",
                            "hailing",
                            "address",
                            "hello",
                            "hallo"
                        ]
                    }
                ]
            },
            {
                "partOfSpeech": "intransitive verb",
                "definitions": [
                    {
                        "definition": "Say or shout “hello”; greet someone.",
                        "example": "I pressed the phone button and helloed"
                    }
                ]
            }
        ]
    }
]

There is also the option of adding multiple words in a single request by separating them with commas The following example request https://api.dictionaryapi.dev/api/v2/entries/en/banana,orange would return the following

[
	{
		"word": "banana",
		"phonetic": "bəˈnɑːnə",
		"phonetics": [
			{
				"text": "bəˈnɑːnə",
				"audio": "//ssl.gstatic.com/dictionary/static/sounds/20200429/banana--_gb_1.mp3"
			}
		],
		"origin": "late 16th century: via Portuguese or Spanish from Mande.",
		"meaning": {
			"noun": [
				{
					"definition": "a long curved fruit which grows in clusters and has soft pulpy flesh and yellow skin when ripe.",
					"example": "a bunch of bananas",
					"synonyms": [],
					"antonyms": []
				},
				{
					"definition": "the tropical and subtropical palmlike plant that bears bananas, having very large leaves but lacking a woody trunk.",
					"synonyms": [],
					"antonyms": []
				}
			],
			"adjective": [
				{
					"definition": "insane or extremely silly.",
					"example": "I've spent two months in a studio—I must be bananas",
					"synonyms": [],
					"antonyms": []
				}
			]
		}
	},
	{
		"word": "orange",
		"phonetic": "ˈɒrɪn(d)ʒ",
		"phonetics": [
			{
				"text": "ˈɒrɪn(d)ʒ",
				"audio": "//ssl.gstatic.com/dictionary/static/sounds/20200429/orange--_gb_1.mp3"
			}
		],
		"origin": "late Middle English: from Old French orenge (in the phrase pomme d'orenge ), based on Arabic nāranj, from Persian nārang .",
		"meaning": {
			"noun": [
				{
					"definition": "a large round juicy citrus fruit with a tough bright reddish-yellow rind.",
					"example": "eat plenty of oranges",
					"synonyms": [],
					"antonyms": []
				},
				{
					"definition": "the leathery-leaved evergreen tree that bears the orange, native to warm regions of South and SE Asia. Oranges are a major commercial crop in many warm regions of the world.",
					"synonyms": [],
					"antonyms": []
				},
				{
					"definition": "a bright reddish-yellow colour like that of the skin of a ripe orange.",
					"example": "tones of golden brown and orange",
					"synonyms": [],
					"antonyms": []
				},
				{
					"definition": "a butterfly with mainly or partly orange wings.",
					"synonyms": [],
					"antonyms": []
				}
			],
			"adjective": [
				{
					"definition": "reddish yellow.",
					"example": "there was an orange glow in the sky",
					"synonyms": [],
					"antonyms": []
				}
			]
		}
	}
]

Regarding V1 Version

The API earlier use to send response as shown below, but this structure of response was found out to be difficult to work with (you can take a look at these tickets #32 and #4), based on feedback in these tickets I have updated the API to v2 version. That said, v1 version will always be supported for backward compatibility.

[
    {
        "word": "hello",
        "phonetics": [
            {
                "text": "/həˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3"
            },
            {
                "text": "/hɛˈloʊ/",
                "audio": "https://lex-audio.useremarkable.com/mp3/hello_us_2_rr.mp3"
            }
        ],
        "meaning": {
            "exclamation": [
                {
                    "definition": "Used as a greeting or to begin a phone conversation.",
                    "example": "hello there, Katie!"
                }
            ],
            "noun": [
                {
                    "definition": "An utterance of “hello”; a greeting.",
                    "example": "she was getting polite nods and hellos from people",
                    "synonyms": [
                        "greeting",
                        "welcome",
                        "salutation",
                        "saluting",
                        "hailing",
                        "address",
                        "hello",
                        "hallo"
                    ]
                }
            ],
            "intransitive verb": [
                {
                    "definition": "Say or shout “hello”; greet someone.",
                    "example": "I pressed the phone button and helloed"
                }
            ]
        }
    }
]

Paths

Location Endpoint
Root path https://api.dictionaryapi.dev/api/<--version-->

HTTP request and query methods

Method Endpoint Description Examples
GET /entries/en/<YOUR_WORD> Retrieves the definition of the given word. /api/v2/entries/en/bliss

Future plans

You can see existing and add new feature proposals on the projects GitHub page. Pull requests are welcome!

If you need any assistance or find any bugs, feel free to contact me directly via email or create a new issue on the GitHub page.

Support Me

This Dictionary API was initially created as an API that could be used by my friend for his project. I did not in my wildest dream thought that this API will become so popular, in few months this API took off and many people started to use it, initially I was able to manage the server costs but as number of requests started increasing, so did the server costs. Currently API has more than 10 million requests per month and to keep it running I need support of the community. I have planned few things in near future that will bring the cost down, but that will take some time.

Kindly help me keep running and developing this API. Thanks a lot for using my API, it feels good when your creation help other create their own projects.

Related Projects

The Dictionary Anywhere extension helps you stay focused on what you are reading by eliminating the need to search for meaning, Double-clicking any word will view its definition in a small pop-up bubble. Now you never have to leave what you are reading to search for the meaning of the words you don't yet know.

Extension is available for Google Chrome and Mozilla Firefox.

Enjoy Reading Uninterrupted!!!

freedictionaryapi's People

Contributors

manishsaraan avatar martin-martin avatar meetdeveloper avatar mukarillo avatar tomslloyd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.