 Bosala 3 exemple ya ba demandes HTTP pona kobakisa mosaleli ya sika na base de données.
Soki tokanisi ete serveur esalela API REST na point ya suka `/users` mpo na ko gérer mosaleli na ye, awa na se ezali na 3 exemple ya ba demandes HTTP mpo na kobakisa mosaleli ya sika na base de données: **1. HTTP POST bosengi na kosalelaka cURL:** ```sh curl -X POST \ 'http://www.ndakisa.com/basaleli' \ -H 'Lolenge-ya-makambo: application/json' \ -d '{"nkombo ya mosaleli". :"johndoe","nkombo mobimba":"John Doe","email":"johndoe@ndakisa.com","mot ya nzela":"pass1234"}' ``` **2. Bosengi ya HTTP POST na kosalelaka module ya masengi ya Python:** ```masengi ya bokɔtisi ya python url = 'http://www.example.com/users' headers = {'Content-Type': 'application/json'} charge utile = { ' kombo ya mosaleli': 'johndoe', 'nkombo mobimba': 'John Doe', 'email': 'johndoe@example.com', 'mot ya nzela': 'pass1234' } eyano = requests.post(url, mitó=mitó, ba données= json.dumps(charge utile)) ``` **3. Bosengi ya HTTP POST na kosalelaka API ya kozwa JavaScript:** ```javascript const url = 'http://www.example.com/basaleli'; const headers = {'Lolenge-ya-Makambo': 'application/json'}; const payload = { 'nkombo ya mosaleli': 'johndoe', 'kombo mobimba': 'John Doe', 'email': 'johndoe@ndakisa.com', 'mot ya nzela': 'pass1234' }; fetch (url, { méthode: 'POST', mitó: mitó, nzoto: JSON.stringify (charge utile) }) .then (réponse => réponse.json ()) .then (données => console.log (données)) ; ``` Na ba demandes nionso oyo tolobeli likolo, mosaleli oyo azali na ba détails respectifs (kombo ya mosaleli, kombo mobimba, email, mpe mot de passe) azali kobakisa na esika ya suka ya basaleli na kosalelaka méthode HTTP POST.