DriveB

07.01. Integração B2C

images/confluence/download/attachments/6271347181/B2C-version-1-modificationdate-1758310078000-api-v2.png


Obtenha as categorias de serviço disponíveis

Endpoint: /service-categories

Method: GET

Response:

[
{
"id": 0,
"code": "string"
}
]

Exemplo de retorno:

[

{

"name": "Corretiva",

"value": "CORRECTIVE"

},

{

"name": "Plano Manutenção",

"value": "PREVENTIVE"

},

{

"name": "Pneus",

"value": "TIRES"

}

]



Obtenha a listagem de oficinas

Endpoint: /workshop-list-unlinked

Method: GET

Query parameters:

{
“license_plate”: “license_plate”,
“service_category_id”: “xxx”,
“latitude”: “xxx”,
“longitude”: “xxx”
}


Name

Description

Required

license_plate

License plate

true

service_id

Id of service sent in service-category api

true

latitude

Latitude from desired service location

True

longitude

Longitude from desired service location

true


Response body:

[
{
"id": workshop_id,
"tradingName": "xx,
“price_range”: 0.0,
"address": {
"district": "xx",
"street": "xx",
"number": "xx",
"city": "xx",
"state": "xx ",
"country": "xx"
},
"distance": distance,
"latitude": latitude,
"longitude": longitude,
"networkName": "xx
"email": "xx
"phone": "xx",
"name": "xx"
}
]

Key

Description

id

Workshop id

price_range

Price for that car workshop - double

tradingName

Workshop trading name

address

Address object

district

Workshop district

street

Workshop street

number

Workshop number

city

Workshop city

state

Workshop state

country

Workshop country

distance

Distance from latitude and longitude sent in the request

latitude

Workshop latitude

longitude

Workshop longitude

networkName

Workshop network type

email

Workshop responsible e-mail

phone

Workshop telefone

name

Workshop responsible name


Response code:

Code

Status

Message

200

OK

-

400

Bad request

Invalid input data

401

Unauthorized

Invalid api key

500

Internal server error

Internal server error


New customer and vehicles registration

Endpoint: /customer-register

Method: POST

Request Body

{
"cnpj":"[cpf/cnpj]",
"user":{
"name":"xx",
"email":"xxx",
"phone":"xxx"
},
"vehicles":[
"licensePlates"
],
"manager": true
}

Field

Description

Required

cnpj

CNPJ or CPF of the resposible

true

user

Object

true

name

Responsible person name

true

email

Responsible person email

True

Phone

Responsible person phone

False

vehicles

Array with licensePlates

True

manager

Fleet manager responsible for the fleet

Optional (true default)


Response code and message:

Code

Status

Body

Message

200

Created

customer_id

Register successfully

400

Bad request

-

Invalid input data

401

Unauthorized


Invalid credential

500

Internal server error


Internal server error


Service Schedule

Endpoint: /service-schedule

Method: POST

Request body:

{
"customer_id ": customer_id,
" license_plate ": “xx”,
"observations": "xx",
"serviceType": service_type_id,
"carWorkshopId": workshop_id,
"date": "xx",
"period": "xx",
"timeService": "xx"
}

Name

Description

Required

customer_id

Customer id

true

license_plate

License plate

true

mileage

Mileage to update

True

observations

Observations

false

serviceType

Service type id sent from service-recommendation api

true

carWorkshopId

Workshop id sent from workshop-list api

true

date

Date required

true

period

Period required

true

timeService

Time required from the service

false


Response:

{
“service_id”: xxx
}

Name

Description

service_id

Id of the scheduled service

Response code and message:

Code

Status

message

200

OK

Register successfully

400

Bad request

Invalid input data

401

Unauthorized

Invalid credential

500

Internal server error

Internal server error


Service Edit

Endpoint: /service-edit

Method: PATCH

Request body:

{
"service_id ": service_id
"observations": "xx",
"serviceType": service_type-id
"carWorkshopId": workshop_id,
"date": "xx",
"period": "xxx",
"timeService": "xx"
}

Name

Description

Required

service_id

Id of service to edit

true

mileage

Mileage to update

True

observations

Observations

false

serviceType

Service type id sent from service-recommendation api

true

carWorkshopId

Workshop id sent from workshop-list api

true

date

Date required

true

period

Period required

true

timeService

Time required from the service

false


Response code and message:

Code

Status

message

200

OK

Edited successfully

400

Bad request

Invalid input data

401

Unauthorized

Invalid credential

500

Internal server error

Internal server error



Service Status

Endpoint: /service-status/{service-id}

Method: GET

Response body:

{
"id": service_id,
"carWorkshop": {
"id": workshop_id,
"tradingName": "xx",
"street": "xx",
"number": "xx",
"district": ‘xx",
"city": "xx",
"state": "xx",
"country": "xx",
},
"serviceType": service_type_id,
"displayServiceType": "xx",
"observations": "xx",
"status": "xx",
"displayStatus": "xx",
"date": "xx",
"period": "xx",
"callToAction": "xx",
"timeService": ‘xx’,
}

Key

Description

id

Service id

carWorkshop

Workshop object

id

Worhsop id

tradingName

Workshop trading name

street

Workshop street address

number

Workshop address number

district

Workshop address district

city

Workshop address city

state

Workshop address state

country

Workshop address country

serviceType

Service type id

displayServiceType

Service type translated to display to user

observations

Observations of the scheduled service

status

Status of the service request

displayStatus

Status translated to be displayed to the user

date

Date scheduled to perform the service

Period

Period scheduled to perform the service

callToAction

Call to action to let the user know what to do for the next step

timeService

Time scheduled for the service

Response message and code:

Code

Status

Message

200

OK

-

400

Bad request

Invalid input data

401

Unauthorized

Invalid credential

500

Internal server error

Internal server error


Invoice management

Endpoint: /invoice-managment/{service-id}

Method: GET

Response body:

{
"id":service_id,
"licensePlate": "xx",
"clientId": cliente_id
"carWorkshop": "xx",
"carWorkshopId": workshop_id,
"status": "xx",
"serviceNfPdfFilename": "xx.pdf",
"partsNfPdfFilename": "xx.pdf",
"partsNfXmlFilename": "xx.xml",
"serviceNfPdfFilepath": " https://xx.pdf",
"partsNfPdfFilepath": " https://xx.pdf",
"partsNfXmlFilepath": "https://xxxml",
“date”: “xx”
}

Key

Description

id

Service id

licensePlate

License plate

clientId

Customer id

carWorkshop

Workshop trading name

carWorkshopId

Workshop id

status

Service staus

serviceNfPdfFilename

Service invoice pdf file name

partsNfPdfFilename

Parts invoice pdf file name

partsNfXmlFilename

Service invoice xml file name

serviceNfPdfFilepath

Service invoice pdf file url

partsNfPdfFilepath

Parts invoice pdf file url

partsNfXmlFilepath

Parts invoice xml file url

date

Date of the invoice sent


Response code and message:

Code

Status

Message

200

OK

-

400

Bad request

Invalid input data

401

Unauthorized

Invalid credential

500

Internal server error

Internal server error