Webportal v2

embedded apps

    Quickstart - API Response

    VERBS #

    As seen before you can interact with the webportal by sending and receiving messages throught postMessage & onmessage.

    They are 3 different ways to interract with webportal! We call them verbs.

    Here is a description of theses 3 verbs:


    GET #

    GET type allow to request single time data from the webportal.

    Example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    // RESPONSE
    {
        "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
        "type": "REPLY",
        "api": "engine.totalMileage",
        "status": 200,
        "statusText": "OK",
        "data": 14285
    }
    

    This is the response when requesting the total mileage of a vehicle.


    SET #

    SET type allow to change a value or to setup an action depending on the API.

    Example:

    1
    2
    3
    4
    5
    6
    7
    
    // REQUEST
    {
        "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
        "type": "SET",
        "api": "configuration.consumptionUnit",
        "params": 1
    }
    

    Sending this request will modify the consumption unit in the vehicle HMI.


    SUBSCRIBE #

    SUBSCRIBE type allow to receive a notification when the data is modified.

    Example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    // NOTIFICATION
    {
        "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
        "type": "NOTIFY",
        "api": "app.visibilityState",
        "status": 200,
        "statusText": "OK",
        "data": {
            "appId": "com.example.app",
            "visibilityState": "visible" 
    }
    

    This is the notification event received when the visibility of your app change.