postEvent
Odošle udalosť z NFC čítačky
Tento endpoint používa HW zariadenie na čítanie NFC kariet. Obsahom musí byť TAG, ktorý chce zaevidovať do systéme nfcDance. NFC Čítačka sa auutorizuje svojím unikátnym ID, a to v hlavičke požiadavky (kľúč X-API-READER)
/event
Usage and SDK Samples
curl -X POST\
-H "X-API-READER: [[apiKey]]"\
-H "Authorization: Bearer [[accessToken]]"\
-H "Accept: application/json"\
-H "Content-Type: application/json"\
"http://localhost:9090/nfcdance/www/api/event"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ReaderApi;
import java.io.File;
import java.util.*;
public class ReaderApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
ReaderApi apiInstance = new ReaderApi();
TagRequest body = ; // TagRequest | Obsah NFC karty - identifikátor
try {
Event result = apiInstance.postEvent(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReaderApi#postEvent");
e.printStackTrace();
}
}
}
import io.swagger.client.api.ReaderApi;
public class ReaderApiExample {
public static void main(String[] args) {
ReaderApi apiInstance = new ReaderApi();
TagRequest body = ; // TagRequest | Obsah NFC karty - identifikátor
try {
Event result = apiInstance.postEvent(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReaderApi#postEvent");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKeyAuth)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-API-READER"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-API-READER"];
TagRequest *body = ; // Obsah NFC karty - identifikátor (optional)
ReaderApi *apiInstance = [[ReaderApi alloc] init];
// Odošle udalosť z NFC čítačky
[apiInstance postEventWith:body
completionHandler: ^(Event output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var NfCdanceRestApi = require('nf_cdance_rest_api');
var defaultClient = NfCdanceRestApi.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['X-API-READER'] = "Token"
var api = new NfCdanceRestApi.ReaderApi()
var opts = {
'body': // {{TagRequest}} Obsah NFC karty - identifikátor
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.postEvent(opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class postEventExample
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("X-API-READER", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("X-API-READER", "Bearer");
var apiInstance = new ReaderApi();
var body = new TagRequest(); // TagRequest | Obsah NFC karty - identifikátor (optional)
try
{
// Odošle udalosť z NFC čítačky
Event result = apiInstance.postEvent(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ReaderApi.postEvent: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-API-READER', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-READER', 'Bearer');
$api_instance = new Swagger\Client\ApiReaderApi();
$body = ; // TagRequest | Obsah NFC karty - identifikátor
try {
$result = $api_instance->postEvent($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ReaderApi->postEvent: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ReaderApi;
# Configure API key authorization: ApiKeyAuth
$WWW::SwaggerClient::Configuration::api_key->{'X-API-READER'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'X-API-READER'} = "Bearer";
my $api_instance = WWW::SwaggerClient::ReaderApi->new();
my $body = WWW::SwaggerClient::Object::TagRequest->new(); # TagRequest | Obsah NFC karty - identifikátor
eval {
my $result = $api_instance->postEvent(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling ReaderApi->postEvent: $@\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: ApiKeyAuth
swagger_client.configuration.api_key['X-API-READER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['X-API-READER'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.ReaderApi()
body = # TagRequest | Obsah NFC karty - identifikátor (optional)
try:
# Odošle udalosť z NFC čítačky
api_response = api_instance.post_event(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling ReaderApi->postEvent: %s\n" % e)
Parameters
Name | Description |
---|---|
body |