This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 39
apis
Marcel Kloubert edited this page Mar 16, 2018
·
27 revisions
The extension can run one more REST API hosts.
This can be useful, if something should control an editor from remote, e.g. a build operation, which runs on a server, shows a popup, when its done.
A list of endpoints (with examples) can be found here.
{
"deploy.reloaded": {
"apis": {
"80": {
"allowed": [
"192.168.0.0/24",
"0:0:0:0:0:ffff:c0a8:0/24"
],
"users": {
"mkloubert": "P@ssword123!"
}
}
}
}
}
Name | Description |
---|---|
allowed |
One or more allowed IP addresses in CIDR format. |
autoStart |
Auto start host or not. Default: (true)
|
realm |
The custom name of the real for basic authentification. Default: vscode-deploy-reloaded API
|
ssl |
Settings for secure HTTP. |
users |
One or more user to define. |
{
"deploy.reloaded": {
"apis": {
"443": {
"ssl": {
"cert": "./cert.pem",
"key": "./key.pem"
}
}
}
}
}
Name | Description |
---|---|
ca *
|
The path to the ca file. |
cert *
|
The path to the file of the certificate. |
key *
|
The path to the key file. |
passphrase |
The required password for the key file. |
rejectUnauthorized |
Request unauthorized or not. Default: (true)
|
* supports placeholders
Relative paths are mapped to the .vscode
folder or the sub folder .vscode-deploy-reloaded
inside the user's home directory.
{
"deploy.reloaded": {
"apis": {
"443": {
"users": {
"mk": "P@assword!123",
"tm": {
"password": "@notherPassword123!"
}
}
}
}
}
}
Name | Description |
---|---|
isActive |
Is user active or not. Default: (true)
|
password |
The password to use. |
Returns general information.
GET /api HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
X-Powered-By: Express
Content-type: application/json; charset=utf-8
Content-Length: 324
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive
{
"success": true,
"code": 0,
"host": {
"os": "win32"
},
"me": {
"address": "::ffff:127.0.0.1",
"port": 5979
},
"message": "OK",
"vscode": {
"eol": "\r\n",
"name": "Visual Studio Code",
"node": {
"v8": "5.8.283.38",
"version": "7.9.0"
},
"version": "1.21.1"
}
}
Returns a list of all commands.
GET /api/commands HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
X-Powered-By: Express
Content-type: application/json; charset=utf-8
Content-Length: 120
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive
{
"success": true,
"code": 0,
"message": "OK",
"data": [
"editor.action.selectAll",
"git.pull"
]
}
Executes a command.
GET /api/commands/editor.action.selectAll HTTP/1.1
Host: localhost
HTTP/1.1 204 No Content
X-Powered-By: Express
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive
Returns a list of all editors.
GET /api/editors HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
X-Powered-By: Express
Content-type: application/json; charset=utf-8
Content-Length: 233
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive
{
"success": true,
"code": 0,
"message": "OK",
"data": [
{
"index": 0,
"isActive": true,
"document": {
"eol": "\r\n",
"file": {
"name": "ltotm.txt",
"path": "c:\\my-project"
},
"isDirty": false,
"language": "jsonc",
"lines": 39,
"resources": {
"_self": "/api/editors/0",
"content": "/api/editors/0/content"
},
"version": 1
}
}
]
}
Returns information about an editor.
GET /api/editors/0 HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
X-Powered-By: Express
Content-type: application/json; charset=utf-8
Content-Length: 231
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive
{
"success": true,
"code": 0,
"message": "OK",
"data": {
"index": 0,
"isActive": true,
"document": {
"eol": "\n",
"file": {
"name": "ltotm.txt",
"path": "/home/mkloubert/my-project"
},
"isDirty": false,
"language": "jsonc",
"lines": 39,
"resources": {
"_self": "/api/editors/0",
"content": "/api/editors/0/content"
},
"version": 1
}
}
}
Returns the content of an editor.
GET /api/editors/0/content HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
X-Powered-By: Express
Content-type: text/plain; charset=utf-8
X-Vscode-Deploy-Reloaded-Lang: plaintext
Content-Length: 889
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Shows a popup in the remote editor.
POST /api/messages HTTP/1.1
Host: localhost
{
"message": "Test message",
"type": "error"
}
Possible values for type
, which is optional, are:
-
e
,err
,error
-
i
,info
,information
-
w
,warn
,warning
HTTP/1.1 204 No Content
X-Powered-By: Express
Date: Wed, 5 Sep 1979 23:09:00 GMT
Connection: keep-alive