@@ -66,7 +66,7 @@ sf plugins
6666
6767Execute GraphQL statements
6868
69- ````
69+ ```
7070USAGE
7171 $ sf api request graphql -o <value> --body file [--json] [--flags-dir <value>] [--api-version <value>] [-S Example:
7272 report.xlsx | -i]
@@ -94,86 +94,78 @@ EXAMPLES
9494 - Runs the graphql query directly via the command line
9595 sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } } } } } } }"
9696 - 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+ }
109109 }
110110 }
111111 }
112112 }
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)
119115```
120116
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 ) _
122118
123119## ` sf api request rest ENDPOINT `
124120
125121Make an authenticated HTTP request to Salesforce REST API and print the response.
126122
127123```
128-
129124USAGE
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]
132127
133128ARGUMENTS
134- ENDPOINT Salesforce API endpoint
129+ ENDPOINT Salesforce API endpoint
135130
136131FLAGS
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.
147142
148143GLOBAL FLAGS
149- --flags-dir=<value > Import flag values from a directory.
144+ --flags-dir=<value> Import flag values from a directory.
150145
151146EXAMPLES
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
168163```
169164
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 ) _
171166
172- - Update object
173- sf api request rest 'sobjects/account/<Account ID >' --body "{\" BillingCity\" : \" San Francisco\" }" --method PATCH
167+ <!-- commandsstop -->
174168
175169```
176170
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 -->
179171```
0 commit comments