{"id":41385895,"url":"https://github.com/salesforcecli/plugin-api","last_synced_at":"2026-05-03T08:17:05.135Z","repository":{"id":272984941,"uuid":"842176787","full_name":"salesforcecli/plugin-api","owner":"salesforcecli","description":"Interact with the API directly via CLI commands","archived":false,"fork":false,"pushed_at":"2026-04-26T03:59:11.000Z","size":1092,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-04-26T05:32:36.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salesforcecli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-13T20:36:45.000Z","updated_at":"2026-04-26T03:57:19.000Z","dependencies_parsed_at":"2026-02-11T00:09:12.107Z","dependency_job_id":null,"html_url":"https://github.com/salesforcecli/plugin-api","commit_stats":null,"previous_names":["salesforcecli/plugin-api"],"tags_count":25,"template":false,"template_full_name":"salesforcecli/plugin-template-sf","purl":"pkg:github/salesforcecli/plugin-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salesforcecli","download_url":"https://codeload.github.com/salesforcecli/plugin-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32294591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T11:53:51.147Z","updated_at":"2026-05-03T08:17:05.128Z","avatar_url":"https://github.com/salesforcecli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Install\n\n```bash\nsf plugins install @salesforce/plugin-api\n```\n\n## Issues\n\nPlease report any issues at https://github.com/forcedotcom/cli/issues\n\n## Contributing\n\n1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)\n2. Create a new issue before starting your project so that we can keep track of\n   what you are trying to add/fix. That way, we can also offer suggestions or\n   let you know if there is already an effort in progress.\n3. Fork this repository.\n4. [Build the plugin locally](#build)\n5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.\n6. Edit the code in your fork.\n7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.\n8. Sign CLA (see [CLA](#cla) below).\n9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.\n\n### CLA\n\nExternal contributors will be required to sign a Contributor's License\nAgreement. You can do so by going to https://cla.salesforce.com/sign-cla.\n\n### Build\n\nTo build the plugin locally, make sure to have yarn installed and run the following commands:\n\n```bash\n# Clone the repository\ngit clone git@github.com:salesforcecli/plugin-template-sf\n\n# Install the dependencies and compile\nyarn \u0026\u0026 yarn build\n```\n\nTo use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.\n\n```bash\n# Run using local run file.\n./bin/dev hello world\n```\n\nThere should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.\n\n```bash\n# Link your plugin to the sf cli\nsf plugins link .\n# To verify\nsf plugins\n```\n\n## Commands\n\n\u003c!-- commands --\u003e\n\n- [`sf api request graphql`](#sf-api-request-graphql)\n- [`sf api request rest [URL]`](#sf-api-request-rest-url)\n\n## `sf api request graphql`\n\nExecute a GraphQL statement.\n\n```\nUSAGE\n  $ sf api request graphql -o \u003cvalue\u003e --body file [--json] [--flags-dir \u003cvalue\u003e] [--api-version \u003cvalue\u003e] [-S Example:\n    report.xlsx | -i]\n\nFLAGS\n  -S, --stream-to-file=Example: report.xlsx  Stream responses to a file.\n  -i, --include                              Include the HTTP response status and headers in the output.\n  -o, --target-org=\u003cvalue\u003e                   (required) Username or alias of the target org. Not required if the\n                                             `target-org` configuration variable is already set.\n      --api-version=\u003cvalue\u003e                  Override the api version used for api requests made by this command\n      --body=file                            (required) File or content with the GraphQL statement. Specify \"-\" to read\n                                             from standard input.\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n  --json               Format output as json.\n\nDESCRIPTION\n  Execute a GraphQL statement.\n\n  Specify the GraphQL statement with the \"--body\" flag, either directly at the command line or with a file that contains\n  the statement. You can query Salesforce records using a \"query\" statement or use mutations to modify Salesforce\n  records.\n\n  This command uses the GraphQL API to query or modify Salesforce objects. For details about the API, and examples of\n  queries and mutations, see https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html.\n\nEXAMPLES\n  Execute a GraphQL query on the Account object by specifying the query directly to the \"--body\" flag; the command\n  uses your default org:\n\n    $ sf api request graphql --body \"query accounts { uiapi { query { Account { edges { node { Id \\n Name { value } \\\n      } } } } } }\"\n\n  Read the GraphQL statement from a file called \"example.txt\" and execute it on an org with alias \"my-org\":\n\n    $ sf api request graphql --body example.txt --target-org my-org\n\n  Pipe the GraphQL statement that you want to execute from standard input to the command:\n  $ echo graphql | sf api request graphql --body -\n\n  Write the output of the command to a file called \"output.txt\" and include the HTTP response status and headers:\n\n    $ sf api request graphql --body example.txt --stream-to-file output.txt --include\n```\n\n_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.3.22/src/commands/api/request/graphql.ts)_\n\n## `sf api request rest [URL]`\n\nMake an authenticated HTTP request using the Salesforce REST API.\n\n```\nUSAGE\n  $ sf api request rest [URL] -o \u003cvalue\u003e [--flags-dir \u003cvalue\u003e] [-i | -S Example: report.xlsx] [-X\n    GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [-f file | -b file]\n\nARGUMENTS\n  [URL]  Salesforce API endpoint\n\nFLAGS\n  -H, --header=key:value...                  HTTP header in \"key:value\" format.\n  -S, --stream-to-file=Example: report.xlsx  Stream responses to a file.\n  -X, --method=\u003coption\u003e                      HTTP method for the request.\n                                             \u003coptions: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE\u003e\n  -b, --body=file                            File or content for the body of the HTTP request. Specify \"-\" to read from\n                                             standard input or \"\" for an empty body. If passing a file, prefix the\n                                             filename with '@'.\n  -f, --file=file                            JSON file that contains values for the request header, body, method, and\n                                             URL.\n  -i, --include                              Include the HTTP response status and headers in the output.\n  -o, --target-org=\u003cvalue\u003e                   (required) Username or alias of the target org. Not required if the\n                                             `target-org` configuration variable is already set.\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n\nDESCRIPTION\n  Make an authenticated HTTP request using the Salesforce REST API.\n\n  When sending the HTTP request with the \"--body\" flag, you can specify the request directly at the command line or with\n  a file that contains the request.\n\n  For a full list of supported REST endpoints and resources, see\n  https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_list.htm.\n\nEXAMPLES\n  List information about limits in the org with alias \"my-org\":\n\n    $ sf api request rest 'services/data/v56.0/limits' --target-org my-org\n\n  List all endpoints in your default org; write the output to a file called \"output.txt\" and include the HTTP response\n  status and headers:\n\n    $ sf api request rest '/services/data/v56.0/' --stream-to-file output.txt --include\n\n  Get the response in XML format by specifying the \"Accept\" HTTP header:\n\n    $ sf api request rest '/services/data/v56.0/limits' --header 'Accept: application/xml'\n\n  Create an account record using the POST method; specify the request details directly in the \"--body\" flag:\n\n    $ sf api request rest /services/data/v56.0/sobjects/account --body \"{\\\"Name\\\" : \\\"Account from REST \\\n      API\\\",\\\"ShippingCity\\\" : \\\"Boise\\\"}\" --method POST\n\n  Create an account record using the information in a file called \"info.json\" (note the @ prefixing the file name):\n\n    $ sf api request rest '/services/data/v56.0/sobjects/account' --body @info.json --method POST\n\n  Update an account record using the PATCH method:\n\n    $ sf api request rest '/services/data/v56.0/sobjects/account/\u003cAccount ID\u003e' --body \"{\\\"BillingCity\\\": \\\"San \\\n      Francisco\\\"}\" --method PATCH\n\n  Store the values for the request header, body, and so on, in a file, which you then specify with the --file flag;\n  see the description of --file for more information:\n\n    $ sf api request rest --file myFile.json\n\nFLAG DESCRIPTIONS\n  -f, --file=file  JSON file that contains values for the request header, body, method, and URL.\n\n    Use this flag instead of specifying the request details with individual flags, such as --body or --method. This\n    schema defines how to create the JSON file:\n\n    {\n    url: { raw: string } | string;\n    method: 'GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE';\n    description?: string;\n    header: string | Array\u003cRecord\u003cstring, string\u003e\u003e;\n    body: { mode: 'raw' | 'formdata'; raw: string; formdata: FormData };\n    }\n\n    Salesforce CLI defined this schema to be mimic Postman schemas; both share similar properties. The CLI's schema also\n    supports Postman Collections to reuse and share requests. As a result, you can build an API call using Postman,\n    export and save it to a file, and then use the file as a value to this flag. For information about Postman, see\n    https://learning.postman.com/.\n\n    Here's a simple example of a JSON file that contains values for the request URL, method, and body:\n\n    {\n    \"url\": \"sobjects/Account/\u003cAccount ID\u003e\",\n    \"method\": \"PATCH\",\n    \"body\" : {\n    \"mode\": \"raw\",\n    \"raw\": {\n    \"BillingCity\": \"Boise\"\n    }\n    }\n    }\n\n    See more examples in the plugin-api test directory, including JSON files that use \"formdata\" to define collections:\n    https://github.com/salesforcecli/plugin-api/tree/main/test/test-files/data-project.\n```\n\n_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.3.22/src/commands/api/request/rest.ts)_\n\n\u003c!-- commandsstop --\u003e\n\n```\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforcecli%2Fplugin-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalesforcecli%2Fplugin-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforcecli%2Fplugin-api/lists"}