You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Thunder plugin API jsonrpc interface schema

Schema defintion: https://github.com/rdkcentral/Thunder/blob/master/Tools/JsonGenerator/schemas/interface.schema.json

Other plugins examples: https://github.com/rdkcentral/ThunderInterfaces/tree/master/jsonrpc

API below was defined at design stage. During implementation few changes were made. We need to double check if all changes were reflected here. 

Lisa jsonrpc API schema
{
  "$schema": "interface.schema.json",
  "jsonrpc": "2.0",
  "info": {
    "title": "Lisa API",
    "class": "Lisa",
    "description": "Lisa JSON-RPC interface"
  },
  "common": {
    "$ref": "common.json"
  },
  "methods": {
    "install": {
      "summary": "Install application",
      "description": "Download the application bundle tarball from the given URL, unpack files to dedicated directory, create the db entries and persistent storage on success. Asynchronous operation, handle should be used for tracking the request.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification)",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application",
            "type": "string",
            "example": "1.0.0"
          },
          "url": {
            "description": "The url from which the application's bundle should be downloaded",
            "type": "string",
            "example": "https://com.libertyglobal.app.awesome/1.2.3/cascadelake/502.54.1/com.libertyglobal.app.awesome_1.2.3_cascadelake_502.54.1.tar.gz"
          },
          "appName": {
            "description": "Application name",
            "type": "string",
            "example": "Awesome Application"
          },
          "category": {
            "description": "category of the application",
            "type": "string",
            "example": "application"
          }
        },
        "required": [
          "type",
          "id",
          "version",
          "url",
          "appName"
        ]
      },
      "result": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "example": "a76a9ad56769634dbbc9c54bac15ddb9"
          }
        },
        "required": [
          "handle"
        ]
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "TooManyRequests",
          "code": 1002,
          "message": "Too many requests (e.g. another installation is ongoing)"
        },
        {
          "description": "AlreadyInstalled",
          "code": 1003,
          "message": "Application is already installed, uninstall first"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": " LISA is performing initialization, wait for operationStatus event"
        }
      ]
    },
    "uninstall": {
      "summary": "Uninstall the application",
      "description": "Uninstall the application: remove application files and - optionally - persistent storage and db entry. Non-blocking operation, handle should be used for tracking the request.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification)",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application",
            "type": "string",
            "example": "1.0.0"
          },
          "uninstallType": {
            "description": "Whethere or not the persistent storage for given application should be deleted",
            "type": "string",
            "enum": [
              "full",
              "upgrade"
            ]
          }
        },
        "required": [
          "type",
          "id",
          "version",
          "uninstallType"
        ]
      },
      "result": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "example": "a76a9ad56769634dbbc9c54bac15ddb9"
          }
        },
        "required": [
          "handle"
        ]
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "TooManyRequests",
          "code": 1002,
          "message": "Too many requests (e.g. another installation is ongoing)"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": " LISA is performing initialization, wait for operationStatus event"
        }
      ]
    },
    "download": {
      "summary": "Download arbitrary application's resource file",
      "description": "Download arbitrary application's resource, e.g. icon. Resource are stored per application id/version. Asynchronous operation, handle should be used for tracking the request. If the resource of given resKey already exists it is replaced by the newly downloaded resource. If the resKey is unique, but the requested resource file already exists on the filesystem, the file should be stored under a different, unique filename, created by appending a suffix to the existing filename.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification)",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application",
            "type": "string",
            "example": "1.0.0"
          },
          "resKey": {
            "description": "resource key referencing given downloaded resource",
            "type": "string",
            "example": "icon_1920x1080"
          },
          "url": {
            "description": "The url from which the application resource should be downloaded",
            "type": "string",
            "example": "https://libertyglobal.com/s/apps/com.libertyglobal.app.awesome/1.2.3/image/1920x1080/icon.png"
          }
        },
        "required": [
          "type",
          "id",
          "version",
          "resKey",
          "url"
        ]
      },
      "result": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "example": "a76a9ad56769634dbbc9c54bac15ddb9"
          }
        },
        "required": [
          "handle"
        ]
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "TooManyRequests",
          "code": 1002,
          "message": "Too many requests (e.g. another installation is ongoing)"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": " LISA is performing initialization, wait for operationStatus event"
        }
      ]
    },
    "reset": {
      "summary": "Deleted persistent data stored locally",
      "description": "Deletes the content of the database and/or persistent storage and/or all resources for the application. Synchronous operation, returns response on success or failure. Optional parameters type, id, version are used to filter the applications on which the reset will be performed. If they are not given, the reset operation affects all the data.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki.",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification)",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application; parameter is required only when resetType=resources",
            "type": "string",
            "example": "1.0.0"
          },
          "resetType": {
            "description": "type of reset reqeusted; remove all the data stored locally, remove application\\'s persistent storage, remove application\\'s resources",
            "type": "string",
            "enum": [
              "full",
              "storage",
              "resources"
            ]
          }
        },
        "required": [
          "resetType"
        ]
      },
      "result": {
        "type": "object",
        "properties": {}
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": " LISA is performing initialization, wait for operationStatus event"
        },
        {
          "description": "FilesystemError",
          "code": 1005,
          "message": "File operation failed"
        }
      ]
    },
    "getStorageDetails": {
      "summary": "Information on the storage usage.",
      "description": "Returns information on the storage usage. Depending on provided parameters: overall storage usage, application id storage or application id/version storage.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki. This filtering parameter is logically ANDed with the other optional parameters if they are provided.",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification); can be only present if \"type\" parameter is also provided. This filtering parameter is logically ANDed with the other optional parameters if they are provided.",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application; can be only present if \"type\" and \"id\" parameters are also provided. This filtering parameter is logically ANDed with the other parameters.",
            "type": "string",
            "example": "1.0.0"
          }
        },
        "required": []
      },
      "result": {
        "type": "object",
        "properties": {
          "storage": {
            "type": "object",
            "properties": {
              "apps": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "example": "1/dac.native/com.libertyglobal.app.awesome/data"
                  },
                  "quotaKB": {
                    "type": "string",
                    "example": "1024"
                  },
                  "usedKB": {
                    "type": "string",
                    "example": "321"
                  }
                },
                "required": [
                  "path",
                  "usedKB"
                ]
              },
              "persistent": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "example": "1/dac.native/com.libertyglobal.app.awesome/data"
                  },
                  "quotaKB": {
                    "type": "string",
                    "example": "1024"
                  },
                  "usedKB": {
                    "type": "string",
                    "example": "321"
                  }
                },
                "required": [
                  "path",
                  "usedKB"
                ]
              }
            },
            "required": [
              "apps",
              "persistent"
            ]
          }
        },
        "required": [
          "status",
          "storage"
        ]
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": " LISA is performing initialization, wait for operationStatus event"
        },
        {
          "description": "FilesystemError",
          "code": 1005,
          "message": "File operation failed"
        }
      ]
    },
    "getList": {
      "summary": "List installed applications.",
      "description": "Returns a list of installed applications filtered using optional filtering criteria: type, id, version, appName, category.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki. This filtering parameter is logically ANDed with the other optional parameters if they are provided.",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification); This filtering parameter is logically ANDed with the other optional parameters if they are provided.",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application; This filtering parameter is logically ANDed with the other parameters.",
            "type": "string",
            "example": "1.0.0"
          },
          "appName": {
            "description": "Application name; This filtering parameter is logically ANDed with the other parameters.",
            "type": "string",
            "example": "Awesome Application"
          },
          "category": {
            "description": "category of the application; This filtering parameter is logically ANDed with the other parameters.",
            "type": "string",
            "example": "application"
          }
        },
        "required": []
      },
      "result": {
        "type": "object",
        "properties": {
          "apps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "example": "application"
                },
                "id": {
                  "type": "string",
                  "example": "com.libertyglobal.app.awesome"
                },
                "installed": {
                  "description": "Array of actually installed applications of given type/id.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "string",
                        "example": "1.0.0"
                      },
                      "appName": {
                        "type": "string",
                        "example": "Awesome Application"
                      },
                      "category": {
                        "type": "string",
                        "example": "application"
                      },
                      "url": {
                        "type": "string",
                        "example": "https://com.libertyglobal.app.awesome/1.2.3/cascadelake/502.54.1/com.libertyglobal.app.awesome_1.2.3_cascadelake_502.54.1.tar.gz"
                      }
                    },
                    "required": [
                      "version",
                      "url",
                      "appName"
                    ]
                  }
                }
              },
              "required": [
                "type",
                "id",
                "installed"
              ]
            }
          }
        },
        "required": [
          "apps"
        ]
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": " LISA is performing initialization, wait for operationStatus event"
        }
      ]
    },
    "setAuxMetadata": {
      "summary": "Set an arbitrary metadata.",
      "description": "Set an arbitrary key: value metadata for a given application. The existing metadata object is replaced (overwritten) by the provided object.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki.",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification);",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application;",
            "type": "string",
            "example": "1.0.0"
          },
          "auxMetadata": {
            "description": "Dictionary containing arbitrary key: value metadata.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "example": "description"
                },
                "value": {
                  "type": "string",
                  "example": "Application for having a great fun."
                }
              },
              "required": [
                "key",
                "value"
              ]
            }
          }
        },
        "required": [
          "type",
          "id",
          "version",
          "metadata"
        ]
      },
      "result": {
        "type": "object",
        "properties": {},
        "required": []
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": "LISA is performing initialization, wait for operationStatus event"
        },
        {
          "description": "WrongMetadata",
          "code": 1006,
          "message": "Wrong format of metadata object"
        }
      ]
    },
    "getMetadata": {
      "summary": "Get application metadata.",
      "description": "Get all metadata stored for given application version. Synchronous operation, returns a response on success or failure.",
      "params": {
        "type": "object",
        "properties": {
          "type": {
            "description": "MIME type of the application, see [DAC Application Types](https://wiki.rdkcentral.com/display/ASP/DAC+Application+Types) in RDK wiki.",
            "type": "string",
            "enum": [
              "application/vnd.rdk-app.dac.native"
            ]
          },
          "id": {
            "description": "id of the application, assumed reverse domain name notation, the id should match the [ASMS application id](https://wikiprojects.upc.biz/display/SPARK/ASMS+API+specification);",
            "type": "string",
            "example": "com.libertyglobal.app.awesome"
          },
          "version": {
            "description": "version of the application;",
            "type": "string",
            "example": "1.0.0"
          }
        },
        "required": [
          "type",
          "id",
          "version"
        ]
      },
      "result": {
        "type": "object",
        "properties": {
          "metadata": {
            "type": "object",
            "properties": {
              "appName": {
                "type": "string",
                "example": "Awesome Application"
              },
              "category": {
                "type": "string",
                "example": "application"
              },
              "url": {
                "type": "string",
                "example": "https://com.libertyglobal.app.awesome/1.2.3/cascadelake/502.54.1/com.libertyglobal.app.awesome_1.2.3_cascadelake_502.54.1.tar.gz"
              },
              "resources": {
                "description": "Dictionary containing all resources downloaded as resKey: fileName within application storage (as returned by getStorageDetails).",
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "example": "icon_1920x1080:\"res/icon.png\" icon_1280x720:\"res/icon1.png\""
              },
              "auxMetadata": {
                "description": "Dictionary containing arbitrary key: value metadata.",
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "example": "loc_appName:\"Świetna Aplikacja\" description:\"Application for having a great fun.\" rating:\"7\""
              }
            },
            "required": [
              "appName",
              "url",
              "resources",
              "auxMetadata"
            ]
          }
        },
        "required": [
          "metadata"
        ]
      },
      "errors": [
        {
          "description": "WrongParams",
          "code": 1001,
          "message": "Request not accepted because of wrong parameters"
        },
        {
          "description": "Initializing",
          "code": 1004,
          "message": "LISA is performing initialization, wait for operationStatus event"
        }
      ]
    },
    "cancel": {
      "summary": "Cancel asynchronous request.",
      "description": "Cancel previous asynchronous request.",
      "params": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "example": "a76a9ad56769634dbbc9c54bac15ddb9"
          }
        },
        "required": [
          "handle"
        ]
      },
      "result": {
        "type": "object",
        "properties": {},
        "required": []
      },
      "errors": [
        {
          "description": "WrongHandle",
          "code": 1007,
          "message": "The handle is not correct, e.g. the operation has finished."
        },
        {
          "description": "Error",
          "code": 1008,
          "message": "operation cannot be canceled"
        }
      ]
    },
    "getProgress": {
      "summary": "Estimated progress of a request.",
      "description": "Get estimated progress of an asynchronous operation.",
      "params": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "example": "a76a9ad56769634dbbc9c54bac15ddb9"
          }
        },
        "required": [
          "handle"
        ]
      },
      "result": {
        "type": "object",
        "properties": {
          "progress": {
            "description": "progress in percents",
            "type": "number",
            "example": 75
          }
        },
        "required": [
          "progress"
        ]
      },
      "errors": [
        {
          "description": "WrongHandle",
          "code": 1007,
          "message": "The handle is not correct, e.g. the operation has finished."
        }
      ]
    }
  },
  "events": {
    "operationStatus": {
      "summary": "Completion of asynchronous operation.",
      "description": "Notification sent on the completion of asynchronous operation.",
      "params": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "example": "4c4712a4141d261ec0ca8f9037950685"
          },
          "status": {
            "type": "string",
            "enum": [
              "Success",
              "Failed"
            ]
          },
          "details": {
            "type": "string",
            "example": "Downloaded 2342 KB, unpacked 3233 KB"
          }
        },
        "required": [
          "handle",
          "status"
        ]
      }
    }
  }
}

