Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Current »

Some implementations find it useful to add a school year (or some other contextual value such as a district or instance identifier) to the API requests path as part of a data segmentation strategy or to distinguish data associated with previous years from data for the current year, or both. In the Ed-Fi ODS / API, the presence of contextual values in the API base route is configurable, and off by default.

To enable context-based routing for the Ed-Fi ODS / API, provide an ASP.NET route template in the "OdsContextRouteTemplate" setting of the "ApiSettings" section of the configuration. This route template can contain multiple segments (e.g. {instanceId}/{schoolYearFromRoute}) if multiple context values are required and can include route constraints.

{
  "ApiSettings": {
    ...
    "OdsContextRouteTemplate": "{schoolYearFromRoute:range(2000,2099)}",
    ...
  }
}

The term "schoolYearFromRoute" has been used historically for the route template to avoid any potential naming conflicts in the model binding context caused by the presence of a query string filter parameter named "schoolYear" for a resource property.

Once the OdsContextRouteTemplate is defined, all API requests must include the segment in the base path (in multi-tenant mode the context segment will be placed after the tenant identifier). Also, all ODS instance definitions managed in the EdFi_Admin database must have corresponding contextual name/value pairs defined in the OdsInstanceContext table. The API will use the context from the request with the contextual values defined for the ODS instance to identify which database should be used to service the request.




  • No labels