Get the datafile
How to synchronize your application with the datafile in Optimizely Feature Experimentation.
The datafile is a JSON representation of the current state of flag rules for an environment in your Full Stack project. It contains all the data needed to deliver and track your flag deliveries and experiments. By synchronizing a local copy of this datafile, the SDK can run flag rules without making blocking network requests to an outside API, ensuring microsecond latency.
Synchronize your application with the datafile using the following methods:
|(Recommended) "pull" method||In SDKs released August 2019 and later, the SDKs fetch the datafile automatically. The SDKs polls and fetches the latest version of the datafile at whatever frequency you set when you instantiate the SDK.|
Mobile SDKs provide additional datafile synchronization options. See the Initialize topics in the mobile SDK reference guides for information about:
- synchronous or asynchronous initialization
- bundled datafiles
|"Push" method||Use webhooks to fetch and manage datafiles based on application changes. Use this method alone or in combination with polling if you need faster updates.|
|Customized method||If you want to customize or extend how you access the datafile, you can fetch the datafile using the Optimizely CDN datafile URL.|
*For SDK versions released before August 2019, get a local copy of the datafile from our servers before initializing a client. For more information, see a previous version of this topic.
When choosing how you synchronize the datafile, consider the tradeoffs between accuracy and latency. The more frequently your application gets the datafile, the more accurate your application is with the Optimizely Feature Experimentation project environment, but the more latency you generate through network traffic. If you want to centralize your network connections to the datafile, consider using Optimizely Agent.
Datafile refresh rate
The datafile updates when you save changes to your flags in the Optimizely app, but the datafile can take a few minutes to propagate to the Optimizely content delivery network (CDN). This is because the time at which Optimizely Feature Experimentation fetches an updated datafile from the Optimizely CDN depends on the SDK language and version, the synchronization method, and the local cached copy version. If you’re experiencing delays longer than five (5) minutes, please contact support.
Synchronize across the SDKs
If you prefer not to synchronize each of your SDK instances individually with the Optimizely CDN, you can fetch the datafile through a single instance of the SDK, then pass that to other instances. For an example use case, see Multiple languages.
SDK Get Datafile method
See Sharing the datafile with client SDKs
Agent microservice endpoint
Fetch the datafile for an agent microservice instance through the get datafile endpoint.
View the datafile via the app
You can view the datafile in the Optimizely app, for example, for troubleshooting purposes. Accessing the datafile in this manner is not supported for secure environments. For secure environments, you can instead access the datafile at initialization, passing the datafile access token for authentication.
To access the datafile for your Full Stack project:
- Go to Settings > Environment.
- Find the SDK Key/Primary URL for the project and environment whose datafile you want to access.
- Click the SDK Key/Primary URL to open the CDN link in a new browser tab or window.
This image shows how the datafile appears when accessed from the CDN URL in the app. You can also use this URL for implementing your own custom datafile fetching.
See Example datafile to see an example in properly formatted JSON.
Updated about 1 month ago