HTTP status codes indicate the status of a web server's response to an HTTP request. They work behind the scenes while a web page loads or when an API request is made. Here are some common HTTP status codes and what they mean:
1. 2xx Series (Success):
- 200 OK: The request succeeded.
- 201 Created: The request succeeded and a new resource was created.
- 204 No Content: The request succeeded, but there is no content to send back.
2. 3xx Series (Redirection):
- 301 Moved Permanently: The requested resource has been permanently moved to a new URL.
- 302 Found: This is a temporary redirect code; the resource is temporarily located at a different URL.
3. 4xx Series (Client Errors):
- 400 Bad Request: The server received a malformed request that it cannot process.
- 401 Unauthorized: Authentication is required and has failed or has not yet been provided.
- 403 Forbidden: The server understood the request but refuses to grant access.
- 404 Not Found: The server could not find the requested resource.
4. 5xx Series (Server Errors):
- 500 Internal Server Error: The server encountered an unexpected condition and could not fulfill the request.
- 503 Service Unavailable: The server is unavailable due to temporary overload or maintenance.
These codes are essential for controlling and debugging client-server communication in web applications and APIs built with languages and frameworks such as PHP, Python or Vue.js. For example, if you get a 404 in response to an API request, you know the requested resource doesn't exist, which tells you something in your code needs fixing.
I prepared English and Turkish arrays of these codes because I needed them for an API I built with PHP. Feel free to use them too.
<?php
declare(strict_types=1);
return [
'0' => 'Unknown Error',
'100' => 'Continue',
'101' => 'Switching Protocols',
'102' => 'Processing',
'200' => 'OK',
'201' => 'Created',
'202' => 'Accepted',
'203' => 'Non-Authoritative Information',
'204' => 'No Content',
'205' => 'Reset Content',
'206' => 'Partial Content',
'207' => 'Multi-Status',
'208' => 'Already Reported',
'226' => 'IM Used',
'300' => 'Multiple Choices',
'301' => 'Moved Permanently',
'302' => 'Found',
'303' => 'See Other',
'304' => 'Not Modified',
'305' => 'Use Proxy',
'307' => 'Temporary Redirect',
'308' => 'Permanent Redirect',
'400' => 'Bad Request',
'401' => 'Unauthorized',
'402' => 'Payment Required',
'403' => 'Forbidden',
'404' => 'Not Found',
'405' => 'Method Not Allowed',
'406' => 'Not Acceptable',
'407' => 'Proxy Authentication Required',
'408' => 'Request Timeout',
'409' => 'Conflict',
'410' => 'Gone',
'411' => 'Length Required',
'412' => 'Precondition Failed',
'413' => 'Payload Too Large',
'414' => 'URI Too Long',
'415' => 'Unsupported Media Type',
'416' => 'Range Not Satisfiable',
'417' => 'Expectation Failed',
'418' => 'I\'m a teapot',
'419' => 'Session Has Expired',
'421' => 'Misdirected Request',
'422' => 'Unprocessable Entity',
'423' => 'Locked',
'424' => 'Failed Dependency',
'425' => 'Too Early',
'426' => 'Upgrade Required',
'428' => 'Precondition Required',
'429' => 'Too Many Requests',
'431' => 'Request Header Fields Too Large',
'444' => 'Connection Closed Without Response',
'449' => 'Retry With',
'451' => 'Unavailable For Legal Reasons',
'499' => 'Client Closed Request',
'500' => 'Internal Server Error',
'501' => 'Not Implemented',
'502' => 'Bad Gateway',
'503' => 'Maintenance Mode',
'504' => 'Gateway Timeout',
'505' => 'HTTP Version Not Supported',
'506' => 'Variant Also Negotiates',
'507' => 'Insufficient Storage',
'508' => 'Loop Detected',
'509' => 'Bandwidth Limit Exceeded',
'510' => 'Not Extended',
'511' => 'Network Authentication Required',
'520' => 'Unknown Error',
'521' => 'Web Server is Down',
'522' => 'Connection Timed Out',
'523' => 'Origin Is Unreachable',
'524' => 'A Timeout Occurred',
'525' => 'SSL Handshake Failed',
'526' => 'Invalid SSL Certificate',
'527' => 'Railgun Error',
'598' => 'Network Read Timeout Error',
'599' => 'Network Connect Timeout Error',
'unknownError' => 'Unknown Error',
];
<?php
declare(strict_types=1);
return [
'0' => 'Bilinmeyen Hata',
'100' => 'Devam Et',
'101' => 'Protokoller Değiştiriliyor',
'102' => 'İşleniyor',
'200' => 'Tamam',
'201' => 'Oluşturuldu',
'202' => 'Kabul Edilmiş',
'203' => 'Yetkili Olmayan Bilgiler',
'204' => 'İçerik Yok',
'205' => 'İçeriği Sıfırla',
'206' => 'Kısmi İçerik',
'207' => 'Çoklu Durum',
'208' => 'Zaten Bildirildi',
'226' => 'IM Kullanıldı',
'300' => 'Çoklu Seçimler',
'301' => 'Kalıcı Olarak Taşındı',
'302' => 'Bulundu',
'303' => 'Diğerlerini Gör',
'304' => 'Değiştirilmedi',
'305' => 'Proxy Kullan',
'307' => 'Geçici Yönlendirme',
'308' => 'Kalıcı Yönlendirme',
'400' => 'Geçersiz istek',
'401' => 'Yetkisiz',
'402' => 'Ödeme gerekli',
'403' => 'Yasaklı',
'404' => 'Sayfa bulunamadı',
'405' => 'İzin Verilmeyen Yöntem',
'406' => 'Kabul Edilemez',
'407' => 'Proxy Kimlik Doğrulaması Gerekli',
'408' => 'İstek zaman aşımına uğradı',
'409' => 'Çakışma',
'410' => 'Gitmiş',
'411' => 'Uzunluk Gerekli',
'412' => 'Ön Koşul Başarısız',
'413' => 'Veri Çok Büyük',
'414' => 'URI Çok Uzun',
'415' => 'Desteklenmeyen Medya Türü',
'416' => 'Aralık Yetersiz',
'417' => 'Beklenti Başarısız',
'418' => 'Ben bir demliğim',
'419' => 'Oturum süresi doldu',
'421' => 'Yanlış Yönlendirilmiş İstek',
'422' => 'İşlenemeyen Varlık',
'423' => 'Kilitli',
'424' => 'Başarısız Bağımlılık',
'425' => 'Çok erken',
'426' => 'Yükseltme Gerekli',
'428' => 'Ön Koşul Gerekli',
'429' => 'Çok Fazla İstek',
'431' => 'İstek Başlık Alanları Çok Büyük',
'444' => 'Bağlantı Yanıtsız Kapatıldı',
'449' => 'İle Yeniden Dene',
'451' => 'Yasal Sebepler Nedeniyle Kullanılamıyor',
'499' => 'İstemci Kapandı İsteği',
'500' => 'İç Sunucu Hatası',
'501' => 'Uygulanmadı',
'502' => 'Geçersiz Ağ Geçidi',
'503' => 'Bakım Modu',
'504' => 'Ağ Geçidi Zaman Aşımı',
'505' => 'HTTP Sürümü Desteklenmiyor',
'506' => 'Varyant Ayrıca Müzakere Ediyor',
'507' => 'Yetersiz depolama',
'508' => 'Döngü Tespit Edildi',
'509' => 'Bant Genişliği Sınırı Aşıldı',
'510' => 'Genişletilmemiş',
'511' => 'Ağ Kimlik Doğrulaması Gerekli',
'520' => 'Bilinmeyen Hata',
'521' => 'Web Sunucusu Çalışmıyor',
'522' => 'Bağlantı Zaman Aşımına Uğradı',
'523' => 'Kökeni Ulaşılamaz',
'524' => 'Bir Zaman Aşımı Oluştu',
'525' => 'SSL El Sıkışma Başarısız',
'526' => 'Geçersiz SSL Sertifikası',
'527' => 'Railgun Hatası',
'598' => 'Ağ Okuma Zaman Aşımı Hatası',
'599' => 'Ağ Bağlantısı Zaman Aşımı Hatası',
'unknownError' => 'Bilinmeyen Hata',
];