getToken
Create a new or refresh an expired Bearer Token.
This token allows you to execute operations on the NPGW Gateway APIs with authority, and whilst a single token will expire after 15 minutes, you can generate one at any time.
/token
Usage and SDK Samples
curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: text/plain" \
"https://npgw.xyz/merchant-v1/token" \
-d 'Custom MIME type example not yet supported: text/plain'
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.AuthenticationApi;
import java.io.File;
import java.util.*;
public class AuthenticationApiExample {
public static void main(String[] args) {
// Create an instance of the API class
AuthenticationApi apiInstance = new AuthenticationApi();
String body = body_example; // String |
try {
ResponseToken result = apiInstance.getToken(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#getToken");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String body = new String(); // String |
try {
final result = await api_instance.getToken(body);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->getToken: $e\n');
}
import org.openapitools.client.api.AuthenticationApi;
public class AuthenticationApiExample {
public static void main(String[] args) {
AuthenticationApi apiInstance = new AuthenticationApi();
String body = body_example; // String |
try {
ResponseToken result = apiInstance.getToken(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#getToken");
e.printStackTrace();
}
}
}
// Create an instance of the API class
AuthenticationApi *apiInstance = [[AuthenticationApi alloc] init];
String *body = body_example; //
// Create a new or refresh an expired Bearer Token.
[apiInstance getTokenWith:body
completionHandler: ^(ResponseToken output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var NpgwMerchantApi = require('npgw_merchant_api');
// Create an instance of the API class
var api = new NpgwMerchantApi.AuthenticationApi()
var body = body_example; // {String}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getToken(body, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class getTokenExample
{
public void main()
{
// Create an instance of the API class
var apiInstance = new AuthenticationApi();
var body = body_example; // String |
try {
// Create a new or refresh an expired Bearer Token.
ResponseToken result = apiInstance.getToken(body);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AuthenticationApi.getToken: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AuthenticationApi();
$body = body_example; // String |
try {
$result = $api_instance->getToken($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->getToken: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::AuthenticationApi;
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::AuthenticationApi->new();
my $body = WWW::OPenAPIClient::Object::String->new(); # String |
eval {
my $result = $api_instance->getToken(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AuthenticationApi->getToken: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = openapi_client.AuthenticationApi()
body = body_example # String |
try:
# Create a new or refresh an expired Bearer Token.
api_response = api_instance.get_token(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthenticationApi->getToken: %s\n" % e)
extern crate AuthenticationApi;
pub fn main() {
let body = body_example; // String
let mut context = AuthenticationApi::Context::default();
let result = client.getToken(body, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
Name | Description |
---|---|
body * |
Secret token. |