API: File

File list

JWT Authorisation

GET /api/v3/file

Request parameter:

No Request parameter

API: _ Default behavior #List defaults

Filtering parameters:

ParameterTypeINExampleDescription
contactintegerQUERYfilters[contact]=34Filtering by contact id = value
policyintegerQUERYfilters[policy]=123Filtering by policy id = value
claimintegerQUERYfilters[claim]=123Filtering by claims id = value
public_accessbooleanQUERYfilters[public_access]=trueFilter by public_access = value

Response data:

Metadata: object.

ParameterTypeDescription
countintNumber of all results marching criteria 
statusintResponse status (same as in http code)

Data:  object.data[array]

ParameterOut TypeIn TypeDefault InDescription
idint

File id
created_atstring(date)
Current date timeFile creation date
namestring(max=100)
*ExtractedFile name
titlestring|null

File title
extensionstring
*ExtractedFile extension (no dot)
modulearray
*Basing on paramsFile module
module[id]intint(1,5,9,4)*Basing on paramsModule 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_idint|null
*Basing on paramsEntity (Claim,Contact...) id
sizeint
*ExtractedSize in bytes
public accessint(0|1)|null
0=falseIs file marked as public (for client)
document_category_itemarray

API: Document Category Item
document_category_item[id]int|nullint
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
archivedint(0|1)|null
0=falseIs 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):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList 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 

Single File

JWT Authorisation

GET /api/v3/file/{id}

Request parameter:

ParameterTypeInDescription
idinturlid of requested contact

Response data:

Metadata: object.

ParameterTypeDescription
statusintResponse status (same as in http code)

Data:  object.data

ParameterOut TypeIn TypeDefault InDescription
All fields from All Files +
document_datestring(date)|nullstring(date)|nullcurrent dateDocument date
typeint(0|1)int(0|1)

mime_typestringstring*ExtractedFile mime type
commentstringstring
File comment
in_or_outint(0|1)|nullint(0|1)0=inIf file send from or to contact/policy..
client_servicearrayint|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
contactarrayint|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
claimarrayint|null
API: Claim
claim[id]int|null

File related claim id
claim[nr]string|null

File related claim nr
policyarrayint|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):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList 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 

File download

JWT Authorisation

GET /api/v3/file/{id}/download

Request parameter:

ParameterTypeInDescription
idinturlid 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  

File create

(Warnung) Do not send asynchrous requests to one module, first request is creating directory structure it needs a delay so next request are re-using new structure instead of ovveriting it.

JWT Authorisation

POST /api/v3/file

Request parameter:

ParameterTypeInDescription
filefileFILESfile contents
datajsonFORM_DATAJSON file description and data
claimint|nullJSONIf we are sending file related to claim
contactint|nullJSONif we are sending file related to contact
policyint|nullJSONIf we are sending file related to policy
taskint|nullJSONIf we are sending file related to task

JSON data (All fields are optional and can be send selective):

ParameterOut TypeIn TypeDescription
All fields from Single File +





Response data:

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 

Related pages