getToken
Create and get authorization token.
Create an authorization token, with an expiration date and time, and then return it to be used in the rest of the endpoints. For this use the URL https://miAmbiente.deyel.com/oauth
/token
Usage and SDK Samples
curl -X POST\
-H "Authorization: Basic [[basicHash]]"\
-H "Accept: application/json"\
-H "Content-Type: application/x-www-form-urlencoded"\
"https://miAmbiente.deyel.com/v1.0/token"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AuthorizationApi;
import java.io.File;
import java.util.*;
public class AuthorizationApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
AuthorizationApi apiInstance = new AuthorizationApi();
String grantType = grantType_example; // String |
try {
Token200 result = apiInstance.getToken(grantType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthorizationApi#getToken");
e.printStackTrace();
}
}
}
import io.swagger.client.api.AuthorizationApi;
public class AuthorizationApiExample {
public static void main(String[] args) {
AuthorizationApi apiInstance = new AuthorizationApi();
String grantType = grantType_example; // String |
try {
Token200 result = apiInstance.getToken(grantType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthorizationApi#getToken");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure HTTP basic authorization (authentication scheme: basicAuth)
[apiConfig setUsername:@"YOUR_USERNAME"];
[apiConfig setPassword:@"YOUR_PASSWORD"];
String *grantType = grantType_example; //
AuthorizationApi *apiInstance = [[AuthorizationApi alloc] init];
// Create and get authorization token.
[apiInstance getTokenWith:grantType
completionHandler: ^(Token200 output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var DeyelApiRest = require('deyel_api_rest');
var defaultClient = DeyelApiRest.ApiClient.instance;
// Configure HTTP basic authorization: basicAuth
var basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR USERNAME'
basicAuth.password = 'YOUR PASSWORD'
var api = new DeyelApiRest.AuthorizationApi()
var grantType = grantType_example; // {{String}}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getToken(grantType, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class getTokenExample
{
public void main()
{
// Configure HTTP basic authorization: basicAuth
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";
var apiInstance = new AuthorizationApi();
var grantType = grantType_example; // String |
try
{
// Create and get authorization token.
Token200 result = apiInstance.getToken(grantType);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AuthorizationApi.getToken: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: basicAuth
Swagger\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
$api_instance = new Swagger\Client\ApiAuthorizationApi();
$grantType = grantType_example; // String |
try {
$result = $api_instance->getToken($grantType);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthorizationApi->getToken: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AuthorizationApi;
# Configure HTTP basic authorization: basicAuth
$WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME';
$WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD';
my $api_instance = WWW::SwaggerClient::AuthorizationApi->new();
my $grantType = grantType_example; # String |
eval {
my $result = $api_instance->getToken(grantType => $grantType);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AuthorizationApi->getToken: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basicAuth
swagger_client.configuration.username = 'YOUR_USERNAME'
swagger_client.configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = swagger_client.AuthorizationApi()
grantType = grantType_example # String |
try:
# Create and get authorization token.
api_response = api_instance.get_token(grantType)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthorizationApi->getToken: %s\n" % e)
Parameters
Name | Description |
---|---|
grant_type* |
String
Required
|