Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

WebData is a configuration object designed to Reports WebData (Reference) onfiguration objects facilitate data exchange between applications using different formats like JSON, XML, or HTML. It allows you to load files or save data in those formats for immediate use by other applications or for further offline processing.WebData objects can be integrated into user interfaces, allowing for direct interaction HTML, or text formats, enabling integration with web services and RESTful APIs.  WebData objects provide:

  • RESTful API integration
  • Multiple data format support
  • Authentication handling
  • Dynamic tag binding
  • Request/response management
  • File save capabilities

WebData enables both consuming external APIs and exposing solution data to other systems.

In this page:

Table of Contents
maxLevel2
minLevel2
indent10px
excludeSteps
stylenone




Reports → Tutorial | Concept | How-to Guide | Reference



Configuration Properties

PropertyDescriptionRequired
NameUnique WebData identifierYes
EncodingData format (JSON/XML/HTML/Text)Yes
DefaultURLDefault API endpointNo
AuthorizationAuthentication methodNo
HeadersRequest/response metadataNo
SaveFileNameLocal file path for savingNo
PaddingWhitespace handlingNo
EditSecurityPermission groupsNo
LengthData size in bytesAuto
DescriptionDocumentation textNo

Creating WebData Objects

  1. Navigate to Reports → WebData
  2. Click Add button
  3. Configure minimum requirements:
    • Name: Unique identifier
    • Encoding: Select format
  4. Optional: Set DefaultURL and Authorization
  5. Click OK

Authentication Methods

No Auth

No credentials sent:

Authorization: None

Bearer Token

Token-based authentication:

Authorization: Bearer <token>
Headers: {"Authorization": "Bearer {{Tag.APIToken}}"}

Basic Auth

Username/password authentication:

Authorization: Basic
Username: {{Tag.Username}}
Password: {{Tag.Password}}

Custom

Define custom authentication:

Headers: {
  "X-API-Key": "{{Tag.APIKey}}",
  "X-Client-ID": "{{Tag.ClientID}}"
}

Request Methods

GET Requests

Execute data retrieval:

csharp

// Async GET request
string response = await @Report.WebData.MyAPI.GetRequestAsync();

// Store in tag
@Tag.APIResponse = response;

// Access via DocumentClient
string data = @Report.WebData.MyAPI.DocumentClient;

POST Requests

Send data to API:

csharp

// Define body in WebData Editor
// Set response tag in headers
@Report.WebData.MyAPI.Headers["ResponseTag"] = "Tag.PostResult";

// Execute POST
await @Report.WebData.MyAPI.PostRequestAsync();

// Response stored in specified tag
string result = @Tag.PostResult;

WebData Editor

Define request structure and bind tags:

JSON Format

json

{
  "timestamp": "{{Info.Date}}",
  "values": {
    "temperature": {{Tag.TankFarm/Tank1/Temp}},
    "pressure": {{Tag.TankFarm/Tank1/Pressure}},
    "status": "{{Tag.Equipment/Status}}"
  }
}

XML Format

xml

<data>
  <timestamp>{{Info.Date}}</timestamp>
  <temperature>{{Tag.TankFarm/Tank1/Temp}}</temperature>
  <pressure>{{Tag.TankFarm/Tank1/Pressure}}</pressure>
</data>

Response Handling

Store Response Methods

Method 1: Direct Assignment

csharp

@Tag.JSONResponse = await @Report.WebData.API.GetRequestAsync();

Method 2: DocumentClient Property

csharp

await @Report.WebData.API.GetRequestAsync();
string data = @Report.WebData.API.DocumentClient;

Method 3: Tag Binding in Editor Map response fields to tags in WebData Editor


Headers Configuration

Common headers:

json

{
  "Content-Type": "application/json",
  "Accept": "application/json",
  "ResponseTag": "Tag.APIResult",
  "X-Request-ID": "{{Tag.RequestID}}"
}

File Operations

Save Response to File

csharp

// Configure SaveFileName
@Report.WebData.API.SaveFileName = @"C:\Data\response.json";

// Execute and save
await @Report.WebData.API.GetRequestAsync();
@Report.WebData.API.Save();

Dynamic File Names

C:\Data\API_{{Tag.Date}}_{{Tag.Time}}.json

Padding Options

OptionEffectUse Case
CompactNo extra whitespaceMinimal payload
PadRightSpace after valuesFixed-width format
PadLeftSpace before valuesNumeric alignment

Error Handling

csharp

try
{
    string response = await @Report.WebData.API.GetRequestAsync();
    
    if (!string.IsNullOrEmpty(response))
    {
        @Tag.Status = "Success";
        ProcessResponse(response);
    }
}
catch (Exception ex)
{
    @Tag.ErrorMessage = ex.Message;
    @Tag.Status = "Failed";
}

