Registration
Last updated
Last updated
create a register form
add an onclick event handler on the submit button, where shall I declare the onClick event function which calls axios or accepts variable in this code
Understanding Axios POST requests
If you click the submit button, you will get a response in your console with a 201
status code telling you the POST
request was successful created.
POST
https://us-central1-appgregator.cloudfunctions.net/api/education/edutama/frontend/academy/user-registration/
x-api-key*
String
wkFBUJNQV;C
{
"status": true,
"message": "Successfully create user",
"data": "680|UEdZhh4nXUzDl9j5BQ7hKwlGWmcNRbVVyWP25g5a"
}
{
"name":"qantor.co.id",
"platform_id":4,
"connection_name":"entrepreneurs.id-02",
"user_name": "imam2",
"email": "sschouse@gmail.com",
"password": "qwerty",
"package": 16,
"referal": "",
"profesi" : "",
"birth_date": "2022-06-06"
}
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/api/education/edutama/frontend/academy/user-registration' \
--header 'x-api-key: wkFBUJNQV;C' \
--header 'Content-Type: application/json' \
--data-raw '{
"name":"qantor.co.id",
"platform_id":4,
"connection_name":"entrepreneurs.id-02",
"user_name": "imam2",
"email": "sschouse@gmail.com",
"password": "qwerty",
"package": 16,
"referal": "",
"profesi" : "",
"birth_date": "2022-06-06"
}'
var axios = require('axios');
var data = JSON.stringify({
"name": "qantor.co.id",
"platform_id": 4,
"connection_name": "entrepreneurs.id-02",
"user_name": "imam2",
"email": "sschouse@gmail.com",
"password": "qwerty",
"package": 16,
"referal": "",
"profesi": "",
"birth_date": "2022-06-06"
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/api/education/edutama/frontend/academy/user-registration',
headers: {
'x-api-key': 'wkFBUJNQV;C',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
var axios = require('axios');
var data = JSON.stringify({
"name": "qantor.co.id",
"platform_id": 4,
"connection_name": "entrepreneurs.id-02",
"user_name": "imam2",
"email": "sschouse@gmail.com",
"password": "qwerty",
"package": 16,
"referal": "",
"profesi": "",
"birth_date": "2022-06-06"
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/api/education/edutama/frontend/academy/user-registration',
headers: {
'x-api-key': 'wkFBUJNQV;C',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});ja
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/api/education/edutama/frontend/academy/user-registration',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name":"qantor.co.id",
"platform_id":4,
"connection_name":"entrepreneurs.id-02",
"user_name": "imam2",
"email": "sschouse@gmail.com",
"password": "qwerty",
"package": 16,
"referal": "",
"profesi" : "",
"birth_date": "2022-06-06"
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: wkFBUJNQV;C',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("us-central1-appgregator.cloudfunctions.net")
payload = json.dumps({
"name": "qantor.co.id",
"platform_id": 4,
"connection_name": "entrepreneurs.id-02",
"user_name": "imam2",
"email": "sschouse@gmail.com",
"password": "qwerty",
"package": 16,
"referal": "",
"profesi": "",
"birth_date": "2022-06-06"
})
headers = {
'x-api-key': 'wkFBUJNQV;C',
'Content-Type': 'application/json'
}
conn.request("POST", "/api/education/edutama/frontend/academy/user-registration", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))