Login
curl --request POST \
--url https://api.discountdrugnetwork.com/gateway/auth/login \
--header 'x-ddn-client-key: <api-key>'import requests
url = "https://api.discountdrugnetwork.com/gateway/auth/login"
headers = {"x-ddn-client-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-ddn-client-key': '<api-key>'}};
fetch('https://api.discountdrugnetwork.com/gateway/auth/login', 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://api.discountdrugnetwork.com/gateway/auth/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-ddn-client-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.discountdrugnetwork.com/gateway/auth/login"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-ddn-client-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.discountdrugnetwork.com/gateway/auth/login")
.header("x-ddn-client-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.discountdrugnetwork.com/gateway/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ddn-client-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "8joiu...",
"expiresIn": 3600,
"tokenType": "Bearer"
}Authentication
Login
Use the following endpoint to obtain an access token required for authenticating subsequent API requests to the DDN API.
POST
/
gateway
/
auth
/
login
Login
curl --request POST \
--url https://api.discountdrugnetwork.com/gateway/auth/login \
--header 'x-ddn-client-key: <api-key>'import requests
url = "https://api.discountdrugnetwork.com/gateway/auth/login"
headers = {"x-ddn-client-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-ddn-client-key': '<api-key>'}};
fetch('https://api.discountdrugnetwork.com/gateway/auth/login', 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://api.discountdrugnetwork.com/gateway/auth/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-ddn-client-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.discountdrugnetwork.com/gateway/auth/login"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-ddn-client-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.discountdrugnetwork.com/gateway/auth/login")
.header("x-ddn-client-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.discountdrugnetwork.com/gateway/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ddn-client-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "8joiu...",
"expiresIn": 3600,
"tokenType": "Bearer"
}Endpoint
POST https://api.discountdrugnetwork.com/gateway/auth/login?groupId=GROUPID
Input Parameters
string
required
Your group ID number.Example:
12345Response Fields
string
required
The JWT Authentication token to use in the Authorization Bearer header for future requests.Example:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...string
required
The token to refresh the authentication session.Example:
8joiu...int
required
Number of seconds before the token expires.Example:
3600string
required
Identifies the type of token. Typically, this will be “Bearer”.Example:
BearerAuthorizations
Query Parameters
Your group ID number. Example: 12345
Response
Successful login
The JWT Authentication token to use in the Authorization Bearer header for future requests.
Example:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
The token to refresh the authentication session.
Example:
"8joiu..."
Number of seconds before the token expires.
Example:
3600
Identifies the type of token. Typically, this will be 'Bearer'.
Example:
"Bearer"
