{"id":19149850,"url":"https://github.com/harness/ff-apex-server-sdk","last_synced_at":"2026-02-17T23:01:54.208Z","repository":{"id":77635671,"uuid":"520429155","full_name":"harness/ff-apex-server-sdk","owner":"harness","description":"Feature Flag APEX server side SDK","archived":false,"fork":false,"pushed_at":"2025-12-11T15:02:52.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-12T18:50:50.573Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Apex","has_issues":true,"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/harness.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-02T09:16:40.000Z","updated_at":"2025-12-11T14:32:53.000Z","dependencies_parsed_at":"2025-01-03T18:11:50.691Z","dependency_job_id":"3450fedb-0cfc-45f6-9451-032389905379","html_url":"https://github.com/harness/ff-apex-server-sdk","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/harness/ff-apex-server-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-apex-server-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-apex-server-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-apex-server-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-apex-server-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harness","download_url":"https://codeload.github.com/harness/ff-apex-server-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-apex-server-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29561783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T21:50:49.831Z","status":"ssl_error","status_checked_at":"2026-02-17T21:46:15.313Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2024-11-09T08:09:51.406Z","updated_at":"2026-02-17T23:01:54.168Z","avatar_url":"https://github.com/harness.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"APEX SDK For Harness Feature Flags\n========================\n\n[![SFDX Test Run on Push](https://github.com/harness/ff-apex-server-sdk/actions/workflows/ci.yaml/badge.svg)](https://github.com/harness/ff-apex-server-sdk/actions/workflows/ci.yaml)\n\n## Table of Contents\n**[Intro](#Intro)**\u003cbr\u003e\n**[Requirements](#Requirements)**\u003cbr\u003e\n**[Quickstart](#Quickstart)**\u003cbr\u003e\n**[Further Reading](docs/further_reading.md)**\u003cbr\u003e\n**[Build Instructions](docs/build.md)**\u003cbr\u003e\n\n\n## Intro\nUse this README to get started with our Feature Flags (FF) SDK for APEX. This guide outlines the basics of getting started with the SDK and provides a full code sample for you to try out.\nThis sample doesn’t include configuration options, for in depth steps and configuring the SDK, for example, using our Relay Proxy, see the  [APEX SDK Reference](https://docs.harness.io/article/aoe0y33mut-apex-sdk-reference).\n\nFor a sample FF APEX SDK project, see our [test APEX project](https://github.com/harness/ff-apex-server-sample).\n\n![FeatureFlags](./ff-gui.png)\n\n## Requirements\n[SalesForce SFDX cli](https://developer.salesforce.com/tools/sfdxcli)\n\n## Quickstart\nTo follow along with our test code sample, make sure you’ve:\n\n- [Created a Feature Flag on the Harness Platform](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag) called harnessappdemodarkmode\n- [Created a server SDK key and made a copy of it](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag#step_3_create_an_sdk_key)\n\n\n### Install the SDK\nInstall the APEX SDK using\n```bash\nsfdx force:source:deploy --targetusername='YOUR TARGET ORG' --sourcepath='force-app'\n```\n\n### Code Sample\nThe following is a complete code example that you can use to test the `harnessappdemodarkmode` Flag you created on the Harness Platform. When you run the code it will:\n- Connect to the FF service.\n- Report the value of the Flag.\n- Close the SDK.\n\n```apex\n// Set flagKey to the feature flag key you want to evaluate.\nString flag = 'harnessappdemodarkmode';\n\n\n// set cache Namespace and Partition\nFFOrgCache cache = new FFOrgCache('local', 'basic');\nFFConfig config = new FFConfig.builder()\n    .cache(cache)\n    .metricsEnabled() //Enable Metrics publishing\n    .build();\n\n// Create Client\nFFClient client = FFClient.builder('Your SDK Key', config).build();\n\n// Set up the target properties.\nFFTarget target = FFTarget.builder().identifier('Harness').name('Harness').build();\n\n// Bool evaluation\nBoolean value = client.boolVariation(flag, target, false);\nSystem.debug('Feature flag ' + flag + ' is '+ value + ' for this user');\n```\n\n### Regular Polling\nThe SDKs uses a polling strategy to keep the local cache in sync with the flag configurations.\nSince version 0.1.3, the poller will ensure that the SDK's authentication is refreshed before the token\nis removed from your Platform Cache via its TTL. This is beneficial when you have scheduled jobs that are\nusing the FFClient, but the SDK has not been re-initialized recently outside of a scheduled job.\n\n```apex\n// set cache Namespace and Partition\nFFOrgCache cache = new FFOrgCache('local', 'basic');\nFFConfig config = new FFConfig.builder()\n    .cache(cache)\n    .build();\n\n// Start Polling to update the cache\nFFClient.builder('Your SDK Key', config)\n    .withPolling(60) // Poll every 60 seconds\n    .build();\n```\nDefault Setting: This feature is disabled by default and must be explicitly enabled if needed.\n\n**Warning**: If polling is not enabled, then the SDK will not be able to receive updated flag configuration. \nIf you only want to receive the initial flag configuration, you can leave polling disabled and use the `FFClient.builder.withWaitForInitialized(true)` option. See\n[Immediate Flag and Segment Fetching (Not Suitable for Scheduled Jobs)](#immediate-flag-and-segment-fetching-not-suitable-for-scheduled-jobs)\n\n### Immediate Flag and Segment Fetching (Not Suitable for Scheduled Jobs)\nTo ensure the FFClient provides accurate evaluations right after initialization, you can use withWaitForInitialized(true). This method triggers an immediate cache refresh via a callout, thus updating the cache before any evaluations are performed. Consequently, it also skips the first scheduled poll, as the cache is already up to date.\n\nDefault Setting: This feature is disabled by default and must be explicitly enabled if needed.\n\n**Warning**: Avoid using this feature within scheduled jobs, as it may cause the job to fail due to the immediate callout.\n\n```apex\n// set cache Namespace and Partition\nFFOrgCache cache = new FFOrgCache('local', 'basic');\nFFConfig config = new FFConfig.builder()\n    .cache(cache)\n    .build();\n\n// Start Polling to update the cache\nFFClient.builder('Your SDK Key', config)\n    .withWaitForInitialized(true) // Fetch flags immediately\n    .withPolling(60) // Poll every 60 seconds\n    .build();\n```\n\n### Running the example\n\n```bash\nsfdx force:apex:execute --targetusername='YOUR TARGET ORG' --apexcodefile='YOUR_FILENAME.apex'\n```\n\n### Additional Reading\n\nFor further examples and config options, see the [APEX SDK Reference](https://docs.harness.io/article/aoe0y33mut-apex-sdk-reference).\n\nFor more information about Feature Flags, see our [Feature Flags documentation](https://ngdocs.harness.io/article/0a2u2ppp8s-getting-started-with-feature-flags).\n\n-------------------------\n[Harness](https://www.harness.io/) is a feature management platform that helps teams to build better software and to\ntest features quicker.\n\n-------------------------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-apex-server-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharness%2Fff-apex-server-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-apex-server-sdk/lists"}