Xác thực OTP
curl --request POST \
--url https://openapi-uat.dnse.com.vn/registration/trading-token \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>' \
--data '
{
"otpType": "email_otp",
"passcode": "569542"
}
'import requests
url = "https://openapi-uat.dnse.com.vn/registration/trading-token"
payload = {
"otpType": "email_otp",
"passcode": "569542"
}
headers = {
"X-API-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>',
'Content-Type': 'application/json'
},
body: JSON.stringify({otpType: 'email_otp', passcode: '569542'})
};
fetch('https://openapi-uat.dnse.com.vn/registration/trading-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openapi-uat.dnse.com.vn/registration/trading-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'otpType' => 'email_otp',
'passcode' => '569542'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>",
"X-Aux-Date: <x-aux-date>",
"X-Signature: <x-signature>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi-uat.dnse.com.vn/registration/trading-token"
payload := strings.NewReader("{\n \"otpType\": \"email_otp\",\n \"passcode\": \"569542\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Aux-Date", "<x-aux-date>")
req.Header.Add("X-Signature", "<x-signature>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi-uat.dnse.com.vn/registration/trading-token")
.header("X-API-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.header("Content-Type", "application/json")
.body("{\n \"otpType\": \"email_otp\",\n \"passcode\": \"569542\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi-uat.dnse.com.vn/registration/trading-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["X-Aux-Date"] = '<x-aux-date>'
request["X-Signature"] = '<x-signature>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"otpType\": \"email_otp\",\n \"passcode\": \"569542\"\n}"
response = http.request(request)
puts response.read_body{
"tradingToken": "9ab81e9c-8a81-45aa-8190-b69a1c179d52"
}{
"status": 400,
"code": "OA-100",
"message": "Invalid input: otpType is not registered for this account"
}{
"code": "OA-009",
"message": "Lỗi hệ thống",
"status": 500
}trading
Xác thực OTP
Xác thực mã OTP theo phương thức xác thực (Email OTP hoặc Smart OTP) đã đăng ký để lấy Trading Token. Đây là thông tin bắt buộc để xác thực quyền giao dịch, có hiệu lực trong 8 tiếng.
POST
/
registration
/
trading-token
Xác thực OTP
curl --request POST \
--url https://openapi-uat.dnse.com.vn/registration/trading-token \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>' \
--data '
{
"otpType": "email_otp",
"passcode": "569542"
}
'import requests
url = "https://openapi-uat.dnse.com.vn/registration/trading-token"
payload = {
"otpType": "email_otp",
"passcode": "569542"
}
headers = {
"X-API-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>',
'Content-Type': 'application/json'
},
body: JSON.stringify({otpType: 'email_otp', passcode: '569542'})
};
fetch('https://openapi-uat.dnse.com.vn/registration/trading-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openapi-uat.dnse.com.vn/registration/trading-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'otpType' => 'email_otp',
'passcode' => '569542'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>",
"X-Aux-Date: <x-aux-date>",
"X-Signature: <x-signature>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi-uat.dnse.com.vn/registration/trading-token"
payload := strings.NewReader("{\n \"otpType\": \"email_otp\",\n \"passcode\": \"569542\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Aux-Date", "<x-aux-date>")
req.Header.Add("X-Signature", "<x-signature>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi-uat.dnse.com.vn/registration/trading-token")
.header("X-API-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.header("Content-Type", "application/json")
.body("{\n \"otpType\": \"email_otp\",\n \"passcode\": \"569542\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi-uat.dnse.com.vn/registration/trading-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["X-Aux-Date"] = '<x-aux-date>'
request["X-Signature"] = '<x-signature>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"otpType\": \"email_otp\",\n \"passcode\": \"569542\"\n}"
response = http.request(request)
puts response.read_body{
"tradingToken": "9ab81e9c-8a81-45aa-8190-b69a1c179d52"
}{
"status": 400,
"code": "OA-100",
"message": "Invalid input: otpType is not registered for this account"
}{
"code": "OA-009",
"message": "Lỗi hệ thống",
"status": 500
}Tiêu đề
API Key được cấp khi đăng ký dịch vụ
Thời gian thực hiện yêu cầu
Chữ ký xác thực yêu cầu
API version (YYYY-MM-DD)
Nội dung
application/json
Phản hồi
OK
Token đặt lệnh
Ví dụ:
"9ab81e9c-8a81-45aa-8190-b69a1c179d52"