add json api to add a device