Home > Forum > General > Data sources - Fixed values list - API

Data sources - Fixed values list - API
0

Hi,

Are "Fixed values list"s' content available through API? Not dictionaries or other process types, but "Fixed values list" object types only.
The need is to synchronize Webcon data with other systems, assuming Webcon repository is master.

I found this article https://community.webcon.com/forum/thread/2491 which states that there would exist /api/data/v4.0/db/{dbId}/elements/resolveFieldValue/{idguid}, but this kind of call results in 404 - not found error.

I did not find resolveFieldValue anywhere else, or any other solution for that matter, thus current question.

Thank you,
Mihail

MVP

I Mihali, I've checked Swagger UI*, and there are no data sources available through api - closest we can get, are connections, but thats not it.

/api/data/v4.0/db/{dbId}/elements/resolveFieldValue/{idguid} this endpoint based on Swagger description:
"Gets available values for selected picker/choose form field"
It will not return directly Fixed Values List content, but it should also consider all filters which are on specific field for specific element ID.
You could though create some technical element, which would be used as some kind of helper to get to those values.

I think there is something wrong in the URL based on the error - i can easily use this endpoint, are you sure that you've authorized with API application with granted permissions? Based on Swagger:
At least one permission required: App.Elements.Admin.All; App.Elements.ReadWrite.All; User.Elements.Admin.All; User.Elements.Admin.<ProcGuid>; User.Elements.ReadWrite.All; User.Elements.ReadWrite.<ProcGuid>?

It also requires passing workflow id, and formtype id as queryparams, so whole request might look like this:
https://mycompany-webcon/api/data/beta/db/{db_id}/elements/resolveFieldValue/{field_id}?workflow={workflow_id}&formType={formtype_id}

You could also consider querying them directly from the database.
There is WFDataSources table, and WFS_StaticValues column.


* On each webcon instance there is Swagger available under https://{instance}/api, you can read about it here: https://developer.webcon.com/docs/rest-api/

In reply to: Maksymilian Stachowiak

I Mihali, I've checked Swagger UI*, and there are no data sources available through api - closest we can get, are connections, but thats not it.

/api/data/v4.0/db/{dbId}/elements/resolveFieldValue/{idguid} this endpoint based on Swagger description:
"Gets available values for selected picker/choose form field"
It will not return directly Fixed Values List content, but it should also consider all filters which are on specific field for specific element ID.
You could though create some technical element, which would be used as some kind of helper to get to those values.

I think there is something wrong in the URL based on the error - i can easily use this endpoint, are you sure that you've authorized with API application with granted permissions? Based on Swagger:
At least one permission required: App.Elements.Admin.All; App.Elements.ReadWrite.All; User.Elements.Admin.All; User.Elements.Admin.<ProcGuid>; User.Elements.ReadWrite.All; User.Elements.ReadWrite.<ProcGuid>?

It also requires passing workflow id, and formtype id as queryparams, so whole request might look like this:
https://mycompany-webcon/api/data/beta/db/{db_id}/elements/resolveFieldValue/{field_id}?workflow={workflow_id}&formType={formtype_id}

You could also consider querying them directly from the database.
There is WFDataSources table, and WFS_StaticValues column.


* On each webcon instance there is Swagger available under https://{instance}/api, you can read about it here: https://developer.webcon.com/docs/rest-api/

Hi,

I also tried using this endpoint /api/data/v5.0/db/{db}/elements/resolveFieldValue/{guid} in Postman to get all available positions in the picker.
From the swagger information, this is a POST request. I have set all the necessary fields, authorization in the header, workflow ID, form field ID and field ID in the url. After sending this request I get an error "Model is not valid. A non-empty request body is required.". Do you know why this is happening or what I should write in the POST content?

In reply to: Wojciech Paluch

Hi,

I also tried using this endpoint /api/data/v5.0/db/{db}/elements/resolveFieldValue/{guid} in Postman to get all available positions in the picker.
From the swagger information, this is a POST request. I have set all the necessary fields, authorization in the header, workflow ID, form field ID and field ID in the url. After sending this request I get an error "Model is not valid. A non-empty request body is required.". Do you know why this is happening or what I should write in the POST content?

Hi,

Indeed I did a mistake at that time, I did not choose POST as API request type, I can't say why...

In my case, data source for picker is a dictionary which provides data structure as follows: WFD_GUID as ID, WFD_AttText1 as Name.

Running a POST against the API:

{{base-URI}}/{{api-v4.0}}/elements/resolveFieldValue/{{picker-id}}?workflow=6&formType=7

with an almost empty body, containing only {} - opening and closing curly brackets, returns the options list, data and structure:

