Skip to main content

🔵 Characters API

The Characters API provides access to all characters from the Rick and Morty universe.

📡 Endpoints

Get All Characters

GET https://rickandmortyapi.com/api/character

Query Parameters:

ParameterTypeDescriptionExample
pageintegerPage number?page=2
namestringFilter by name?name=rick
statusstringFilter by status?status=alive
speciesstringFilter by species?species=human
typestringFilter by type?type=ghost
genderstringFilter by gender?gender=male

Example Request:

curl "https://rickandmortyapi.com/api/character?status=alive&species=human"

Get Character by ID

GET https://rickandmortyapi.com/api/character/{id}
ParameterTypeDescription
idintegerCharacter ID (1-826)

Example:

curl https://rickandmortyapi.com/api/character/1

Get Multiple Characters

GET https://rickandmortyapi.com/api/character/[id1,id2,id3]

Example:

curl https://rickandmortyapi.com/api/character/1,2,3

📋 Response Schema

{
"id": 1,
"name": "Rick Sanchez",
"status": "Alive",
"species": "Human",
"type": "",
"gender": "Male",
"origin": {
"name": "Earth (C-137)",
"url": "https://rickandmortyapi.com/api/location/1"
},
"location": {
"name": "Earth (C-137)",
"url": "https://rickandmortyapi.com/api/location/3"
},
"image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg",
"episode": [
"https://rickandmortyapi.com/api/episode/1"
],
"url": "https://rickandmortyapi.com/api/character/1",
"created": "2017-11-04T18:48:46.250Z"
}

✅ Test Cases

Our comprehensive test suite validates:

TestDescription
✅ Status 200Verify successful response
✅ PaginationResponse includes info with next/prev pages
✅ Array validationResults is an array with items
✅ Required fieldsCharacter has all required fields
✅ Name filterFilter by name works correctly
✅ Status filterFilter by status works correctly
✅ PaginationNavigate between pages
✅ Multiple IDsGet multiple characters by IDs

🎯 Test Count

  • Total Tests: 30 assertions
  • Coverage: Full endpoint coverage