Skip to content

Commit

Permalink
chore(release): 1.2.1 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-cli-bot committed Aug 27, 2024
1 parent 88fb676 commit 2290a88
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 57 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.2.1](/~https://github.com/salesforcecli/plugin-api/compare/1.2.0...1.2.1) (2024-08-27)

### Bug Fixes

- remove code block from examples ([0aa98ba](/~https://github.com/salesforcecli/plugin-api/commit/0aa98ba9a87870750be4d02c936be460ddb14cdc))

# [1.2.0](/~https://github.com/salesforcecli/plugin-api/compare/1.1.0...1.2.0) (2024-08-22)

### Features
Expand Down
104 changes: 48 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ sf plugins

Execute GraphQL statements

````
```
USAGE
$ sf api request graphql -o <value> --body file [--json] [--flags-dir <value>] [--api-version <value>] [-S Example:
report.xlsx | -i]
Expand Down Expand Up @@ -94,86 +94,78 @@ EXAMPLES
- Runs the graphql query directly via the command line
sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } } } } } } }"
- Runs a mutation to create an Account, with an `example.txt` file, containing
```text
mutation AccountExample{
uiapi {
AccountCreate(input: {
Account: {
Name: "Trailblazer Express"
}
}) {
Record {
Id
Name {
value
mutation AccountExample{
uiapi {
AccountCreate(input: {
Account: {
Name: "Trailblazer Express"
}
}) {
Record {
Id
Name {
value
}
}
}
}
}
}
````

$ sf api request graphql --body example.txt
will create a new account returning specified fields (Id, Name)

$ sf api request graphql --body example.txt
will create a new account returning specified fields (Id, Name)
```

_See code: [src/commands/api/request/graphql.ts](/~https://github.com/salesforcecli/plugin-api/blob/1.2.0/src/commands/api/request/graphql.ts)_
_See code: [src/commands/api/request/graphql.ts](/~https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/graphql.ts)_

## `sf api request rest ENDPOINT`

Make an authenticated HTTP request to Salesforce REST API and print the response.

```

USAGE
$ sf api request rest ENDPOINT -o <value> [--flags-dir <value>] [--api-version <value>] [-i | -S Example:
report.xlsx] [-X GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [--body file]
$ sf api request rest ENDPOINT -o <value> [--flags-dir <value>] [--api-version <value>] [-i | -S Example:
report.xlsx] [-X GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [--body file]
ARGUMENTS
ENDPOINT Salesforce API endpoint
ENDPOINT Salesforce API endpoint
FLAGS
-H, --header=key:value... HTTP header in "key:value" format.
-S, --stream-to-file=Example: report.xlsx Stream responses to a file.
-X, --method=<option> [default: GET] HTTP method for the request.
<options: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE>
-i, --include Include the HTTP response status and headers in the output.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
`target-org` configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--body=file File to use as the body for the request. Specify "-" to read from standard
input; specify "" for an empty body.
-H, --header=key:value... HTTP header in "key:value" format.
-S, --stream-to-file=Example: report.xlsx Stream responses to a file.
-X, --method=<option> [default: GET] HTTP method for the request.
<options: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE>
-i, --include Include the HTTP response status and headers in the output.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
`target-org` configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--body=file File to use as the body for the request. Specify "-" to read from standard
input; specify "" for an empty body.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--flags-dir=<value> Import flag values from a directory.
EXAMPLES

- List information about limits in the org with alias "my-org":
sf api request rest 'limits' --target-org my-org
- List all endpoints
sf api request rest '/'
- Get the response in XML format by specifying the "Accept" HTTP header:
sf api request rest 'limits' --target-org my-org --header 'Accept: application/xml'
- POST to create an Account object
sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
- or with a file 'info.json' containing

```json
{
"Name": "Demo",
"ShippingCity": "Boise"
}
- List information about limits in the org with alias "my-org":
sf api request rest 'limits' --target-org my-org
- List all endpoints
sf api request rest '/'
- Get the response in XML format by specifying the "Accept" HTTP header:
sf api request rest 'limits' --target-org my-org --header 'Accept: application/xml'
- POST to create an Account object
sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
- or with a file 'info.json' containing
{
"Name": "Demo",
"ShippingCity": "Boise"
}
$ sf api request rest 'sobjects/account' --body info.json --method POST
- Update object
sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
```

$ sf api request rest 'sobjects/account' --body info.json --method POST
_See code: [src/commands/api/request/rest.ts](/~https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/rest.ts)_

- Update object
sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
<!-- commandsstop -->

```
_See code: [src/commands/api/request/rest.ts](/~https://github.com/salesforcecli/plugin-api/blob/1.2.0/src/commands/api/request/rest.ts)_
<!-- commandsstop -->
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@salesforce/plugin-api",
"description": "A plugin to call API endpoints via CLI commands",
"version": "1.2.0",
"version": "1.2.1",
"author": "Salesforce",
"bugs": "/~https://github.com/forcedotcom/cli/issues",
"dependencies": {
Expand Down

0 comments on commit 2290a88

Please sign in to comment.