{"_id":"543f8cb422a3b30e001bdb48","__v":5,"category":{"_id":"543b943865bf840e00b473b7","version":"543b943865bf840e00b473b6","project":"543b943865bf840e00b473b3","__v":15,"pages":["543ffb2c22a3b30e001bdc37","543b965fb1479b1400c42f3a","543d1cbb5276641a00a593c3","543d3ff2a10ab32000b3aa9e","543d1fa83a300f20000d3206","543f8f8a051bdc0e00dfbf02","543d4a17a10ab32000b3aace","543ea21f3f50eb1a00ed2050","543ea6ac3f50eb1a00ed205e","543ebaedcc182e08005d0cc4","543f8cb422a3b30e001bdb48","543f838422a3b30e001bdb36","544184629c7623200053c8e7","5541356a69a03a2d00ce0b3b"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-13T08:58:32.718Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"user":"543b93f865bf840e00b473b2","version":{"_id":"543b943865bf840e00b473b6","__v":5,"project":"543b943865bf840e00b473b3","createdAt":"2014-10-13T08:58:32.703Z","releaseDate":"2014-10-13T08:58:32.703Z","categories":["543b943865bf840e00b473b7","543b96e1b1479b1400c42f3d","543d1cdc3a300f20000d31ee","553e061924ec240d00b1f897","553e06431a946a0d00ad6f78"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"is_link":false,"project":"543b943865bf840e00b473b3","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-16T09:15:32.524Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":9,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Overview\"\n}\n[/block]\nIf you have read through any of the tutorials, you will have seen that many things to do with bridges, bridge-apps and adaptors are modified using the cb command on your Raspberry Pi.  This section contains a complete list of all the cb command options, together with some examples.\n\ncb commands are used to create, modify and delete bridges, bridge-apps and devices (which actually contain information about a device and its adaptor). All commands require a user name and password, which can be provided using the --user and --password options. If you leave out one or both of these, you will be prompted for them and when you are asked for your password it will not be visible on the screen.\n\nAll cb commands have the options --post, --patch and --get. Those associated with apps and devices also have --delete. Bridges cannot be deleted. You can only access things that you own, which basically means bridges, apps and devices that you have created in the first place.\n\nIn the following sections, we will leave off the --user and --password options, but they are available with all commands. For example, you can type:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"cb --bridge --post --user me:::at:::myself.com --password mypassword\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Bridge commands\"\n}\n[/block]\nAll these commands must be typed on the bridge itself, ie on the Raspberry Pi that you have installed cbridge on. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# To create a bridge. This makes the Raspberry Pi on which the command is typed into a bridge\\ncb --bridge post\\n\\n# To create a bridge and give it the name \\\"mybridge\\\"\\ncb --bridge post --name mybridge\\n\\n# To get details of a bridge:\\ncb --bridge get\\n\\n# To change the name of a bridge that you have already created\\ncb --bridge patch --name mybridge\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"thisbridge.sh\",\n  \"body\": \"Creating a bridge, using the post option, adds some information into /opt/cbridge/thisbridge/thisbridge.sh. This includes the key that the bridge uses to access the bridge controller, and hence the rest of the Internet. It is therefore important that you don't delete or modify these liines.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"App and device commands\"\n}\n[/block]\nThese need to be typed on the Raspberry Pi on which you have developed the code for the associated app or adaptor, or, in fact, any Linux machine with cbridge installed on which you have cloned the GitHub repository for the app or adaptor. Each command needs the config.json filename associated with the app or adaptor.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"What's a config.json file?\",\n  \"body\": \"See details in the sections on deploying apps and adaptors.\"\n}\n[/block]\nThe examples below are for an app, but the same commands apply to a device and its adaptor; just replace --app with --device.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# To create an app\\ncb --app post config.json\\n\\n# To modify an app (after changing config.json)\\ncb --app patch config.json\\n\\n# To get details of the app\\ncb --app get config.json\\n\\n# To delete the app\\ncb --app delete config.json\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Information in config.json\",\n  \"body\": \"When you create an app or device, some extra information is added to the config.json file. This is how cb knows how to access your app, so don't delete or alter it! The information is removed when you delete the app or device.\"\n}\n[/block]\n[Next ...](doc:hardware)","excerpt":"","slug":"the-cb-command","type":"basic","title":"The cb Command"}
[block:api-header] { "type": "basic", "title": "Overview" } [/block] If you have read through any of the tutorials, you will have seen that many things to do with bridges, bridge-apps and adaptors are modified using the cb command on your Raspberry Pi. This section contains a complete list of all the cb command options, together with some examples. cb commands are used to create, modify and delete bridges, bridge-apps and devices (which actually contain information about a device and its adaptor). All commands require a user name and password, which can be provided using the --user and --password options. If you leave out one or both of these, you will be prompted for them and when you are asked for your password it will not be visible on the screen. All cb commands have the options --post, --patch and --get. Those associated with apps and devices also have --delete. Bridges cannot be deleted. You can only access things that you own, which basically means bridges, apps and devices that you have created in the first place. In the following sections, we will leave off the --user and --password options, but they are available with all commands. For example, you can type: [block:code] { "codes": [ { "code": "cb --bridge --post --user me@myself.com --password mypassword", "language": "shell" } ] } [/block] [block:api-header] { "type": "basic", "title": "Bridge commands" } [/block] All these commands must be typed on the bridge itself, ie on the Raspberry Pi that you have installed cbridge on. [block:code] { "codes": [ { "code": "# To create a bridge. This makes the Raspberry Pi on which the command is typed into a bridge\ncb --bridge post\n\n# To create a bridge and give it the name \"mybridge\"\ncb --bridge post --name mybridge\n\n# To get details of a bridge:\ncb --bridge get\n\n# To change the name of a bridge that you have already created\ncb --bridge patch --name mybridge", "language": "shell" } ] } [/block] [block:callout] { "type": "warning", "title": "thisbridge.sh", "body": "Creating a bridge, using the post option, adds some information into /opt/cbridge/thisbridge/thisbridge.sh. This includes the key that the bridge uses to access the bridge controller, and hence the rest of the Internet. It is therefore important that you don't delete or modify these liines." } [/block] [block:api-header] { "type": "basic", "title": "App and device commands" } [/block] These need to be typed on the Raspberry Pi on which you have developed the code for the associated app or adaptor, or, in fact, any Linux machine with cbridge installed on which you have cloned the GitHub repository for the app or adaptor. Each command needs the config.json filename associated with the app or adaptor. [block:callout] { "type": "info", "title": "What's a config.json file?", "body": "See details in the sections on deploying apps and adaptors." } [/block] The examples below are for an app, but the same commands apply to a device and its adaptor; just replace --app with --device. [block:code] { "codes": [ { "code": "# To create an app\ncb --app post config.json\n\n# To modify an app (after changing config.json)\ncb --app patch config.json\n\n# To get details of the app\ncb --app get config.json\n\n# To delete the app\ncb --app delete config.json", "language": "shell" } ] } [/block] [block:callout] { "type": "warning", "title": "Information in config.json", "body": "When you create an app or device, some extra information is added to the config.json file. This is how cb knows how to access your app, so don't delete or alter it! The information is removed when you delete the app or device." } [/block] [Next ...](doc:hardware)