Swagger representation 

The following Swagger representation is for reference only. API implementation should follow the json schema.

lisa-api-0.2.0.yaml

Would be good if RDK wiki had support from openapi plugin, then nice api representation of yaml file would be automatically readable in this wiki.

Now we cannot show this and best is to open yaml file  https://editor.swagger.io/


Actual API - Interface implementation

Actual Thunder interface definition/api in defined in dual COM RPC / JSON- RPC interface in https://github.com/rdkcentral/ThunderInterfaces/blob/R2/interfaces/ILISA.h with annotations to automatically autogenerate* from c interface file the JSON RPC api using Thunder autogenerator tooling at build time.


eg AUTO generated JSON API file can be found in your yocto build artifacts eg  

/build-brcm972127ott-refboard/tmp/work/armv7vet2hf-neon-vfpv4-rdkmllib32-linux-gnueabi/lib32-wpeframework-interfaces/rdkv-2022q3+gitAUTOINC+f61d710cc5-r0/build/definitions/generated/JsonData_LISA.h

JsonData_LISA.h is from December8


/build-brcm972127ott-refboard/tmp/work/armv7vet2hf-neon-vfpv4-rdkmllib32-linux-gnueabi/lib32-wpeframework-interfaces/rdkv-2022q3+gitAUTOINC+f61d710cc5-r0/build/interfaces/generated/ProxyStubs_LISA.cpp

ProxyStubs_LISA.cpp


However, we found out that this Thunder autogenerator has some issues/restrictions. For example you will not find UnlockParamsData for the unlock function but in reality it is there. That is because another object was already generated before with the same properties inside -> CancelParamsInfo

you can see how this was handled in LISA code. Look for "JsonGenerator" here: https://github.com/stagingrdkm/LISA/blob/main/LISA/LISAJsonRpc.cpp



  • No labels