Skip to content

Endpoints

Mathieu edited this page May 24, 2022 · 20 revisions

Documentation Postman

It's also possible to obtain the documentation generated by postman here. This documentation provides the quick option to test the request via the postman application.

Overview

endpoints_diagram_1

Clients section

This section applies for clients endpoints.

[GET] Clients

//Method type : [GET]
/clients/

Return Json of every client

[Get] Client

//Method type : [GET]
/clients/:id

Return Json of a specify client by its ID.

[Post] Create

This method allows you to create a new client.

//Method type : [POST]
/clients/create

Non-nullable parameters :

@IsEmail()
email: string;

@IsNotEmpty()
firstname: string;

@IsNotEmpty()
lastname: string;

Products section

This section applies for products endpoints.

[GET] Products

//Method type : [GET]
/products/

Return Json of every product

[GET] Product

//Method type : [GET]
/products/:id

Return Json of a specify product by its ID.

[Post] Create

This method allows you to create a new product.

//Method type : [POST]
/products/create

Non-nullable parameters :

@IsNotEmpty()
name: string;
published: boolean;
qrcode: string;

@IsNumber()
price: Decimal;

@IsDate()
warrantyExpiresOn: Date;

[Post] Extend warranty

This method allows you to exetend a product's warranty.

//Method type : [POST]
/products/warranty/extend/

Non-nullable parameters :

  @IsNotEmpty()
  id: string;

  @IsNumber()
  delay: number;

[Post] Retrieve a product

This method allows you to retrieve a product for a specify user.

//Method type : [POST]
/products/retrieve/

Non-nullable parameters :

@IsNotEmpty()
qrcode: string;

@IsNotEmpty()
ownerId: string;

Event section

[GET] Events

//Method type : [GET]
/events/

Return Json of every event

[GET] Event

//Method type : [GET]
/events/:id

Return Json of a specify event by its ID.

[Post] Create

This method allows you to create a new event.

//Method type : [POST]
/events/create

Non-nullable parameters :

@IsNotEmpty()
content: string;

@IsNotEmpty()
productId: string;

@IsNotEmpty()
eventTypeId: string;

[Post] Create commercial event

This method allows you to create a new event that oriented as commercial event.

//Method type : [POST]
/events/commercials/create

Non-nullable parameters :

@IsNotEmpty()
content: string;

@IsNotEmpty()
productId: string;

@IsNotEmpty()
eventTypeContent: string;

@IsNotEmpty()
action: Decimal;

@IsNotEmpty()
shall_expire_on: Date;

The two differences is the values action and shall_expire_on.

shall_expire_on is curently used to set an expiration date to the commercial event. Even if the event shall be immuable, an commercial event could be out dated.

The action is generally an number (pourcentage), please read the action list that are provided by the eventTypeContent.

Example d'utilisation :

{
    "content": "Votre garantie peut-être étendue de 20% !",
    "productId": "cl39u8d0b0000rof1cxbkaeq4",
    "eventTypeContent": "COMMERCIAL_WARRANTY_EXTENDED",
    "action": 20,
    "shall_expire_on": "2024-05-12T07:36:42.722Z"
}

Blockchains section

This section applies for blockchains endpoints.

[GET] Found blockchain transactions

//Method type : [GET]
/blockchains/transactions/:id

Return Json of every transactions made by an product id

[Get] Generate keys

Warning, this is an dev option ! More details here.

//Method type : [GET]
/blockchains/generate-keys

Return Json of a specify client by its ID.

Clone this wiki locally