API: File
GET /api/v3/file
Request parameter:
No Request parameter
API: _ Default behavior #List defaults
Filtering parameters:
Parameter | Type | IN | Example | Description |
---|---|---|---|---|
contact | integer | QUERY | filters[contact]=34 | Filtering by contact id = value |
policy | integer | QUERY | filters[policy]=123 | Filtering by policy id = value |
claim | integer | QUERY | filters[claim]=123 | Filtering by claims id = value |
public_access | boolean | QUERY | filters[public_access]=true | Filter by public_access = value |
Response data:
Metadata: object.
Parameter | Type | Description |
---|---|---|
count | int | Number of all results marching criteria |
status | int | Response status (same as in http code) |
Data: object.data[array]
Parameter | Out Type | In Type | Default In | Description |
---|---|---|---|---|
id | int | File id | ||
created_at | string(date) | Current date time | File creation date | |
name | string(max=100) | *Extracted | File name | |
title | string|null | File title | ||
extension | string | *Extracted | File extension (no dot) | |
module | array | *Basing on params | File module | |
module[id] | int | int(1,5,9,4) | *Basing on params | Module id, 1=Contact, 2-Policy, 3-Claim,4=Task |
module[name] | string | Module name in DE language | ||
module[name_e] | string | Module name in EN language | ||
module[name_i] | string | Module name in IT language | ||
module[name_f] | string | Module name in FR language | ||
entity_id | int|null | *Basing on params | Entity (Claim,Contact...) id | |
size | int | *Extracted | Size in bytes | |
public access | int(0|1)|null | 0=false | Is file marked as public (for client) | |
document_category_item | array | API: Document Category Item | ||
document_category_item[id] | int|null | int | Id of Document category item | |
document_category_item[name] | string|null | Item name in DE language | ||
document_category_item[name_e] | string|null | Item name in EN language | ||
document_category_item[name_i] | string|null | Item name in IT language | ||
document_category_item[name_f] | string|null | Item name in FR language | ||
archived | int(0|1)|null | 0=false | Is file marked as archived |
*Extracted from uploaded file
*Basing on params = If user sends "claim":123 → we set module=9(Claim) and entity_id=123
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} |
/wiki/spaces/BROK/pages/693181 #Authentication defaults
Request
curl -X GET https://public.brokerstar.biz/api/v3/file --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK 200 OK { "count": "35", "data": [ { "id": 200637, "created_at": "2022-08-16T00:00:00+02:00", "name": "Klient0.pdf", "title": "", "extension": "pdf", "module": { "name_e": "Damages", "name_f": "Sinistres", "name_i": "Danno", "id": 9, "name": "Claim (Schaden)" }, "entity_id": 18, "size": 50664, "public_access": false, "archived": false, "document_category_item": { "name_e": "Trustee Mandate", "name_f": "Mandat fiduciaire", "name_i": "Mandato fiduciario", "id": 2, "name": "Treuhand Mandat" } } [...] ], "status": 200 }
Or one of
- /wiki/spaces/BROK/pages/693181 #Authentication defaults
- /wiki/spaces/BROK/pages/693181 #List defaults
GET /api/v3/file/{id}
Request parameter:
Parameter | Type | In | Description |
---|---|---|---|
id | int | url | id of requested contact |
Response data:
Metadata: object.
Parameter | Type | Description |
---|---|---|
status | int | Response status (same as in http code) |
Data: object.data
Parameter | Out Type | In Type | Default In | Description |
---|---|---|---|---|
All fields from All Files + | ||||
document_date | string(date)|null | string(date)|null | current date | Document date |
type | int(0|1) | int(0|1) | ||
mime_type | string | string | *Extracted | File mime type |
comment | string | string | File comment | |
in_or_out | int(0|1)|null | int(0|1) | 0=in | If file send from or to contact/policy.. |
client_service | array | int|null | Client service | |
client_service[] | int|null | Client service id | ||
client_service[name] | string|null | Client service name in DE language | ||
client_service[name_e] | string|null | Client service name in EN language | ||
client_service[name_i] | string|null | Client service name in IT language | ||
client_service[name_f] | string|null | Client service name in FR language | ||
contact | array | int|null | API: Contact | |
contact[id] | int|null | File related contact id | ||
contact[name] | string|null | File related contact full name | ||
contact[name_1] | string|null | File related contact first name | ||
contact[name_2] | string|null | File related contact last name | ||
claim | array | int|null | API: Claim | |
claim[id] | int|null | File related claim id | ||
claim[nr] | string|null | File related claim nr | ||
policy | array | int|null | /wiki/spaces/BROK/pages/693051 | |
policy[id] | int|null | File related policy id | ||
policy[nr] | string|null | File related policy nr | ||
*Extracted from uploaded file
*Basing on params = If user sends "claim":123 → we set module=9(Claim) and entity_id=123
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/file/16448 --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK { "data": { "created_at": "2017-06-13T00:00:00+02:00", "name": "089110_ext.pdf", "title": "ZURI MFZV ANTR A&F Property Investment AG.pdf", "document_date": "2017-06-13T00:00:00+02:00", "type": 0, "public_access": false, "mime_type": "application/pdf", "extension": "pdf", "size": 1496430, "comment": "SimpleImport 2022-06-19", "archived": false, "in_or_out": null, "module": { "name_e": "Policies", "name_f": "Polices", "name_i": "Polizze", "id": 5, "name": "Policies (Policen)" }, "entity_id": 20285, "client_service": { "name_e": null, "name_f": null, "name_i": null, "id": null, "name": null }, "contact": { "name": null, "name_1": null, "name_2": null, "id": null }, "claim": { "id": null, "nr": null }, "policy": { "id": 20285, "nr": "75.868.240" }, "id": 95158, "document_category_item": { "name_e": "Trustee Mandate", "name_f": "Mandat fiduciaire", "name_i": "Mandato fiduciario", "id": 2, "name": "Treuhand Mandat" } }, "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:123", "code": 403 }
Response (Error)
403 Forbidden { "error": "You have no access to policy id:123", "code": 403 }
Response (Error)
403 Forbidden { "error": "You have no access to claim id:123", "code": 403 }
Or one of
- /wiki/spaces/BROK/pages/693181 #Authentication defaults
GET /api/v3/file/{id}/download
Request parameter:
Parameter | Type | In | Description |
---|---|---|---|
id | int | url | id of requested file |
Response data:
Correct response is Binary Data
Request
curl -X GET https://public.brokerstar.biz/api/v3/file/16448/download --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200
Response (Error)
404 File not found
Response (Error)
500 File not found on server file system
Response (Error)
500 File not found on server database
Response (Error)
403 You have no access to contact id:123
Response (Error)
403 You have no access to policy id:123
Response (Error)
403 You have no access to claim id:123
POST /api/v3/file
Request parameter:
Parameter | Type | In | Description |
---|---|---|---|
file | file | FILES | file contents |
data | json | FORM_DATA | JSON file description and data |
claim | int|null | JSON | If we are sending file related to claim |
contact | int|null | JSON | if we are sending file related to contact |
policy | int|null | JSON | If we are sending file related to policy |
task | int|null | JSON | If we are sending file related to task |
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://pro.bs.pl/app_dev.php/api/v3/file' \ --header 'Authorization: Bearer yJ0eXAiOiJKV1QiLCJh..3WXVP_8QE6T7SZ9n_w' \ --form 'data="{ \"policy\":20285,\"document_date\":\"2021-11-23\"}"' \ --form 'file=@"/home/user/Pulpit/document.pdf"'
Response (Success)
200 OK { "status":200 }
Response (Error)
400 Bad request { "error": "You need to send one of (claim,policy,contact,task..) parameter (int) that relates to file relation", "code": 400 }
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