-
Notifications
You must be signed in to change notification settings - Fork 8
Data Adapter REST API Reference
PowerAuth 2.0 Web Auth Server communicates with the Data Adapter via a REST API. This chapter defines the REST API implemented by Data Adapter and consumed by the Web Auth Server.
PowerAuth 2.0 compliant Data Adapter uses a unified format for error response body, accompanied with an appropriate HTTP status code. Besides the HTTP error codes that application server may return regardless of server application (such as 404 when resource is not found or 503 when server is down).
All error responses that are produced by the Data Adapter should have following body:
{
"status": "ERROR",
"responseObject": {
"code": "ERROR_CODE",
"message": "ERROR_MESSAGE_I18N_KEY"
}
}Expected error messages are explained in details in individual sections.
Performs an authentication operation with username and password.
| Method | POST |
| Resource URI | /api/auth/user/authenticate |
The list of expected status codes during authentication:
| Code | Description |
|---|---|
| 200 | OK response - user was successfully authenticated |
| 400 | Invalid input - username and/or password has invalid format, unsupported authentication type |
| 401 | Authentication failed - provide reason in the message in case it is available |
| 500 | Server errors - provide error details in the message, this is only for unexpected errors |
- Headers:
Content-Type: application/json
{
"requestObject": {
"username": "userxyz",
"password": "s3cret",
"type": "BASIC"
}
}- The only currently supported authentication method is BASIC, however this field is present for future extensions of the API.
- Status Code:
200 - Headers:
Content-Type: application/json
{
"status": "OK",
"responseObject": {
"userId": "12345678"
}
}The userId value is a system-wide unique identifier identifying the user who was just authenticated.
This message should be sent when the Data Adapter receives a correct message, however the username and password combination is invalid.
- Status Code:
401 - Headers:
Content-Type: application/json
{
"status": "ERROR",
"responseObject": {
"code": "AUTHENTICATION_FAILED",
"message": "login.authenticationFailed",
"validationErrors": null
}
}This error should be returned when username or password format is invalid - either it contains unsupported characters or it is empty or too long. This error is also used when authentication type is not supported.
- Status Code:
400 - Headers:
Content-Type: application/json
{
"status": "ERROR",
"responseObject": {
"code": "INPUT_INVALID",
"message": "login.password.empty",
"validationErrors": ["login.password.empty.authenticationRequest.password", "login.password.empty.password", "login.password.empty.java.lang.String", "login.password.empty"]
}
}For more information, see classes AuthenticationRequestValidator and DefaultExceptionResolver.
This error should be used for all unexpected errors.
- Status Code:
500 - Headers:
Content-Type: application/json
{
"status": "ERROR",
"responseObject": {
"code": "ERROR_GENERIC",
"message": "Exception occurred at ...",
"validationErrors": null
}
}Fetches user details based on user ID.
| Method | POST |
| Resource URI | /api/auth/user/info |
The list of expected status codes:
| Code | Description |
|---|---|
| 200 | OK response - user details have been successfully retrieved |
| 401 | Invalid request - userId is missing or invalid |
| 404 | User not found - user with given userId does not exit |
| 500 | Server errors - provide error details in the message, this is only for unexpected errors |
- Headers:
Content-Type: application/json
{
"requestObject": {
"id": "12345678"
}
}- Status Code:
200 - Headers:
Content-Type: application/json
{
"status": "OK",
"responseObject": {
"id":"12345678",
"givenName":"John",
"familyName":"Doe"
}
}Create SMS OTP messages and verify authorization code.
| Method | POST |
| Resource URI | /api/auth/sms/create |
The list of expected status codes:
| Code | Description |
|---|---|
| 200 | OK response - SMS message has been successfully created |
| 400 | Invalid request - the request failed validation |
| 500 | Server errors - provide error details in the message, this is only for unexpected errors |
- Headers:
Content-Type: application/json
{
"requestObject": {
"operationId": "da3d1314-8852-4a93-bdbd-553177d5f76b",
"userId": "12345678",
"operationName": "authorize_payment",
"operationFormData": {
"title": "Confirm Payment",
"message": "Hello, please confirm payment 100 CZK to account 238400856/0300.",
"parameters": [
{
"type": "AMOUNT",
"label": "Amount",
"amount": 100,
"currency": "CZK"
},
{
"type": "KEY_VALUE",
"label": "To Account",
"value": "238400856/0300"
},
{
"type": "KEY_VALUE",
"label": "Due Date",
"value": "06/29/2017"
},
{
"type": "MESSAGE",
"label": "Note",
"message": "Utility Bill Payment - 05/2017"
},
{
"type": "BANK_ACCOUNT_CHOICE",
"label": "bankAccountChoice",
"bankAccounts": [
{
"number": "12345678/1234",
"name": "Běžný účet v CZK",
"balance": 24394.52,
"currency": "CZK",
"usableForPayment": true,
"unusableForPaymentReason": null
},
{
"number": "87654321/4321",
"name": "Spořící účet v CZK",
"balance": 158121.1,
"currency": "CZK",
"usableForPayment": true,
"unusableForPaymentReason": null
},
{
"number": "44444444/1111",
"name": "Spořící účet v EUR",
"balance": 1.9,
"currency": "EUR",
"usableForPayment": false,
"unusableForPaymentReason": "operationReview.balanceTooLow"
}
],
"chosenBankAccountNumber": "12345678/1234",
"choiceDisabled": true
}
],
"dynamicDataLoaded": true,
"userInput": {
"chosenBankAccountNumber": "12345678/1234",
"chosenAuthMethod": "SMS_KEY"
}
},
"lang": "en"
}
}- Status Code:
200 - Headers:
Content-Type: application/json
{
"status": "OK",
"responseObject": {
"messageId": "b750f8ae-5bca-48aa-ba8b-92c00e99ba29"
}
}| Method | POST |
| Resource URI | /api/auth/sms/verify |
The list of expected status codes:
| Code | Description |
|---|---|
| 200 | OK response - SMS message has been successfully verified |
| 400 | Invalid request - the request failed validation |
| 500 | Server errors - provide error details in the message, this is only for unexpected errors |
- Headers:
Content-Type: application/json
{
"requestObject": {
"messageId": "5f9f5c01-8f0b-40c5-8ecc-40528a10460e",
"authorizationCode": "23339372"
}
}- Status Code:
200 - Headers:
Content-Type: application/json
{
"status": "OK",
"responseObject": null
}Notification of Data Adapter about formData change.
| Method | POST |
| Resource URI | /api/operation/formData/change |
The list of expected status codes:
| Code | Description |
|---|---|
| 200 | OK response - SMS message has been successfully created |
| 500 | Server errors - provide error details in the message, this is only for unexpected errors |
- Headers:
Content-Type: application/json
{
"requestObject": {
"userId": "roman",
"operationId": "8d70f3c1-d920-408f-bc57-e17d8ccb45d8",
"formDataChange": {
"type": "AUTH_METHOD_CHOICE",
"chosenAuthMethod": "SMS_KEY"
}
}
}- Status Code:
200 - Headers:
Content-Type: application/json
{
"status": "OK",
"responseObject": null
}Overview
Applications
- Web Flow Server
- Next Step Server
- Data Adapter
- Mobile Token
- PowerAuth Server
- PowerAuth Admin
- PowerAuth Push Server
REST APIs
- NextStep Server REST API Reference
- Data Adapter REST API Reference
- Web Flow REST API Reference
- Mobile Push Registration API
- Mobile Token REST API Reference
Deployment
Customizing Web Flow
- Customizing Web Flow Appearance
- Implementing Data Adapter Interface
- Web Flow Configuration
- Configuring Next Step Definitions
- Customizing Operation Form Data
- Mobile Token Configuration
Technical Notes
Development
Releases