API Calls for Managing UDFs in WebReports
Trouble seeing the images? Right click on images and open in new tab to enlarge or zoom in on the page (Ctrl + mousewheel).
In this article we provide detail on the API calls for managing UDFs in WebReports.
Why Use the UDF Management API Calls?
The UDF management API calls will allow users with the API role, or API key, to modify user UDFs in WebReports.
Example Defined Field API calls include the following:
- Add (takes a list of UDFs)
- Delete (takes a list of UDFs)
- Update (takes a list of UDFs)
API Prerequisites:
- Must have the API role in WebReports
- Established Connection/Cookie
Video Tutorial:
Not yet available.
Structure / Examples of Defined Field API Calls
UDF API Endpoints:
Add: /api/Service/AddDefinedFields
Delete: /api/Service/DelDefinedFields
Update: /api/Service/UpdateDefineFields
Informational API Endpoints using the API Key Controller
/extapi/APIWebReport/AddDefinedFields
/extapi/APIWebReport/DelDefinedFields
/extapi/APIWebReport/UpdateDefineFields
UDF Parameter Structure:
When sending a call to either AddDefinedFields/DelDefinedFields/UpdateDefineFields, the controller is looking for a list of "UDF". Below is the structure for a "UDF".
public class UDF
{
public string Name { get; set; }
public string Desc { get; set; }
public string QueryIdentifier { get; set; }
}
Add User Defined Fields:
(Creating a List of UDF to send to the API)
Dim UDFs As New List(Of UDF)
UDFs.Add(New UDF With {.Name = "UDF1", .Desc = "My First UDF API call", .QueryIdentifier = "@UDF1@"})
UDFs.Add(New UDF With {.Name = "UDF2", .Desc = "My Second UDF API call", .QueryIdentifier = "@UDF2@"})
(Sending the List of UDF to the API Call)
Dim Params As StringContent = New StringContent(JsonConvert.SerializeObject(UDFs, Formatting.Indented), Encoding.UTF8, "application/json")
Dim openResponse = client.PostAsync("server/api/Service/AddDefinedFields", Params).GetAwaiter().GetResult()
Delete User Defined Fields:
(Creating a List of UDF to send to the API)
Dim UDFs As New List(Of UDF)
UDFs.Add(New UDF With {.Name = "UDF1", .Desc = "My First UDF API call", .QueryIdentifier = "@UDF1@"})
UDFs.Add(New UDF With {.Name = "UDF2", .Desc = "My Second UDF API call", .QueryIdentifier = "@UDF2@"})
(Sending the List of UDF to the API Call)
Dim Params As StringContent = New StringContent(JsonConvert.SerializeObject(UDFs, Formatting.Indented), Encoding.UTF8, "application/json")
Dim openResponse = client.PostAsync("server/api/Service/DelDefinedFields", Params).GetAwaiter().GetResult()
Update User Defined Fields:
(Creating a List of UDF to send to the API)
Dim UDFs As New List(Of UDF)
UDFs.Add(New UDF With {.Name = "UDF1", .Desc = "My First UDF API call", .QueryIdentifier = "@UDF1@"})
UDFs.Add(New UDF With {.Name = "UDF2", .Desc = "My Second UDF API call", .QueryIdentifier = "@UDF2@"})
(Sending the List of UDF to the API Call)
Dim Params As StringContent = New StringContent(JsonConvert.SerializeObject(UDFs, Formatting.Indented), Encoding.UTF8, "application/json")
Dim openResponse = client.PostAsync("server/api/Service/UpdateDefinedFields", Params).GetAwaiter().GetResult()
Example Body / Parameter Structure:
[
{
"Name": "UDF1",
"Desc": "My First UDF API call",
"QueryIdentifier": "@UDF1@"
},
{
"Name": "UDF2",
"Desc": "MySecond UDF API call",
"QueryIdentifier": "@UDF2@"
}
]
Comments
0 comments
Please sign in to leave a comment.