API references¶
Error handling¶
Note
The MPower Client API component will return REST API errors with the error code and cause; descriptions will be displayed in English.
| Error code | Description |
|---|---|
| AuthenticationFailed | Service consumer authentication process failed. See Authentication |
| InvalidParameter | Some input parameter is invalid. Please review the returned Fault Reason text and called operation description. |
| 200 | Success |
| 400 | Bad request, Validation failed. Check validation rules compliance |
| 401 | Unauthorized Access. Check authorization requirements |
| 403 | Forbidden. The requested action is not allowed for the transmitted ID |
| 404 | Not found. Check sent request data |
| 500 | A server error occurred. Missing connection with DB from other reasons than: 400 / 401 / 501. Contact the Administrator. |
| 501 | A server error occurred. Contact the Administrator. |
API methods description¶
Check authorization validity¶
Note
Because this method can be called multiple times on different days/times, the response may vary: at a certain moment the power of representation may no longer be valid due to expiry, revocation, renunciation, suspension, etc.
| Call signature | GET /api/Authorization/check/Code-True-One | |
|---|---|---|
| Description | Based on the authorization code, returns an entry stating whether the power of representation is valid or cancelled. | |
| Input/Output parameters | ||
| Name | Type | Description |
| Query | "authorizationCode" | The 16-digit unique identification code of the power of representation. |
| Response | "data": = True or False | If the returned value is True, the power of representation is valid; if False, it is not valid. |
| Faults | ||
| Code | Reason | |
| 200 | Success | |
| 404 | Not found. Check sent request data | |
| 500 | A server error occurred. Missing connection with DB from other reasons than: 400 / 401 / 501. Contact the Administrator. | |
| 501 | A server error occurred. Contact the Administrator. | |
Get authorization details¶
| Call signature | GET /api/Authorization/check/Code-Details-One | |
|---|---|---|
| Description | Based on the authorization code, returns an entry with a data structure containing details of the identified power of representation. | |
| Input/Output parameters | ||
| Name | Type | Description |
| Query | "authorizationCode" | The 16-digit unique identification code of the power of representation. |
| Response | AuthorizationDetails | A data structure that contains the details of the identified power of representation. |
| Faults | ||
| Code | Reason | |
| 200 | Success | |
| 404 | Not found. Check sent request data | |
| 500 | A server error occurred. Missing connection with DB from other reasons than: 400 / 401 / 501. Contact the Administrator. | |
| 501 | A server error occurred. Contact the Administrator. | |
Check authorization validity by type code¶
| Call signature | GET /api/Authorization/check/TypeCode-Valid-One | |
|---|---|---|
| Description | Based on the authorization type code, Idn1 and Idn2, returns an entry with a data structure that states whether the power of representation is valid or cancelled. | |
| Input/Output parameters | ||
| Name | Type | Description |
| Query | AuthorizationTypeCodeQuery | A data structure that contains the authorization details identified based on the authorization type code. |
| Response | AuthorizationValid | A data structure related to the power of representation that indicates its validity: True or False. |
| Faults | ||
| Code | Reason | |
| 200 | Success | |
| 404 | Not found. Check sent request data | |
| 500 | A server error occurred. Missing connection with DB from other reasons than: 400 / 401 / 501. Contact the Administrator. | |
| 501 | A server error occurred. Contact the Administrator. | |
Get authorization list by IDNx¶
| Call signature | GET /api/Authorization/check/Idn-Details-List | |
|---|---|---|
| Description | Based on IDNP or IDNO, returns the list of powers of representation. | |
| Input/Output parameters | ||
| Name | Type | Description |
| Query | AuthorizationListQuery | Identification based on IDNP or IDNO and, optionally, an additional structure with data related to the power of representation. |
| Response | AuthorizationDetails | A data structure that contains the details of the powers of representation. |
| Faults | ||
| Code | Reason | |
| 200 | Success | |
| 404 | Not found. Check sent request data | |
| 500 | A server error occurred. Missing connection with DB from other reasons than: 400 / 401 / 501. Contact the Administrator. | |
| 501 | A server error occurred. Contact the Administrator. | |
Download authorization file¶
| Call signature | GET /api/Authorization/file | |
|---|---|---|
| Description | Based on the authorization code, returns an entry with a data structure that contains the authorization file. | |
| Input/Output parameters | ||
| Name | Type | Description |
| Query | authorizationCode | A data structure that contains the details of the authorization identified based on the authorization code. |
| Response | AuthorizationFile | A data structure that contains the authorization file. |
| Faults | ||
| Code | Reason | |
| 200 | Success | |
| 404 | Not found. Check sent request data | |
| 500 | A server error occurred. Missing connection with DB from other reasons than: 400 / 401 / 501. Contact the Administrator. | |
| 501 | A server error occurred. Contact the Administrator. | |
Data structures (Query)¶
| Member | Type | Required/Optional | Description |
|---|---|---|---|
| AuthorizationTypeCodeQuery | |||
| AuthorizationTypeCode | String | Required | Enter the authorization type code (assigned from the approved form, 10 characters – "AT-xxxxxxx"). |
| AuthorizingIdn | String | Required | Enter the IDNP or IDNO of the represented party.
Must contain exactly 13 characters and only digits. |
| AuthorizedIdn | String | Required | Enter the IDNP or IDNO of the representative.
Must contain exactly 13 characters and only digits. |
| AuthorizationListQuery | |||
| IDNx | String | Required | The list of powers of representation granted and received by the completed IDNP or IDNO will be returned (where the natural or legal person has the role of represented and representative).
Must contain exactly 13 characters and only digits. Will be compared to be identical to AuthorizingContextIdn and AuthorizedIdn. |
| Status | Integer | Optional | Filters the list of powers of representation granted and received according to the indicated status.
Must contain the status code as per the enumerations indicated in the Enumerations section. Will be compared to be identical to Authorization Status. |
| AuthorizationTypeCode | String | Optional | Enter the authorization type code (assigned from the approved form, 10 characters – "AT-xxxxxxx"). |
| StartDate | String | Optional | Displays the powers of representation that became effective starting from the indicated date.
Constraints: this value must not be later than the value entered in the EndDate field. Time is set to UTC. Example: "2020-09-28T10:35:16.879Z". Will be compared to be greater than or equal to AuthorizationValidFrom date (AuthorizationValidFrom represents the date the power of representation became effective). |
| AuthEndDateorizationTypeCode | String | Optional | Displays the powers of representation that expired up to the indicated date.
Constraints: this value must not be earlier than the value entered in the StartDate field. Time is set to UTC. Example: "2020-09-28T10:35:16.879Z". Will be compared to be greater than or equal to AuthorizationValidTo date (AuthorizationValidTo represents the expiration date of the power of representation). |
| GrantedByIdn | String | Optional | This parameter will display the list of powers of representation that were granted by the specified IDNP/IDNO.
Constraints: The value of this field must be different from the value of the GrantedToIdn field. Must contain 13 characters, all digits. Will be compared to be equal to AuthorizingContextIdn. |
| GrantedToIdn | String | Optional | Displays the list of powers of representation that were received from the specified IDNP/IDNO.
Constraints: The value of this field must be different from the value of the GrantedByIdn field. Must contain 13 characters, all digits. Will be compared to be equal to AuthorizedIdn. |
| ItemsPerPage | Integer | Optional | The parameter specifies the page to be displayed. By default, records from the first page are displayed.
Constraints: if a negative number or zero is provided, the system will return powers of representation from the first page; if a number greater than the number of pages is provided, zero powers of representation will be displayed per page. |
Data structures (Response)¶
| Member | Type | Required/Optional | Description |
|---|---|---|---|
| AuthorizationCodeValid | |||
| AuthorizationCode | String | Required | The unique identification code of the power of representation. |
| IsValid | String | Required | True if valid
False if not valid |
| AuthorizationDetails | |||
| AuthorizationCode | String | Required | The unique identification code of the power of representation. |
| AuthorizationTypeCode | String | Required | The type code of the power of representation (according to the approved form). |
| AuthorizingPartyType | Integer | Required | ID of the represented party type; see the Enumerations section. |
| AuthorizingIdn | String | Required | IDNP or IDNO of the represented party. |
| AuthorizedPartyType | Integer | Required | ID of the representative party type; see the Enumerations section. |
| AuthorizedIdn | String | Required | IDNP or IDNO of the representative. |
| From | String | Required | If isValid=True -> The date from which the power of representation is valid.
If isValid=False -> The date from which the power of representation is suspended or invalid. Time is set to UTC. |
| To | String | Required | If isValid=True -> The date until which the power of representation is valid.
If isValid=False -> "null". Time is set to UTC. |
| IsValid | String | Required | True if valid
False if not valid |
| AuthorizingPartyName | String | Required | First and last name of the represented party. |
| AuthorizedPartyName | String | Required | First and last name of the representative. |
| AuthorizationTypeName | String | Required | Name of the authorization type. |
| ServiceProviderIdno | String | Required | IDNO of the service provider. |
| ServiceProviderName | String | Required | Name of the service provider. |
| AuthorizationFile | |||
| content | byte[] | Required | File content that contains data about the requested authorization. |
| content-type | String | Required | Authorization file MIME type. Default: "application/pdf" |
Enumerations¶
| Attributes | Description | |
|---|---|---|
| AuthorizationGrantedType | ||
| 1 | Power of representation granted by IDNx | |
| 2 | Power of representation received by IDNx | |
| 3 | Power of representation co-signed by IDNx | |
| AuthorizationStaus | ||
| Draft | The power of representation is created, but not valid | None |
| PendingAcceptance | The power of representation is granted, but requires the representative’s acceptance to become valid | None |
| Pending | The power of representation is granted, but will become valid at a future date | None |
| Valid | The power of representation is valid and can be used for representation | isValid=True |
| Canceled | The power of representation is expired, revoked or renounced | isValid=False |
| Suspended | The power of representation is suspended | isValid=False |
| AuthorizingPartyType | ||
| 1 | Natural person | |
| 2 | Legal entity | |
| AuthorizedPartyType | ||
| 1 | Natural person | |
| 2 | Legal entity | |
| Status | ||
| 1 | The power of representation saved as draft (not granted) | Draft |
| 2 | The power of representation that was granted, but requires the representative’s acceptance to become valid | PendingAcceptance |
| 3 | The power of representation that was granted, but the effective date is in the future | PendingValidity |
| 4 | The power of representation that is valid. | Valid |
| 5 | The power of representation that is suspended. | Suspended |
| 6 | The power of representation that is not valid due to expiry, renunciation, revocation | Canceled |
Examples of API method calls¶
GET /api/Authorization/check/Code-True-One¶
curl -X GET "https://mpower.staging.egov.md:8443/clients-api/api/Authorization/check/Code-True-One?AuthorizationCode=0200905142878268" -H "accept: text/plain"
{
"data": true,
"success": true,
"messages": []
}
GET /api/Authorization/check/Code-Details-One¶
curl -X GET "https://mpower.staging.egov.md:8443/clients-api/api/Authorization/check/Code-Details-One?AuthorizationCode=0200935852951597" -H "accept: text/plain"
{
"data": {
"authorizationCode": "0200935852951597",
"authorizationTypeCode": "AT-2100025",
"authorizingPartyType": 2,
"authorizingIdn": "1009600026622",
"authorizedPartyType": 1,
"authorizedIdn": "2001003328546",
"fromDate": "2020-09-22T14:16:06.0932925",
"toDate": "2021-03-22T21:59:59.999",
"isValid": true,
"authorizingPartyName": "Esempla SRL",
"authorizedPartyName": "L CHIRIŢA",
"authorizationTypeName": "Ridicare original document",
"serviceProviderIdno": "1009600026622",
"serviceProviderName": "Companie SRL"
},
"success": true,
"messages": []
}
GET /api/Authorization/check/TypeCode-Valid-One¶
curl -X GET "https://mpower.staging.egov.md:8443/clients-api/api/Authorization/check/TypeCode-Valid-One?AuthorizationTypeCode=AT-2100025&AuthorizingIdn=1009600026622&AuthorizedIdn=2001003328546" -H "accept: text/plain"
{
"data": {
"authorizationCode": "0200935852951597",
"isValid": true
},
"success": true,
"messages": []
}
GET /api/Authorization/check/Idn-Details-List¶
!NOT PROVIDED INTO PREVIOUS DOCUMENTATION
GET /api/Authorization/file¶
curl -X GET "https://mpower.dev.egov.md:8443/clients-api/api/Authorization/file ? ?AuthorizationCode=0200905142878268" " -H "accept: text/plain"
{
"data": {
"content": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PC9GaWx0ZXI…",
"content-type": "application/pdf"
},
"success": true,
"messages": []
}