Common Use Cases

Weather API Integration

csharp

@Report.WebData.Weather.DefaultURL = 
    "https://api.weather.com/v1/location/{{Tag.City}}";
    
string weather = await @Report.WebData.Weather.GetRequestAsync();

IoT Data Upload

csharp

// Configure POST body with sensor data
@Report.WebData.IoT.Headers["ResponseTag"] = "Tag.UploadStatus";
await @Report.WebData.IoT.PostRequestAsync();

Database Sync

csharp

// Get external data
string data = await @Report.WebData.External.GetRequestAsync();

// Parse and update local database
UpdateDatabase(data);

Best Practices Checklist 

  •  Validate URLs - Check endpoints before deployment
  •  Secure credentials - Use tags for sensitive data
  •  Handle timeouts - Implement retry logic
  •  Parse responses - Validate JSON/XML structure
  •  Log errors - Track failed requests
  •  Test thoroughly - Verify all scenarios
  •  Document APIs - Clear descriptions

Troubleshooting

Connection failed:

  • Verify URL accessibility
  • Check network/firewall
  • Confirm authentication
  • Review proxy settings

Invalid response:

  • Check encoding format
  • Validate JSON/XML syntax
  • Verify content-type header
  • Review API documentation

Authentication errors:

  • Confirm credentials
  • Check token expiration
  • Verify header format
  • Review API permissions

Performance issues:

  • Implement caching
  • Reduce request frequency
  • Optimize payload size
  • Use async methods

In this section...

Page Tree
root@parent
spaces93DRAF

Configuration

Creating a WebData Object

You can create, modify, or delete data entries according to your solution requirements.

  1. Go to Reports / WebData.
  2. Click the "Add" button to create a new WebData and fill in the following columns:
Tip

Only the Name and Encoding properties are necessary for the basic use of the WebData object.

Property

Description

ID

Contains the unique identifier for the WebData object.

VersionID

Specifies the version of the WebData object.

Name*

Names the WebData object for reference.

Encoding*

Selects the data format for exchange; options include JSON, XML, HTML, or plain Text.

DefaultURL*

Defines the default URL for web service interaction.

Authorization*

Sets up authorization parameters:

No Auth: selects no authentication method; no credentials will be sent with the request.

Bearer Token: uses a Bearer Token for authentication; a token must be provided to access the resource.

Basic Auth: implements basic authentication; requires a username and password to be sent with the request.

Custom: allows for a custom authentication method to be defined and used according to specific requirements.

Headers*

Contains metadata for the data request or response.

SaveFileName*

Designates the file name for saving the data locally.

Padding*

Adjusts whitespace around tag values with options:

Compact (no extra characters);

PadRight (extra space on the right);

PadLeft (extra space on the left).

EditSecurity

Assigns the security permissions groups for editing the WebData.

Length*

Measures the size of the data in bytes.

Level

Determines the access level required for the WebData.

Category

Assigns the WebData object for organization.

LockState

Indicates the lock status to prevent concurrent edits.

LockOwner

Identifies the current owner of the edit lock.

DateCreated

Records the creation date of the WebData object.

DateModified

Logs the last modification date of the WebData object.

Description*

Provides a brief explanation of the WebData object.

*(Columns displayed by default on the DataGrid)

WebData Requests

GET

WebData allows executing GET requests to retrieve data from the configured WebData object. To perform a GET request, use the GetRequestAsync method of the WebData object. This method sends a request to the API endpoint and returns the response.

There are some ways to store the response of the GET request:

  • Using a Tag (String or JSON)
    • Assign the response from GetRequestAsync method to a string or JSON tag in FrameworX.
  • Using the DocumentClient Property
    • WebData object provides the DocumentClient property, which stores the latest response from an executed request.
  • Using Binding Tags in WebData EditorBinding tags allow responses to be stored and referenced directly in the WebData Editor.Tags can be used within the WebData Editor interface to dynamically map API responses. Learn more at Reports WebData Editor.

    POST

    WebData allows executing POST requests using PostRequestAsync method of the WebData object and the request body must be implemented directly in the WebData Editor. This ensures that the correct data structure is sent to the API.

    The response is stored in a JSON or Text tag assigned in the headers with the key "ResponseTag".

      

    Edit WebData Content

    The built-in WebData Editor allows you to define the data structure for JSON,  XML, HTML or Text content. 

    → Learn more at Reports WebData Editor.

    In this section:

    Page Tree
    rootV10:@parent
    spacesV10