This is our API documentation.
The examples for React AWS are example calls to the API using the AWS Amplify library in a React Project.
Examples are therefore given assuming that they are inside a React Component where the relevant Components have already been imported :
import { API } from "aws-amplify"; and the apiName given in the React App is supposed to be set to auditorApi.
This API defines the endpoints for the AUDIT APP.
Lists audits for a particular auditor.
The list of audits returned are sorted the most recently created first.
| Property | Description |
|---|---|
auditorId |
(required) the id of the auditor to whom the audits are assigned |
maxSize |
(required) the number of audits to request |
offset |
(required) the number of element to skip before returning |
dataKeys |
(required) a comma separated list of all the variable names to request |
auditType |
(required) can be one of ["TODO", "DONE"] |
let apiName = 'auditorApi';
let path = '/audits';
let myInit = {
queryStringParameters: {
"auditorId": "5ac13931135045d92",
"maxSize": "3",
"offset": "0",
"dataKeys":"name,carVinNumber",
"auditType": "DONE"
},
}
let respo = await API.get(apiName, path, myInit);
{
"total": 127,
"list": [
{
"id": "5cab483a52c7ee04c",
"name": "Mercedes-Benz A 180 Monospace Noir",
"createdAt": "2019-04-08 13:10:18",
"carVinNumber": "",
"createdById": "59b0249678592b49c",
"assignedUserId": "5ac13931135045d92"
},
{
"id": "5cab3cacb2bc0a524",
"name": "Volkswagen Touran X Gris",
"createdAt": "2019-04-08 12:21:00",
"carVinNumber": "",
"createdById": "59b0249678592b49c",
"assignedUserId": "5ac13931135045d92"
},
{
"id": "5ca8e144c4bef1834",
"name": "Opel Astra Break Brun",
"createdAt": "2019-04-06 17:26:28",
"carVinNumber": "",
"createdById": "59b0249678592b49c",
"assignedUserId": "5ac13931135045d92"
}
],
"select": "name,carVinNumber",
"offset": "0",
"maxSize": "3",
"auditorId": "5ac13931135045d92"
}
Get the information of a specific audit
| Property | Description |
|---|---|
carId |
(required) the id of the car related to the audit. It is the value returned by the endpoint /audits under the key "id" |
dataKeys |
(required) a comma separated list of all the variable names to request |
let apiName = 'auditorApi';
let path = '/audit';
let myInit = {
queryStringParameters: {
"carId": "5ac13931135045d92",
"dataKeys":"name,rimsSize"
},
}
let respo = await API.get(apiName, path, myInit);
{
"total": 1,
"list": [
{
"id": "5ca34614d1283156a",
"name": "Audit for Kia Picanto Berline Gris",
"rimsSize": "14",
"createdById": "59b0249678592b49c",
"assignedUserId": "5ac13931135045d92"
}
]
}
This returns a large JSON with a lot of information about what are the fields to display in the views/forms and the attributes of these fields (type, read only, etc.)
| Property | Description |
|---|---|
language |
(optional) the language desired for the labels of the fields |
| Keys in translations Object returned by /auditLayout | Description |
|---|---|
fields |
Contains all the field labels translations (ex: if the field name is myFieldName, then the translation of its label can be accessed by response.translations.fields['fields[.]myFieldName']) |
labels |
Simirlarly : response.translations.labels['labels[.]myLabelName'] |
links |
Simirlarly : response.translations.links['links[.]myLinkName'] |
options |
Simirlarly : response.translations.options['options[.]myOptionName'] |
tooltips |
Simirlarly : response.translations.tooltips['tooltips[.]myTooltipName'] |
| Type (under metadata key) | Description |
|---|---|
autoincrement |
integer |
bool |
boolean (true/false) |
date |
string (yyyy-mm-dd) |
datetime |
string (yyyy-mm-dd HH:mm) |
currency |
float |
enum |
list (has options like a Select), returns a string of the selected option |
foreign |
read only value from a related entity (class) |
file |
linked to a file |
float |
float |
image |
linked to an image file |
int |
integer |
multiEnum |
list with option with multiple options selectable |
number |
integer |
varchar |
string |
attachmentMultiple |
linked to multiple files |
array |
list of elements |
text |
string |
url |
string representing a url |
wysiwyg |
string with html tags in it |
let apiName = 'auditorApi';
let path = '/auditLayout';
let myInit = {
queryStringParameters: {
"language": "fr_FR"
},
}
let respo = await API.get(apiName, path, myInit);
{
"layout": [
{
"rows": ["Array"],
"label": "CONSOMMABLES"
},
{
"rows": ["Array"],
"label": "RESUME DES DOMMAGES"
},
{
"rows": ["Array"],
"label": "CARROSSERIE"
},
{
"rows": ["Array"],
"label": "CARROSSERIE DETAIL"
},
{
"rows": ["Array"],
"label": "FRAIS A PRÉVOIR"
},
{
"rows": ["Array"],
"label": "MOTEUR - AUDIT STATIQUE"
},
{
"rows": ["Array"],
"label": "INTERIEUR"
},
{
"rows": ["Array"],
"label": "MOTEUR - AUDIT DYNAMIQUE (CONDUITE PAR AUDITEUR)"
},
{
"rows": ["Array"],
"label": "OPTIONS"
}
],
"select": "carStateComsumables,carStateComsumablesMan,p65,p64,p66,timingBeltType,damageBodySeenAfterAudit,carStateBody,carStateBodyMan,p17,p18,p19,p20,p24,p21,p22,carBodyComments,rimsSize,rimsType,bodyP1,bodyP1Cost,bodyP2,bodyP2Cost,bodyP15,bodyP15Cost,bodyP14,bodyP14Cost,bodyP4,bodyP4Cost,bodyP3,bodyP3Cost,bodyP6,bodyP6Cost,bodyP5,bodyP5Cost,bodyP8,bodyP8Cost,bodyP7,bodyP7Cost,bodyP10,bodyP10Cost,bodyP9,bodyP9Cost,bodyP17,bodyP17Cost,bodyP16,bodyP16Cost,bodyP12,bodyP12Cost,bodyP13,bodyP13Cost,bodyP11,bodyP11Cost,bodyP18,bodyP18Cost,bodyP19,bodyP19Cost,costOfRepairingComment,costOfRepairing,totalCostOfRepairingDetail,totalCostOfRepairing,finBuyPrice,carStateMecha,carStateMechaMan,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p48,p49,p51,p54,p50,p52,p55,carEngineStaticComments,carStateInside,carStateInsideMan,p25,p26,p27,p28,p29,p30to34,p47,carInteriorComments,p56,p57,p58,p62,p59,p60,p61,p63,carEngineDynamicComments,carStatePrincipalOptions,carStateOptions,carStateOptionsMan",
"translations": {
"fields": {"Object"},
"labels": {"Object"},
"links": {"Object"},
"options": {"Object"},
"tooltips": {"Object"}
}
}
{
"rows":
[
[
{
"name": "carStateComsumables",
"label": "Etat des consommables",
"metadata": {"Object"}
},
{
"name": "carStateComsumablesMan",
"label": "Etat des consommables (audit)",
"metadata": {"Object"}
}
],
[
{
"name": "p65",
"label": "Pneus arrière",
"metadata": {"Object"}
},
{
"name": "p64",
"label": "Pneus avant",
"metadata": {"Object"}
}
],
[
{
"name": "p66",
"label": "Plaquettes de frein",
"metadata": {"Object"}
},
{
"name": "timingBeltType",
"label": "Type de courroie de distribution",
"metadata": {"Object"}
}
]
]
}
{
"name": "carStateComsumables",
"label": "Etat des consommables",
"metadata":{
"readOnly": true,
"type": "foreign",
"link": "opportunity",
"field": "carStateComsumables",
"view": "views/fields/foreign-text",
"tooltip": false,
"isCustom": true
}
}
Updates the properties of a particular audit.
| Property | Description |
|---|---|
auditId |
(required) the id of the audit to update. This id is the one returned by a call to the GET /audit endpoint |
payload |
(required) an object with all the key:value pairs to update with the request |
dataKeys |
(optional) a list of the updated keys to return from the request. If not specified, only the id is returned |
let apiName = 'auditorApi';
let path = '/audit';
let myInit = {
body: {
"auditId": "5cab9bcde3d457e1b",
"payload": {
"description": "This is a test for PUT",
"bodyP19": "pok"
},
"dataKeys": "id,name,description,totalCostOfRepairing"
}
}
let respo = await API.put(apiName, path, myInit);
{ "id": "5cab9bcde3d457e1b",
"name": "Audit for Audi A6 Berline grise",
"description": "This is a test for PUT",
"totalCostOfRepairing": 0 }
Get the information of a specific car
| Property | Description |
|---|---|
carId |
(required) the id of the car related to the audit. It is the value returned by the endpoint /audits under the key "id" |
dataKeys |
(required) a comma separated list of all the variable names to request |
let apiName = 'auditorApi';
let path = '/car';
let myInit = {
queryStringParameters: {
"carId": "5ac13931135045d92",
"dataKeys":"name"
},
}
let respo = await API.get(apiName, path, myInit);
{
"total": 1,
"list": [
{
"id": "5ca34614d1283156a",
"name": "Audit for Kia Picanto Berline Gris",
"createdById": "59b0249678592b49c",
"assignedUserId": "5ac13931135045d92"
}
]
}
This returns a large JSON with a lot of information about what are the fields to display in the views/forms and the attributes of these fields (type, read only, etc.)
| Property | Description |
|---|---|
language |
(optional) the language desired for the labels of the fields |
let apiName = 'auditorApi';
let path = '/carLayout';
let myInit = {
queryStringParameters: {
"language": "fr_FR"
},
}
let respo = await API.get(apiName, path, myInit);
Please refer to the documentation of GET /auditLayout endpoint.
Updates the properties of a particular car.
| Property | Description |
|---|---|
carId |
(required) the id of the car to update. This id is the one returned by a call to the GET /car endpoint |
payload |
(required) an object with all the key:value pairs to update with the request |
dataKeys |
(optional) a list of the updated keys to return from the request. If not specified, only the id is returned |
let apiName = 'auditorApi';
let path = '/car';
let myInit = {
body: {
"carId": "5ca346149e2a4fef2",
"payload": {
"description": "This is a test for PUT"
},
"dataKeys": "id,name,description"
}
}
let respo = await API.put(apiName, path, myInit);
{
"id": "5ca346149e2a4fef2",
"name": "Kia Picanto Berline Gris",
"description": "This is a test for PUT"
}
Get a url to put in the "src" attribute of an tag based on its id.
| Property | Description |
|---|---|
imageId |
(required) the id of the image to retrieve. |
size |
(optional) a key to indicate the size of the image to return. See details below. |
| Size options | Description |
|---|---|
xxx-small |
max dimensions [18, 18] |
xx-small |
max dimensions [32, 32] |
x-small |
max dimensions [64, 64] |
small |
max dimensions [128, 128] |
medium |
max dimensions [256, 256] |
large |
(default) max dimensions [512, 512] |
x-large |
max dimensions [864, 864] |
xx-large |
max dimensions [1024, 1024] |
let apiName = 'auditorApi';
let path = '/imageUrl';
let myInit = {
queryStringParameters: {
"imageId": "5ca346149e2a4fef2",
"size": "large"
}
}
let respo = await API.get(apiName, path, myInit);
{
"src":"https://the_domain/some_other_stuff"}
}
Post an image and link it to specific field
| Property | Description |
|---|---|
name |
(required) any name to give to the file to upload |
size |
(required) the size of the file in Bytes |
type |
(required) the MIME type of the image (ex : image/png or image/jpeg) |
relatedType |
(required) the relatedType key value as retrieved by GET /car and GET /audit |
relatedId |
(required) the id of the parent entity as retrieved by GET /car and GET /audit |
field |
(required) the field name of the image field |
file |
(required) the file encoded into a base64 string |
let apiName = 'auditorApi';
let path = '/image';
let myInit = {
body: {
"name": "my_image.png",
"size": 18313,
"type": "image/png",
"relatedType": "CarGarage",
"relatedId": "5cc85c7942d76d954",
"field": "sellerIdRecto",
"file": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAPYQAAD2EBqD+ (...)"
}
}
let respo = await API.post(apiName, path, myInit);
{
"id":"5cd40aa898ff5e032",
"name":"my_image.png",
"deleted":false,
"type":"image/png",
"size":18313,
"field":"sellerIdRecto",
"createdAt":"2019-05-09 11:10:32",
"storage":null,
"global":false,
"relatedId":"5cc85c7942d76d954",
"relatedType":"CarGarage",
"createdById":"5c82d1a3cb30a07b9"
}
Get a url to download the purchase contract for a specific car.
| Property | Description |
|---|---|
carId |
(required) the id of the car for which we want a contract generated. |
let apiName = 'auditorApi';
let path = '/contractUrl';
let myInit = {
queryStringParameters: {
"carId": "5ca346149e2a4fef2"
}
}
let respo = await API.get(apiName, path, myInit);
{
"src":"https://the_domain/some_other_stuff"}
}
This API defines the endpoints for the PRICING APP.
Here is a list of attribute that can be retrieved of written through the Opportunity API :
| Opportunity Class attributes | Description |
|---|---|
name |
(str) name for the Opportunity |
carBrand |
(str) make of the car |
carModel |
(str) model of the car |
carFuelEnum |
(str) fuel type |
carMileage |
(int) mileage in kilometers |
carHorsepower |
(int) power in kilowatts |
carFirstRegistration |
(str) date in format '2018-10-01' |
carBodyType |
(str) body type of the car |
carNbDoors |
(int) number of doors |
carGearboxEnum |
(str) gearbox type |
vendorFirstName |
(str) seller first name |
vendorName |
(str) seller last name |
vendorEmail |
(str) seller email address |
seller_phone |
(str) seller phone number |
Get the information of a specific car
| Property | Description |
|---|---|
oppId |
(required) the id of the opportunity |
dataKeys |
(optional) a comma separated list of all the variable names to request |
let apiName = 'auditorApi';
let path = '/opp';
let myInit = {
queryStringParameters: {
"oppId": "5cd251c14b7521fbf",
"dataKeys":"name"
},
}
let respo = await API.get(apiName, path, myInit);
{
"total": 1,
"list": [
{
"id": "5cd251c14b7521fbf",
"name": "Kia Picanto Berline Gris",
"createdById": "59b0249678592b49c",
"assignedUserId": "5ac13931135045d92"
}
]
}
Updates the properties of a particular opportunity.
| Property | Description |
|---|---|
oppId |
(required) the id of the opportunity to update. |
payload |
(required) an object with all the key:value pairs to update with the request |
dataKeys |
(optional) a list of the updated keys to return from the request. If not specified, only the id is returned |
forceResponse |
(optional) (for development purposes only) value can be "Q1" or "Q2", forces the response type for bookingCalendar key |
let apiName = 'auditorApi';
let path = '/opp';
let myInit = {
body: {
"oppId": "5cd251c14b7521fbf",
"payload": {
"description": "This is a test for PUT"
},
"dataKeys": "id,name,description",
"forceResponse": "Q2"
}
}
let respo = await API.put(apiName, path, myInit);
{
"id": "5cd251c14b7521fbf",
"name": "Kia Picanto Berline Gris",
"description": "This is a test for PUT",
"showExtraFormButton": true,
"prospectionArgumentsForPurchasingKeys": ["{general_0}", "{general_1}", "{general_2}", "{general_3}"],
"bookingCalendars":
[
{
"buttonText": "NAMUR",
"iframeLink": "https://somelink.com"
},
{
"buttonText": "BRUXELLES",
"iframeLink": "https://somelink2.com"
}
]
}
Creates an opportunity.
| Property | Description |
|---|---|
payload |
(required) an object with all the key:value pairs to update with the request |
dataKeys |
(optional) a list of the updated keys to return from the request. If not specified, only the id is returned |
let apiName = 'auditorApi';
let path = '/opp';
let myInit = {
body: {
"payload": {
"name": "My beautiful name is here",
"description": "This is a test for POST /opp"
},
"dataKeys": "id,name,description"
}
}
let respo = await API.post(apiName, path, myInit);
{
"id": "5cd251c14b7521fbf",
"name": "My beautiful name is here",
"description": "This is a test for POST /opp"
}
Request pricing for a specific opportunity
| Property | Description |
|---|---|
oppId |
(required) the id of the opportunity |
In case of failure, the statusCode header will be 500
let apiName = "auditorApi";
let path = "/price";
let myInit = {
queryStringParameters: {
"oppId": "5cd251c14b7521fbf"
},
}
let respo = await API.get(apiName, path, myInit);
{
"price": 14300,
"showExtraFormButton": true
}
{
"status": false,
"error": "The Opportunity could not be retrieved"
}
Request pricing for a specific opportunity
| Property | Description |
|---|---|
oppId |
(required) the id of the opportunity |
In case of success, the statusCode header will be 200
In case of failure, the statusCode header will be 500
let apiName = "auditorApi";
let path = "/priceAsde";
let myInit = {
queryStringParameters: {
"oppId": "5cd251c14b7521fbf"
},
}
let respo = await API.get(apiName, path, myInit);
{
"status": true,
"price": 5700,
"showExtraFormButton": true
}
{
"status": false,
"error": "Some error tracing indications"
}
Get a list of Select options for a given Make and Year
| Property | Description |
|---|---|
makeId |
(required) the id of the makeId |
year |
(required) the year of the car |
In case of failure, the statusCode header will be 500
let apiName = "auditorApi";
let path = "/modelComboOptions";
let myInit = {
queryStringParameters: {
"makeId": 13,
"year": 2008
},
}
let respo = await API.get(apiName, path, myInit);
[
{ "value": "18480_6_3", "label": "116 bodyId_6 3 door_plural" },
{ "value": "18480_6_5", "label": "116 bodyId_6 5 door_plural" },
{ "value": "1640_5_5", "label": "318 bodyId_5 5 door_plural" },
{ "value": "1640_6_4", "label": "318 bodyId_6 4 door_plural" },
{ "value": "1641_5_5", "label": "320 bodyId_5 5 door_plural" },
{ "value": "1641_6_4", "label": "320 bodyId_6 4 door_plural" },
{ "value": "1644_3_2", "label": "325 bodyId_3 2 door_plural" },
{ "value": "1644_5_5", "label": "325 bodyId_5 5 door_plural" },
{ "value": "1644_6_4", "label": "325 bodyId_6 4 door_plural" },
{ "value": "15779_2_2", "label": "330 bodyId_2 2 door_plural" },
{ "value": "15779_3_2", "label": "330 bodyId_3 2 door_plural" },
{ "value": "15779_5_5", "label": "330 bodyId_5 5 door_plural" },
{ "value": "15779_6_4", "label": "330 bodyId_6 4 door_plural" },
{ "value": "18805_2_2", "label": "335 bodyId_2 2 door_plural" },
{ "value": "18805_3_2", "label": "335 bodyId_3 2 door_plural" },
{ "value": "18805_5_5", "label": "335 bodyId_5 5 door_plural" },
{ "value": "18805_6_4", "label": "335 bodyId_6 4 door_plural" },
{ "value": "1651_5_5", "label": "525 bodyId_5 5 door_plural" },
{ "value": "1651_6_4", "label": "525 bodyId_6 4 door_plural" },
{ "value": "1652_5_5", "label": "530 bodyId_5 5 door_plural" },
{ "value": "1652_6_4", "label": "530 bodyId_6 4 door_plural" },
{ "value": "1646_6_4", "label": "M3 bodyId_6 4 door_plural" },
{ "value": "18387_4_5", "label": "X3 bodyId_4 5 door_plural" },
{ "value": "16406_4_5", "label": "X5 bodyId_4 5 door_plural" }
]
{
"status": false,
"message": "Error when getting data from database",
"trace": "Possible additional info about the error"
}
Get a list of Select options for a given Feature
| Property | Description |
|---|---|
requestedFeature |
(required) possible options are carFuel, carGearbox, carPowerKw |
modelComboId |
(required) combination id as received from GET /modelComboOptions |
year |
(required) the year of the car |
gearboxId |
(optional) can be given to narrow down the database query (values accepted are those returned by this endpoint) |
fuelId |
(optional) can be given to narrow down the database query (values accepted are those returned by this endpoint) |
powerKw |
(optional) can be given to narrow down the database query (values accepted are those returned by this endpoint) |
In case of failure, the statusCode header will be 500
let apiName = "auditorApi";
let path = "/modelFeaturesOptions";
let myInit = {
queryStringParameters: {
"requestedFeature": "carPowerKw",
"modelComboId": "1641_6_4",
"year": 2008
},
}
let respo = await API.get(apiName, path, myInit);
[ { "value": 120, "label": "163 Ch (120 kW)" },
{ "value": 125, "label": "170 Ch (125 kW)" },
{ "value": 130, "label": "177 Ch (130 kW)" } ]
{
"status": false,
"message": "Error when getting data from database",
"trace": "Possible additional info about the error"
}
| Property | Description |
|---|---|
oppId |
(required) the id of the opportunity |
In case of success, the statusCode header will be 200
In case of failure, the statusCode header will be 500
let apiName = "auditorApi";
let path = "/b2imageList";
let myInit = {
queryStringParameters: {
"oppId": "joujoujou"
},
}
let respo = await API.get(apiName, path, myInit);
[
{
"accountId": "08f051b452df",
"action": "upload",
"bucketId": "80a81f301531fbc475320d1f",
"contentLength": 18313,
"contentMd5": "1adb1742002aaf8f60edfe99299e0e91",
"contentSha1": "f21ea5041c3e97fe3cb8e5a39886bfb134fca767",
"contentType": "image/png",
"fileId": "4_z80a81f301531fbc475320d1f_f1035c499a1295b62_d20200818_m195314_c003_v0312000_t0021",
"fileInfo": {},
"fileName": "joujoujou/test_image.png",
"uploadTimestamp": 1597780394000
}
]
{
"status": false,
"error": "Some error tracing indications"
}
| Property | Description |
|---|---|
oppId |
(required) the id of the opportunity |
type |
(required) the MIME type of the image (ex : image/png or image/jpeg) |
imageName |
(required) name of the image with its extension |
file |
(required) the file encoded into a base64 string |
In case of success, the statusCode header will be 200
In case of failure, the statusCode header will be 500
let apiName = "auditorApi";
let path = "/b2image";
let myInit = {
body: {
"oppId": "joujoujou",
"type": "image/png",
"imageName": "test_image.png",
"file": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAPYQAAD2EBqD+(...)"
},
}
let respo = await API.post(apiName, path, myInit);
{
"status": false,
"error": "Some error tracing indications"
}
This API defines general purpose endpoints.
Send an email. Use case : contact form completed in front-end.
let apiName = 'auditorApi';
let path = '/email';
let myInit = {
body: {
"token": "some_auth_token",
"payload": {
"subject": "Email subject here",
"body": "Email body plain text here"
}
},
}
let respo = await API.post(apiName, path, myInit);
{
"status": false,
"error": "some_error_message"
}
{
"some_message_uuid_when_success"
}