{"id":17405056,"url":"https://github.com/jongpie/apexcallouts","last_synced_at":"2026-01-24T02:35:27.269Z","repository":{"id":59699271,"uuid":"122086048","full_name":"jongpie/ApexCallouts","owner":"jongpie","description":"A lightweight Apex library for making HTTP callouts. Works with remote site settings and named credentials.","archived":false,"fork":false,"pushed_at":"2020-10-13T01:18:26.000Z","size":34,"stargazers_count":42,"open_issues_count":2,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T00:51:19.087Z","etag":null,"topics":["apex","rest-api","salesforce"],"latest_commit_sha":null,"homepage":"","language":"Apex","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jongpie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-19T16:00:45.000Z","updated_at":"2024-10-01T01:31:39.000Z","dependencies_parsed_at":"2022-09-20T00:11:33.315Z","dependency_job_id":null,"html_url":"https://github.com/jongpie/ApexCallouts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FApexCallouts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FApexCallouts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FApexCallouts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FApexCallouts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jongpie","download_url":"https://codeload.github.com/jongpie/ApexCallouts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245937929,"owners_count":20696987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["apex","rest-api","salesforce"],"created_at":"2024-10-16T20:22:45.956Z","updated_at":"2025-10-14T12:10:48.497Z","avatar_url":"https://github.com/jongpie.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apex Callouts\nA lightweight Apex library for making HTTP callouts \u003cbr /\u003e\n\u003ca href=\"https://githubsfdeploy.herokuapp.com\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Deploy to Salesforce\" src=\"https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png\"\u003e\n\u003c/a\u003e\n\n## Using Callout Constructors\n- **Callout(String endpoint)** - used when you have a full URL for the endpoint and you are using [remote site settings](https://help.salesforce.com/articleView?id=configuring_remoteproxy.htm\u0026type=5)\n- **Callout(String namedCredential, String endpointPath)** - used with [named credentials](https://help.salesforce.com/articleView?id=named_credentials_about.htm\u0026type=5). To use this, the named credential's endpoint should be just the base URL of the API. The specific endpoint resource to call is then provided via the endpointPath parameter.\n\n## Building Your Callout Request\nOnce you have instantiated an instance of Callout, you can setup additional options for the callout, like adding headers \u0026 parameters. Each builder method returns the current instance of Callout, allowing you to chain the builder methods.\n* Callout setClientCertificateName(String clientCertificateName)\n* Callout setCompressed()\n* Callout setCompressed(Boolean compress)\n* Callout setHeader(String key, String value)\n* Callout setHeaders(Map\u003cString, String\u003e headers)\n* Callout setParameter(String key, String value)\n* Callout setParameters(Map\u003cString, String\u003e parameters)\n* Callout setTimeout(Integer timeoutMs)\n\n## Making Your Callout Request\nOnce you have instantiated an instance of Callout and setup the headers \u0026 parameters (if needed), you can call any of the HTTP verb methods - each method returns an instance of HttpResponse.\n* HttpResponse del() - 'delete' is a reserved word in Apex, so the method name has been abbreviated\n* HttpResponse get()\n* HttpResponse head()\n* HttpResponse patch() or patch(Object requestBody)\n* HttpResponse post() or post(Object requestBody)\n* HttpResponse put() or put(Object requestBody)\n* HttpResponse trace()\n\n## PATCH, POST \u0026 PUT methods\nPatch, post \u0026 put methods accept an Object as a parameter, with 3 main types supported\n* **Blob**:  Callout automatically uses setBodyAsBlob(yourBlob)\n* **Dom.Document**:  Callout automatically uses setBodyDocument(yourDocument)\n* **Serializable Object**: Any other object types will be serialized and sent as JSON, using setBody(JSON.serialize(yourObject))\n\nFor all 3 scenarios, the header 'Content-Type' is automatically set based on the request body if the header has not already been set\n\n## Error Handling\nWhen the callout is made, any status code \u003e= 400 automatically throws an instance of Callout.HttpResponseException exception\n\n## Example Usage\nGET request with headers \u0026 parameters, using chained method calls \u0026 named credentials\n```\nHttpResponse myCalloutResponse = new Callout('myExampleNamedCredential', '/fakeResource')\n    .addHeader('myHeader', 'myHeaderValue')\n    .addParameter('myFirstParameter', 'someValue')\n    .addParameter('mySecondParameter', 'anotherValue')\n    .get();\n```\n\nGET request with headers \u0026 parameters, using chained method calls \u0026 a full URL (remote site settings)\n```\nHttpResponse myCalloutResponse = new Callout('https://api.example.com/fakeResource')\n    .addHeader('myHeader', 'myHeaderValue')\n    .addParameter('myFirstParameter', 'someValue')\n    .addParameter('mySecondParameter', 'anotherValue')\n    .get();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongpie%2Fapexcallouts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongpie%2Fapexcallouts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongpie%2Fapexcallouts/lists"}