@salesforce/plugin-api 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -56
- package/messages/graphql.md +12 -14
- package/messages/rest.md +4 -6
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ sf plugins
|
|
|
66
66
|
|
|
67
67
|
Execute GraphQL statements
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
```
|
|
70
70
|
USAGE
|
|
71
71
|
$ sf api request graphql -o <value> --body file [--json] [--flags-dir <value>] [--api-version <value>] [-S Example:
|
|
72
72
|
report.xlsx | -i]
|
|
@@ -94,86 +94,78 @@ EXAMPLES
|
|
|
94
94
|
- Runs the graphql query directly via the command line
|
|
95
95
|
sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } } } } } } }"
|
|
96
96
|
- Runs a mutation to create an Account, with an `example.txt` file, containing
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
mutation AccountExample{
|
|
98
|
+
uiapi {
|
|
99
|
+
AccountCreate(input: {
|
|
100
|
+
Account: {
|
|
101
|
+
Name: "Trailblazer Express"
|
|
102
|
+
}
|
|
103
|
+
}) {
|
|
104
|
+
Record {
|
|
105
|
+
Id
|
|
106
|
+
Name {
|
|
107
|
+
value
|
|
108
|
+
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
$ sf api request graphql --body example.txt
|
|
117
|
-
will create a new account returning specified fields (Id, Name)
|
|
118
|
-
|
|
113
|
+
$ sf api request graphql --body example.txt
|
|
114
|
+
will create a new account returning specified fields (Id, Name)
|
|
119
115
|
```
|
|
120
116
|
|
|
121
|
-
_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.
|
|
117
|
+
_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/graphql.ts)_
|
|
122
118
|
|
|
123
119
|
## `sf api request rest ENDPOINT`
|
|
124
120
|
|
|
125
121
|
Make an authenticated HTTP request to Salesforce REST API and print the response.
|
|
126
122
|
|
|
127
123
|
```
|
|
128
|
-
|
|
129
124
|
USAGE
|
|
130
|
-
$ sf api request rest ENDPOINT -o <value> [--flags-dir <value>] [--api-version <value>] [-i | -S Example:
|
|
131
|
-
report.xlsx] [-X GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [--body file]
|
|
125
|
+
$ sf api request rest ENDPOINT -o <value> [--flags-dir <value>] [--api-version <value>] [-i | -S Example:
|
|
126
|
+
report.xlsx] [-X GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [--body file]
|
|
132
127
|
|
|
133
128
|
ARGUMENTS
|
|
134
|
-
ENDPOINT
|
|
129
|
+
ENDPOINT Salesforce API endpoint
|
|
135
130
|
|
|
136
131
|
FLAGS
|
|
137
|
-
-H, --header=key:value...
|
|
138
|
-
-S, --stream-to-file=Example: report.xlsx
|
|
139
|
-
-X, --method=<option>
|
|
140
|
-
<options: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE>
|
|
141
|
-
-i, --include
|
|
142
|
-
-o, --target-org=<value>
|
|
143
|
-
`target-org` configuration variable is already set.
|
|
144
|
-
--api-version=<value>
|
|
145
|
-
--body=file
|
|
146
|
-
input; specify "" for an empty body.
|
|
132
|
+
-H, --header=key:value... HTTP header in "key:value" format.
|
|
133
|
+
-S, --stream-to-file=Example: report.xlsx Stream responses to a file.
|
|
134
|
+
-X, --method=<option> [default: GET] HTTP method for the request.
|
|
135
|
+
<options: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE>
|
|
136
|
+
-i, --include Include the HTTP response status and headers in the output.
|
|
137
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
|
|
138
|
+
`target-org` configuration variable is already set.
|
|
139
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
140
|
+
--body=file File to use as the body for the request. Specify "-" to read from standard
|
|
141
|
+
input; specify "" for an empty body.
|
|
147
142
|
|
|
148
143
|
GLOBAL FLAGS
|
|
149
|
-
--flags-dir=<value>
|
|
144
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
150
145
|
|
|
151
146
|
EXAMPLES
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
147
|
+
- List information about limits in the org with alias "my-org":
|
|
148
|
+
sf api request rest 'limits' --target-org my-org
|
|
149
|
+
- List all endpoints
|
|
150
|
+
sf api request rest '/'
|
|
151
|
+
- Get the response in XML format by specifying the "Accept" HTTP header:
|
|
152
|
+
sf api request rest 'limits' --target-org my-org --header 'Accept: application/xml'
|
|
153
|
+
- POST to create an Account object
|
|
154
|
+
sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
|
|
155
|
+
- or with a file 'info.json' containing
|
|
156
|
+
{
|
|
157
|
+
"Name": "Demo",
|
|
158
|
+
"ShippingCity": "Boise"
|
|
159
|
+
}
|
|
160
|
+
$ sf api request rest 'sobjects/account' --body info.json --method POST
|
|
161
|
+
- Update object
|
|
162
|
+
sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
|
|
168
163
|
```
|
|
169
164
|
|
|
170
|
-
|
|
165
|
+
_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/rest.ts)_
|
|
171
166
|
|
|
172
|
-
|
|
173
|
-
sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
|
|
167
|
+
<!-- commandsstop -->
|
|
174
168
|
|
|
175
169
|
```
|
|
176
170
|
|
|
177
|
-
_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.0/src/commands/api/request/rest.ts)_
|
|
178
|
-
<!-- commandsstop -->
|
|
179
171
|
```
|
package/messages/graphql.md
CHANGED
|
@@ -14,24 +14,22 @@ Run any valid GraphQL statement via the /graphql [API](https://developer.salesfo
|
|
|
14
14
|
|
|
15
15
|
- Runs a mutation to create an Account, with an `example.txt` file, containing
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
mutation AccountExample{
|
|
18
|
+
uiapi {
|
|
19
|
+
AccountCreate(input: {
|
|
20
|
+
Account: {
|
|
21
|
+
Name: "Trailblazer Express"
|
|
22
|
+
}
|
|
23
|
+
}) {
|
|
24
|
+
Record {
|
|
25
|
+
Id
|
|
26
|
+
Name {
|
|
27
|
+
value
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
33
|
|
|
36
34
|
<%= config.bin %> <%= command.id %> --body example.txt
|
|
37
35
|
|
package/messages/rest.md
CHANGED
|
@@ -22,12 +22,10 @@ Make an authenticated HTTP request to Salesforce REST API and print the response
|
|
|
22
22
|
|
|
23
23
|
- or with a file 'info.json' containing
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
```
|
|
25
|
+
{
|
|
26
|
+
"Name": "Demo",
|
|
27
|
+
"ShippingCity": "Boise"
|
|
28
|
+
}
|
|
31
29
|
|
|
32
30
|
<%= config.bin %> <%= command.id %> 'sobjects/account' --body info.json --method POST
|
|
33
31
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@salesforce/plugin-api",
|
|
9
|
-
"version": "1.2.
|
|
9
|
+
"version": "1.2.1",
|
|
10
10
|
"license": "BSD-3-Clause",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@oclif/core": "^4",
|
package/oclif.manifest.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"args": {},
|
|
6
6
|
"description": "Run any valid GraphQL statement via the /graphql [API](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html)",
|
|
7
7
|
"examples": [
|
|
8
|
-
"- Runs the graphql query directly via the command line\n\n <%= config.bin %> <%= command.id %> --body \"query accounts { uiapi { query { Account { edges { node { Id \\n Name { value } } } } } } }\"\n\n- Runs a mutation to create an Account, with an `example.txt` file, containing\n\n
|
|
8
|
+
"- Runs the graphql query directly via the command line\n\n <%= config.bin %> <%= command.id %> --body \"query accounts { uiapi { query { Account { edges { node { Id \\n Name { value } } } } } } }\"\n\n- Runs a mutation to create an Account, with an `example.txt` file, containing\n\n mutation AccountExample{\n uiapi {\n AccountCreate(input: {\n Account: {\n Name: \"Trailblazer Express\"\n }\n }) {\n Record {\n Id\n Name {\n value\n }\n }\n }\n }\n }\n\n<%= config.bin %> <%= command.id %> --body example.txt\n\nwill create a new account returning specified fields (Id, Name)"
|
|
9
9
|
],
|
|
10
10
|
"flags": {
|
|
11
11
|
"json": {
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"examples": [
|
|
113
|
-
"- List information about limits in the org with alias \"my-org\":\n\n <%= config.bin %> <%= command.id %> 'limits' --target-org my-org\n\n- List all endpoints\n\n <%= config.bin %> <%= command.id %> '/'\n\n- Get the response in XML format by specifying the \"Accept\" HTTP header:\n\n <%= config.bin %> <%= command.id %> 'limits' --target-org my-org --header 'Accept: application/xml'\n\n- POST to create an Account object\n\n <%= config.bin %> <%= command.id %> 'sobjects/account' --body \"{\\\"Name\\\" : \\\"Account from REST API\\\",\\\"ShippingCity\\\" : \\\"Boise\\\"}\" --method POST\n\n- or with a file 'info.json' containing\n\n
|
|
113
|
+
"- List information about limits in the org with alias \"my-org\":\n\n <%= config.bin %> <%= command.id %> 'limits' --target-org my-org\n\n- List all endpoints\n\n <%= config.bin %> <%= command.id %> '/'\n\n- Get the response in XML format by specifying the \"Accept\" HTTP header:\n\n <%= config.bin %> <%= command.id %> 'limits' --target-org my-org --header 'Accept: application/xml'\n\n- POST to create an Account object\n\n <%= config.bin %> <%= command.id %> 'sobjects/account' --body \"{\\\"Name\\\" : \\\"Account from REST API\\\",\\\"ShippingCity\\\" : \\\"Boise\\\"}\" --method POST\n\n- or with a file 'info.json' containing\n\n {\n \"Name\": \"Demo\",\n \"ShippingCity\": \"Boise\"\n }\n\n<%= config.bin %> <%= command.id %> 'sobjects/account' --body info.json --method POST\n\n- Update object\n\n <%= config.bin %> <%= command.id %> 'sobjects/account/<Account ID>' --body \"{\\\"BillingCity\\\": \\\"San Francisco\\\"}\" --method PATCH"
|
|
114
114
|
],
|
|
115
115
|
"flags": {
|
|
116
116
|
"flags-dir": {
|
|
@@ -226,5 +226,5 @@
|
|
|
226
226
|
]
|
|
227
227
|
}
|
|
228
228
|
},
|
|
229
|
-
"version": "1.2.
|
|
229
|
+
"version": "1.2.1"
|
|
230
230
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-api",
|
|
3
3
|
"description": "A plugin to call API endpoints via CLI commands",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
"exports": "./lib/index.js",
|
|
203
203
|
"type": "module",
|
|
204
204
|
"sfdx": {
|
|
205
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-api/1.2.
|
|
206
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-api/1.2.
|
|
205
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-api/1.2.1.crt",
|
|
206
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-api/1.2.1.sig"
|
|
207
207
|
}
|
|
208
208
|
}
|