🧑🤝🧑Create User
Create a new user in the DrugNet system.
Make your first request
To make your first request, send an authenticated request to the drugnet endpoint. This will create a user, which is nice.
Create user.
POST /create_user
This endpoint allows you to create a new user in the DrugNet System.
Request Body
Name
Type
Description
name*
string
The name of the user
email*
string
The email of the user
phone*
string
The phone of the user
country
string
Source country
{
"status": "success",
"message": "User created successfully",
"user": {
"id": 123,
"name": "John Doe",
"phone": "+233 xx xxx xxxx",
"email": "[email protected]"
}
}
{ "status": "error", "message": "Invalid API key" }
Take a look at how you might call this method using our official libraries, or via curl:
curl --location '/create_user' \
--header 'x-api-key: YOUR API KEY' \
--form 'name="YOUR NAME"' \
--form 'phone="YOUR PHONE"' \
--form 'email="YOUR EMAIL"' var request = require('request');
var options = {
'method': 'POST',
'url': '/create_user',
'headers': {
'x-api-key': 'YOUR API KEY'
},
formData: {
'name': 'YOUR NAME',
'phone': 'YOUR PHONE',
'email': 'YOUR EMAIL'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('/create_user');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->addForm(array(
'name' => 'your name',
'phone' => 'your phone',
'email' => 'your email'
), array(
));
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'x-api-key' => 'your api key'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Example
{
"code": 200,
"success": true,
"message": "User created sucessfully"
}Last updated