OTP

SendOTP

otpPost

The resource allows to send (via SMS) a one-time password to the end user, known his mobile phone number.

The one-time password is made up of eight digits. Accepts xml only


/otp

Usage and SDK Samples

curl -X POST -H "apikey: [[apiKey]]" "https://hackathon.tim.it/otp"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.SendOTPApi;

import java.io.File;
import java.util.*;

public class SendOTPApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: ApiKey
        ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
        ApiKey.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //ApiKey.setApiKeyPrefix("Token");

        SendOTPApi apiInstance = new SendOTPApi();
        Otp body = "\n  
tel:+393351111111
\n
\n"; // Otp | try { apiInstance.otpPost(body); } catch (ApiException e) { System.err.println("Exception when calling SendOTPApi#otpPost"); e.printStackTrace(); } } }
import io.swagger.client.api.SendOTPApi;

public class SendOTPApiExample {

    public static void main(String[] args) {
        SendOTPApi apiInstance = new SendOTPApi();
        Otp body = "\n  
tel:+393351111111
\n
\n"; // Otp | try { apiInstance.otpPost(body); } catch (ApiException e) { System.err.println("Exception when calling SendOTPApi#otpPost"); e.printStackTrace(); } } }
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"apikey"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"apikey"];
Otp *body = "\n  
tel:+393351111111
\n
\n"; // SendOTPApi *apiInstance = [[SendOTPApi alloc] init]; // The resource allows to send (via SMS) a one-time password to the end user, known his mobile phone number. [apiInstance otpPostWith:body completionHandler: ^(NSError* error) { if (error) { NSLog(@"Error: %@", error); } }];
var Otp = require('otp');
var defaultClient = Otp.ApiClient.instance;

// Configure API key authorization: ApiKey
var ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix['apikey'] = "Token"

var api = new Otp.SendOTPApi()
var body = "\n  
tel:+393351111111
\n
\n"; // {{Otp}} var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully.'); } }; api.otpPost(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class otpPostExample
    {
        public void main()
        {

            // Configure API key authorization: ApiKey
            Configuration.Default.ApiKey.Add("apikey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("apikey", "Bearer");

            var apiInstance = new SendOTPApi();
            var body = new Otp(); // Otp | 

            try
            {
                // The resource allows to send (via SMS) a one-time password to the end user, known his mobile phone number.
                apiInstance.otpPost(body);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling SendOTPApi.otpPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: ApiKey
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('apikey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apikey', 'Bearer');

$api_instance = new Swagger\Client\ApiSendOTPApi();
$body = "\n  
tel:+393351111111
\n
\n"; // Otp | try { $api_instance->otpPost($body); } catch (Exception $e) { echo 'Exception when calling SendOTPApi->otpPost: ', $e->getMessage(), PHP_EOL; } ?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::SendOTPApi;

# Configure API key authorization: ApiKey
$WWW::SwaggerClient::Configuration::api_key->{'apikey'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'apikey'} = "Bearer";

my $api_instance = WWW::SwaggerClient::SendOTPApi->new();
my $body = WWW::SwaggerClient::Object::Otp->new(); # Otp | 

eval { 
    $api_instance->otpPost(body => $body);
};
if ($@) {
    warn "Exception when calling SendOTPApi->otpPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: ApiKey
swagger_client.configuration.api_key['apikey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['apikey'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.SendOTPApi()
body = "\n  
tel:+393351111111
\n
\n" # Otp | try: # The resource allows to send (via SMS) a one-time password to the end user, known his mobile phone number. api_instance.otp_post(body) except ApiException as e: print("Exception when calling SendOTPApi->otpPost: %s\n" % e)

Parameters

Body parameters
Name Description
body *

Responses

Status: 200 -
statusmessage
Esito OK

Status: 400 -
statusmessageNote
01Message Format error
01Missing username
13Missing mandatory input parameters
02Too fast request for same address
03Invalid address format
Invalid text format

Status: 404 -
statusmessage
01Not valid URI

Status: 500 -
statusmessageNote
010-nnErrore internoThe number code 'nn' identifies the internal specific error (e.g. '010-34', etc.).

Status: 502 -
statusmessage
01Bad Gateway


VerifyOTP

otpAddressGet

The resource allows to check the validity of a One Time Password.


/otp/{address}

Usage and SDK Samples

curl -X GET -H "apikey: [[apiKey]]" "https://hackathon.tim.it/otp/{address}?password="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.VerifyOTPApi;

import java.io.File;
import java.util.*;

public class VerifyOTPApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: ApiKey
        ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
        ApiKey.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //ApiKey.setApiKeyPrefix("Token");

        VerifyOTPApi apiInstance = new VerifyOTPApi();
        String address = address_example; // String | Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
        String password = password_example; // String | Password received in the text of SMS.
        try {
            apiInstance.otpAddressGet(address, password);
        } catch (ApiException e) {
            System.err.println("Exception when calling VerifyOTPApi#otpAddressGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.VerifyOTPApi;

public class VerifyOTPApiExample {

    public static void main(String[] args) {
        VerifyOTPApi apiInstance = new VerifyOTPApi();
        String address = address_example; // String | Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
        String password = password_example; // String | Password received in the text of SMS.
        try {
            apiInstance.otpAddressGet(address, password);
        } catch (ApiException e) {
            System.err.println("Exception when calling VerifyOTPApi#otpAddressGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"apikey"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"apikey"];
String *address = address_example; // Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
String *password = password_example; // Password received in the text of SMS.

VerifyOTPApi *apiInstance = [[VerifyOTPApi alloc] init];

// The resource allows to check the validity of a One Time Password.
[apiInstance otpAddressGetWith:address
    password:password
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var Otp = require('otp');
var defaultClient = Otp.ApiClient.instance;

// Configure API key authorization: ApiKey
var ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix['apikey'] = "Token"

var api = new Otp.VerifyOTPApi()
var address = address_example; // {{String}} Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
var password = password_example; // {{String}} Password received in the text of SMS.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.otpAddressGet(address, password, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class otpAddressGetExample
    {
        public void main()
        {

            // Configure API key authorization: ApiKey
            Configuration.Default.ApiKey.Add("apikey", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("apikey", "Bearer");

            var apiInstance = new VerifyOTPApi();
            var address = address_example;  // String | Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
            var password = password_example;  // String | Password received in the text of SMS.

            try
            {
                // The resource allows to check the validity of a One Time Password.
                apiInstance.otpAddressGet(address, password);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling VerifyOTPApi.otpAddressGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: ApiKey
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('apikey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apikey', 'Bearer');

$api_instance = new Swagger\Client\ApiVerifyOTPApi();
$address = address_example; // String | Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
$password = password_example; // String | Password received in the text of SMS.

try {
    $api_instance->otpAddressGet($address, $password);
} catch (Exception $e) {
    echo 'Exception when calling VerifyOTPApi->otpAddressGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::VerifyOTPApi;

# Configure API key authorization: ApiKey
$WWW::SwaggerClient::Configuration::api_key->{'apikey'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'apikey'} = "Bearer";

my $api_instance = WWW::SwaggerClient::VerifyOTPApi->new();
my $address = address_example; # String | Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
my $password = password_example; # String | Password received in the text of SMS.

eval { 
    $api_instance->otpAddressGet(address => $address, password => $password);
};
if ($@) {
    warn "Exception when calling VerifyOTPApi->otpAddressGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: ApiKey
swagger_client.configuration.api_key['apikey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['apikey'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.VerifyOTPApi()
address = address_example # String | Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
password = password_example # String | Password received in the text of SMS.

try: 
    # The resource allows to check the validity of a One Time Password.
    api_instance.otp_address_get(address, password)
except ApiException as e:
    print("Exception when calling VerifyOTPApi->otpAddressGet: %s\n" % e)

Parameters

Path parameters
Name Description
address*
String
Telephone number as tel URI in international format (global-number) with 9-16 digits and no parameters (es. tel:+393351111111).
Required
Query parameters
Name Description
password*
String
Password received in the text of SMS.
Required

Responses

Status: 200 -

Status: 400 -
statusmessageNote
01Errore nel formato del messaggio
04Raggiunto il massimo numero di tentativi di verifica ammessi. E&rsquo; necessario richiedere una nuova passwordThe maximum number of verification attempts is 10.
05Password errata.
07La password inserita e&rsquo; scaduta. E&rsquo; necessario richiederla nuovamenteThe time of validity of the password (OTP) is three minutes.
08OTP gia' verificata con successo o con esito pwd scaduta o uid non esistente

Status: 404 -
statusmessage
01Not valid URI

Status: 500 -
statusmessageNote
010-nnErrore internoThe number code 'nn' identifies the internal specific error (e.g.'010-34', etc.).

Status: 502 -
statusmessage
01Bad Gateway