getAccessToken
Get an access token from Amazon with which to make SP-API calls.
/api/az/access-token
Usage and SDK Samples
curl -X GET \
-H "Authorization: Basic [[basicHash]]" \
-H "Accept: application/json" \
"https://unity.scanpower.com/api/az/access-token?marketplace=US"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.AuthApi;
import java.io.File;
import java.util.*;
public class AuthApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basic_auth
HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth");
basic_auth.setUsername("YOUR USERNAME");
basic_auth.setPassword("YOUR PASSWORD");
// Create an instance of the API class
AuthApi apiInstance = new AuthApi();
String marketplace = US; // String | The marketplace to perform operations in.
try {
getAccessToken_200_response result = apiInstance.getAccessToken(marketplace);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthApi#getAccessToken");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String marketplace = new String(); // String | The marketplace to perform operations in.
try {
final result = await api_instance.getAccessToken(marketplace);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->getAccessToken: $e\n');
}
import org.openapitools.client.api.AuthApi;
public class AuthApiExample {
public static void main(String[] args) {
AuthApi apiInstance = new AuthApi();
String marketplace = US; // String | The marketplace to perform operations in.
try {
getAccessToken_200_response result = apiInstance.getAccessToken(marketplace);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthApi#getAccessToken");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure HTTP basic authorization (authentication scheme: basic_auth)
[apiConfig setUsername:@"YOUR_USERNAME"];
[apiConfig setPassword:@"YOUR_PASSWORD"];
// Create an instance of the API class
AuthApi *apiInstance = [[AuthApi alloc] init];
String *marketplace = US; // The marketplace to perform operations in. (optional) (default to null)
[apiInstance getAccessTokenWith:marketplace
completionHandler: ^(getAccessToken_200_response output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var ScanPowerApi = require('scan_power_api');
var defaultClient = ScanPowerApi.ApiClient.instance;
// Configure HTTP basic authorization: basic_auth
var basic_auth = defaultClient.authentications['basic_auth'];
basic_auth.username = 'YOUR USERNAME';
basic_auth.password = 'YOUR PASSWORD';
// Create an instance of the API class
var api = new ScanPowerApi.AuthApi()
var opts = {
'marketplace': US // {String} The marketplace to perform operations in.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getAccessToken(opts, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class getAccessTokenExample
{
public void main()
{
// Configure HTTP basic authorization: basic_auth
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";
// Create an instance of the API class
var apiInstance = new AuthApi();
var marketplace = US; // String | The marketplace to perform operations in. (optional) (default to null)
try {
getAccessToken_200_response result = apiInstance.getAccessToken(marketplace);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AuthApi.getAccessToken: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: basic_auth
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AuthApi();
$marketplace = US; // String | The marketplace to perform operations in.
try {
$result = $api_instance->getAccessToken($marketplace);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthApi->getAccessToken: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::AuthApi;
# Configure HTTP basic authorization: basic_auth
$WWW::OPenAPIClient::Configuration::username = 'YOUR_USERNAME';
$WWW::OPenAPIClient::Configuration::password = 'YOUR_PASSWORD';
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::AuthApi->new();
my $marketplace = US; # String | The marketplace to perform operations in.
eval {
my $result = $api_instance->getAccessToken(marketplace => $marketplace);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AuthApi->getAccessToken: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic_auth
openapi_client.configuration.username = 'YOUR_USERNAME'
openapi_client.configuration.password = 'YOUR_PASSWORD'
# Create an instance of the API class
api_instance = openapi_client.AuthApi()
marketplace = US # String | The marketplace to perform operations in. (optional) (default to null)
try:
api_response = api_instance.get_access_token(marketplace=marketplace)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthApi->getAccessToken: %s\n" % e)
extern crate AuthApi;
pub fn main() {
let marketplace = US; // String
let mut context = AuthApi::Context::default();
let result = client.getAccessToken(marketplace, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
Name | Description |
---|---|
marketplace |
String
The marketplace to perform operations in.
|