@@ -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
- ```text
98
- mutation AccountExample {
99
- uiapi {
100
- AccountCreate(input : {
101
- Account: {
102
- Name: "Trailblazer Express"
103
- }
104
- }) {
105
- Record {
106
- Id
107
- Name {
108
- value
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.0 /src/commands/api/request/graphql.ts)_
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 Salesforce API endpoint
129
+ ENDPOINT Salesforce API endpoint
135
130
136
131
FLAGS
137
- -H, --header=key: value ... HTTP header in "key: value " format.
138
- -S, --stream-to-file=Example: report.xlsx Stream responses to a file.
139
- -X, --method=<option > [ default: GET] HTTP method for the request.
140
- <options: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE>
141
- -i, --include Include the HTTP response status and headers in the output.
142
- -o, --target-org=<value > (required) Username or alias of the target org. Not required if the
143
- ` target-org ` configuration variable is already set.
144
- --api-version=<value > Override the api version used for api requests made by this command
145
- --body=file File to use as the body for the request. Specify "-" to read from standard
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 > Import flag values from a directory.
144
+ --flags-dir=<value> Import flag values from a directory.
150
145
151
146
EXAMPLES
152
-
153
- - List information about limits in the org with alias " my-org":
154
- sf api request rest 'limits' --target-org my-org
155
- - List all endpoints
156
- sf api request rest '/'
157
- - Get the response in XML format by specifying the "Accept" HTTP header:
158
- sf api request rest 'limits' --target-org my-org --header 'Accept: application/xml'
159
- - POST to create an Account object
160
- sf api request rest 'sobjects/account' --body "{ \" Name \" : \" Account from REST API \" , \" ShippingCity \" : \" Boise \" }" --method POST
161
- - or with a file 'info.json' containing
162
-
163
- ``` json
164
- {
165
- "Name" : " Demo " ,
166
- "ShippingCity" : " Boise "
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
- $ sf api request rest 'sobjects/account' --body info.json --method POST
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
- - Update object
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
```
0 commit comments