API: Mandate
Preconditions (setup)
To make this functionality work
- Upload template file to BrokerStar installation
- Login to BrokerStar with permissions allowing to use general filemanager
- Go to /fm/index
- Upload template file
- File needs to be a PDF
- In
Document category
selectTemplates/Mandate
. - Upload file (it does not have to have any additional setup - beside not archived and not deleted)
- Check if file is compressed correctly
- Send template request
- If response code is 415 (Unsuported Media Type)
- IN most cases its a compression problem - go to /fm/index and compress pdf with (safe) compression level
GET /api/v3/mandate/latest/{contactId}
Request parameter:
Parameter | Type | In | Description |
---|---|---|---|
contactId | int | url | id of contact related to mandate |
Response data:
Parameter | Type | Description |
---|---|---|
created_at | string|date | date of mandate creation |
name | string | filename |
title | string|null | File title |
id | int | file id |
Metadata: object.
Parameter | Type | Description |
---|---|---|
status | int | Response status (same as in http code) |
Data: object.data
Response (Error):
Parameter | Type | Description |
---|---|---|
code | integer | An error code |
error | string | A message containing some information about the error |
errors | array | List of errors devided by field in associative array {field_name:error message} |
Request
curl -X GET https://public.brokerstar.biz/api/v3/mandate/5 --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK { "data": { "created_at": "2022-11-17T00:00:00+01:00", "name": "Mandat.pdf", "title": "Mandat", "id": 69 }, "status": 200 }
Response (Error)
404 Not found { "error": "Entity not found", "code": 404 }
Response (Error)
403 Forbidden { "error": "You have no access to contact id:5", "code": 403 }
Or one of
- /wiki/spaces/BROK/pages/693181 #Authentication defaults
POST /api/v3/mandate/template
Request parameter:
Parameter | Type | In | Description |
---|---|---|---|
action | string | FORM_DATA | generate (default) | save - if we want to save to contact filemanager |
contact | int|null | FORM_DATA | required if saving, contact id |
image[] | FILE | FORM_DATA | array of files |
image_data[] | JSON | FORM_DATA | JSON definition of image (keys must mach the image FILE list) Params:
|
text[] | JSON | FORM_DATA | JSON definition of image (keys must mach the image FILE list) Params:
|
JSON data (All fields are optional and can be send selective):
Parameter | Out Type | In Type | Description |
---|---|---|---|
All fields from Single File + | |||
Response data:
- /wiki/spaces/BROK/pages/693181 #update defaults
Request
curl --location --request POST 'http://public.brokerstar.biz/api/v3/mandate/template' \ --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2Njg1OTc2NDcsImV4cCI6MTY2ODY4NDA0Nywicm9sZXMiOlsiUk9MRV9VU0VSIl0sImNsc2lkIjoiMWVkNjVhMGItODE4ZC02YzQ0LTlmODUtY2IwMjViMDI5NjQ1IiwidXNlcm5hbWUiOiJ0ZW1hdCJ9.z1Uu5g1gLCNdQqtxqLawMQqW68XCXTAeTgJXbX1BA1k9cNK7RICSxBDFUyaMb9zgoaalQo7H7GtI7o0ILEFIoA' \ --form 'action="save"' \ --form 'contact="4"' \ --form 'image[]=@"/home/dev/logo.png"' \ --form 'image_data[] ="{ \"x\":\"55\", \"y\":\"55\", \"w\":\"11\", \"h\":\"11\"}"' \ --form 'image[]=@"/home/dev/image.png"' \ --form 'image_data[]="{ \"x\":\"115\", \"y\":\"120\", \"w\":\"44\", \"h\":\"44\"}"' \ --form 'text[]="{\"text\":\"Name\", \"x\":\"15\", \"y\":\"20\",\"style\":\"B\"}"' \ --form 'text[]="{\"text\":\"Maciej\", \"x\":\"30\", \"y\":\"20\"}"'
Response (Success)
200 OK { "status":200 }
Response (Error)
400 Bad request { "error": "Missing `contact` argument (int)", "code": 400 }
Response (Error)
415 Unsupported Media Type { "error": "Template file is not supported, probably incorrect compression method, please change compression (BrokerStar filemanager allows to do that - use safest compression method)", "code": 415 }
Response (Error)
400 Bad request { "error": "File was not send (form data)", "code": 400 }
Response (Error)
406 Not acceptable { "error": "Disk quota: Not enough space!", "code": 406 }
Response (Error)
403 Forbidden { "error": "You have no access to XXX id:123", "code": 403 }
Or one of
- /wiki/spaces/BROK/pages/693181 #Authentication defaults
- /wiki/spaces/BROK/pages/693181 #Update defaults
POST /api/v3/mandate/inform-insurances
Request parameter:
Parameter | Mandatory | In Type | Description |
---|---|---|---|
new_mandate | no | bool | Default = false, if set to true, all insurances that have flag true will replace contact Third-party care |
insurances[] | yes | array | List of insurances where key is insurance id and value is flag determining if this insurance should be stored in third party care *only if new_mandate flag is set to true |
Additional setup | |||
_sendMail | no | bool | Default = false, If true - if success mail will be send to contact and to related advisors. |
Response data:
Parameter | Type | Description |
---|---|---|
status | int | Response status code (same as in http code) |
Response (Error):
Parameter | Type | Description |
---|---|---|
code | integer | An error code |
error | string | A message containing some information about the error |
errors | array | List of errors devided by field in associative array {field_name:error message} |
Request
curl -X GET https://public.brokerstar.biz/api/v3/mandate/inform-insurances -d '{ "new_mandate": true, "_sendMail": true, "insurances": { "3929":true, "3427":false, "3412":true, "1866":false } }'
Response (Success)
200 OK { "status": 200 }