{
"data": [
{
"wfD_Guid": "51539292-4406-4c68-922e-b0c76f0f19f5",
"wfD_AttText1": "10 days"
},
{
"wfD_Guid": "0664bcf7-6e4e-4058-b08c-60ffcda432fa",
"wfD_AttText1": "100 days"
}
],
"columns": [
{
"sourceColumnName": "WFD_Guid",
"displayName": "ID",
"type": "Id"
},
{
"sourceColumnName": "WFD_AttText1",
"displayName": "Name",
"type": "Name"
}
]
}

Content-type header must be application/json, as set by Postman.

Hope it works for you,
Mihail

In reply to: Maksymilian Stachowiak

I'm thinking that might be some mistake on webcon site, i'll report it.
Passing an empty object as a body like this: {} makes the request work :)

Hi,

I tried to pass an empty bracket in the content, but I get an error with insufficient permission to start a new instance.
I didn't know I needed access to launch new instances in the process. I thought I was only accessing data from Webcon and not launching any instance.
But after granting the appropriate permissions and setting {} in the request body, this endpoint works as expected.
Thank you for your quick response :)

MVP
In reply to: Wojciech Paluch

Hi,

I tried to pass an empty bracket in the content, but I get an error with insufficient permission to start a new instance.
I didn't know I needed access to launch new instances in the process. I thought I was only accessing data from Webcon and not launching any instance.
But after granting the appropriate permissions and setting {} in the request body, this endpoint works as expected.
Thank you for your quick response :)

I'm after consulting this topic through webcon support.

So, that request is POST, due to possibility of passing an example of a filled document - when it's required to get filtered data source.
It's hinted in swagger - there is whole document structure in the request body, but i thought it might be a mistake - it's not, it's a feature :)

By passing empty object - data source will return values as if it was empty form, when the body is specified - filters should also work.

So - it expects to receive data, then it should be using POST, as GET requests shoudn't really contain body part (https://stackoverflow.com/a/983458 this links to specific RFC docs further)

In reply to: Marcin Lorens

Hi,
I have same problem, when writing integration.
it would be nice if WebCon implement GET like
/api/data/v4.0/db/{dbId}/elements/fieldAvailableValues/{idguid}
which will return an array of available options to choose from.

Same problem with people fields etc...
Or perhaps there is such possibility and i don't know it ?

Hi,

You cannot have GET because that would be one specific case of POST, in terms of filtering of the current datasource:
- GET would mean no filter applied, so the datasource should return all its available values
- POST means that, as Maksymilian stated before, you can supply your filtering values in a scenario where the current datasource comes second/third/etc and previous choices contribute as filters - imagine 2 dropboxes in a row, where second dropbox items list is constructed based on the first dropbox selected value; if there is nothing to filter, then the POST body is just empty JS object, {}

Having these scenarios, makes no sense of creating the GET endpoint equivalent of already implemented POST, GET being a specific case of POST... And there's no much difference between doing a POST with an empty body vs. GET, isn't it?

Can't say anything about people fields, but I see no special notes under swagger, the API docs say "Any of 4.0.PickerField", so it should work as "Person or Group" sits under "Picker Fields".

Regards,
Mihail

In reply to: Mihail Moise

Hi,

You cannot have GET because that would be one specific case of POST, in terms of filtering of the current datasource:
- GET would mean no filter applied, so the datasource should return all its available values
- POST means that, as Maksymilian stated before, you can supply your filtering values in a scenario where the current datasource comes second/third/etc and previous choices contribute as filters - imagine 2 dropboxes in a row, where second dropbox items list is constructed based on the first dropbox selected value; if there is nothing to filter, then the POST body is just empty JS object, {}

Having these scenarios, makes no sense of creating the GET endpoint equivalent of already implemented POST, GET being a specific case of POST... And there's no much difference between doing a POST with an empty body vs. GET, isn't it?

Can't say anything about people fields, but I see no special notes under swagger, the API docs say "Any of 4.0.PickerField", so it should work as "Person or Group" sits under "Picker Fields".

Regards,
Mihail

Ok, I found my mistake.
Another question is if it's possible to resolve "People" field?
Because I recive this error
"Public Api POST /api/data/v4.0/db/1/elements/resolveFieldValue/c8348116-7bb9-4faa-8a60-6ce60d6d1e6e
Status code: 500 Error message: Unable to cast object of type 'WebCon.WorkFlow.BusinessLogic.BusinessLogic.ElementManagement.PeoplePicker.PeopleEntityResolver' to type 'WebCon.WorkFlow.BusinessLogic.BusinessLogic.ElementManagement.Picker.Entity.IEntityDtResolver'....