Optimizely Forms is only supported by MVC-based websites and HTML5-compliant browsers.
Forms.ServiceAPI` has the following attributes:
Exposes RESTful API for reading data of a form.
If you specify `
neededLanguage`, only expose data where `
SYSTEMCOLUMN-language="neededLanguage";` you do not need to show the `
If you do not specify `
neededLanguage`, show data for all languages, and also show `
Supports CSV, XML, XLSX, and JSON formats.
Compatible with OData. - [$filter](🔗) defined by OData can be used to filter on `
SYSTEMCOLUMN\_SubmitUser and SYSTEMCOLUMN\_FinalizedSubmission`. For example: `
http://localhost:56908/EPiServer.Forms.ServiceApi/GetFormData(Id=114,Language=null)?$filter=SYSTEMCOLUMN_SubmitUser`. The `
SYSTEMCOLUMN\_SubmitTime` is not compatible with OData serializing. You should use `
$filter` without `
SYSTEMCOLUMN\_SubmitTime` and filter the data by code.
For implementation, writes the extension on top of the ServiceAPI to use its OAuth2 handling.
If you enable **Allow Exposing Data Feeds** in a form container, allowed credentials can fetch data with the ServiceAPI.
## Work with the API
EPiServer.Forms.ServiceApi` is based on `
Install the `
EPiServer.Forms.ServiceApi` NuGet package with Visual Studio and rebuild the solution.
Update the `
EPiServer.ServiceApi` to latest version by running the following command in the Package Manager Console.
Update _appsetting.json_ to config `
ClientId` and `
Bind HTTPS for your site.
EPiServer.Forms.ServiceApi` depends on `
EPiServer.ServiceApi`, which requires using https for consuming APIs, so you need go to IIS and bind https for your website.
Verify that `
EPiServer.Forms.ServiceApi` is working.
Before you can use the `
ServiceApi`, access `
https://YourSite//EPiServer.Forms.ServiceApi` from a browser. If it returns JSON like this:
...then it is working. If it does not return anything, re-install nuget then try again
Grant permission for the Config user to use `
Go to the admin view >** Config **>** Security **>** Permissions for Functions**.
Add the user or group to the **EPiServerServiceApi Read Access** right. This user is for authenticating when you consume the `
Implement OAuth2 client to access the service.
You can use the OAuth2Client class to access the service to get data. The service exposes three methods:
GetFormsInfo. Gets forms in the system. Accept language as parameter; if the language parameter is null, it returns form information in the master language. The requesting user must have read-access with the form to get data.
GetFormData. Fetches posted data of a specified form. You need to specify form id and language as parameters; language can be null, which returns data from all languages.
GetFieldMapping. Gets mappings between field name and their friendly name. You need to specify form id and form language.
DeleteFormData. [New in Forms Service API 3.1.0] Deletes posted data of a specified form. You need to specify form Id and SubmissionIds as parameters.
To invoke `
DeleteFormData` action, use a POST request and JSON data format for the parameters in the request body. Example:
The service is compatible with OData 8.0. The following example shows how to use these methods.