API: Document Category Item

Preconditions (setup)

By API only public  document_category_items are accessible, user with correct permissions need to set up this field for selected items.

Document Category Item list

JWT Authorisation

GET /api/v3/document-category-item

Request parameter:

No Request parameter

Extra fields:

ParameterTypeINExampleDescription
contactintegerQUERYadd[contact]=123Adds files related to contact id=value
policyintegerQUERYadd[policy]=1234Adds files related to policy id=value
claimintegerQUERYadd[claim]=12345Adds files related to claim id=value

Filtering parameters:

ParameterTypeINExampleDescription
moduleintegerQUERYfilters[module]=1Filtering by module id = value (1=Contact,5=Policy,9=Claim)
document_categoryintegerQUERYfilters[document_category]=1Filtering by document category id = value
contactTypeintegerQUERYfilters[contactType]=1Filtering by contact type id = value (1=company, 2=person)


Response data:

Metadata: object.

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

Data:  object.data[array]

ParameterTypeDescription
idintegerDocument category item id
namestringName in DE language
name_estringName in EN language
name_fstringName in FR language
name_istringName in IT language
sortintOrdering column
document_categoryarrayAPI: Document Category
document_category[id]integerCategory id
document_category[name]stringCategory name in DE language
document_category[name_e]stringCategory name in EN language
document_category[name_f]stringCategory name in FR language
document_category[name_i]stringCategory name in IT language
modulearrayRelated module
module[id]intModule id
module[name]stringModule name in DE language
module[name_e]stringModule name in EN language
module[name_f]stringModule name in FR language
module[name_i]stringModule name in IT language
Extra fields
filearrayIf using extra param: contact,policy or claim
API: File related to entity and connected to
document_category is attached.
file[id]int|nullFile id
file[name]string|nullFile name
file[title]string|nullFile title
file[size]int|nullFile size
file[crated_at]string(date)|nullFile creation (upload) date
file[downloaded]bool|nullWas file uploaded?

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}

API: _ Default behavior #Authentication defaults 

Request
curl -X GET https://public.brokerstar.biz/api/v3/document-category-item --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'


Response (Success)
200 OK   
{
    "count": "57",
    "data": [
        {
			"sort": 1,
            "name_e": "Broker mandate",
            "name_f": "Mandat de courtier",
            "name_i": "Mandato di broker",
            "document_category": {
                "name_e": "Mandate",
                "name_f": "Mandat",
                "name_i": "Mandato",
                "id": 1,
                "name": "Mandat"
            },
            "module": {
                "name_e": "Address book",
                "name_f": "Carnet d'adresses",
                "name_i": "Indirizzario",
                "id": 1,
                "name": "Contacts (Adressbuch)"
            },
            "id": 1,
            "name": "Broker Mandat"

			# when using add[contact|claim|plicy]
			"file": {
                "id": 7704,
                "name": "note.pdf",
                "title": "Appointment note",
                "size": 8973,
                "created_at": "2022-12-13 17:28:09 ",
                "downloaded": false
            }         
		},
	   [...]
    ],
    "status": 200
}
Response (Error)
400 Bad request
{
	"error": "Module parameter not send or module id not in (1=contact,5=policy,9=claim)",
	"code": 400
}
Response (Error)
400 Bad request
{
	"error": "Id of entity needs to be send (eg: id of contact)",
	"code": 400
}
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 

Upload file

JWT Authorisation

POST /api/v3/document-category-item/upload/{documentCategoryItem}/{id}/{language}

Request parameter:

ParameterTypeInDescription
filefileFILESfile contents
documentCategoryItemintQUERYIf of related document category item
idintQUERYif of related entity (eg. contact - module is
taken from doument_category_item
module.
languagestring|nullQUERYLanguage is needed to set up file title, by default language is DE


Response data:

Metadata: object.

ParameterTypeDescription
dataarraydata set
statusintResponse status (same as in http code)

Data:  object.data[array]

ParameterTypeDescription
idintegerNewly created file id
namestringFile name
titlestringFile title
sizeintSize of file in bytes
created_atstringDate of file upload/creation
downloadedboolWas file downloaded before

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}

Response data:

Request
curl -X GET https://public.brokerstar.biz/api/v3/document-category-item/upload/3/123/en --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK    
{
    "status": 200,
    "data": {
        "id": 7704,
        "name": "note.pdf",
        "title": "Appointment note",
        "size": 8973,
        "created_at": "2022-12-13 17:28:09 ",
        "downloaded": false
    }
}
Response (Error)
400 Bad request
{
	"error": "File was not send along with request",
	"code": 400
}

Remove file

JWT Authorisation

DELETE /api/v3/document-category-item/remove/{file}

Request parameter:

ParameterTypeInDescription
fileintQUERYId of file to be removed


Response data:

Metadata: object.

ParameterTypeDescription
messagestringComment
statusintResponse status (same as in http code)
Request
curl -X GET https://public.brokerstar.biz/api/v3/document-category-item/remove/345 --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK    
{
    "status": 200,
    "message": "File was removed"
}
Response (Success)
403 Forbidden
{
    "status": 403,
    "message": "You have no access to this file"
}