Hi,
I am unable to figure out how to use the Webcon REST API for starting new element. My issue relates to the "ChoicePicker" / "Autocomplete" fields, where I cannot find the way to submit the value.
I think that I have tried all the combinations, but I always end up with the same error.
Public Api POST /api/data/v6.0/db/1/elements
- "formFields"[]
- "guid":"...", "value": [{"id": "115"}]
- "guid":"...", "value": [{"id": "115", "name": "ElementName"}]
- "guid":"...", "svalue": "115"
- "guid":"...", "svalue": "115", "value": [{"id": "115"}]
- "guid":"...", "svalue": "115#ElementName"
- "guid":"...", "svalue": "115#ElementName", "value": [{"id": "115"}]
- "guid":"...", "svalue": "115#ElementName", "value": [{"id": "115", "name": "ElementName"}]
Can it be caused by "scope / permission" issues? I do not have any trouble GETting elements with given IDs in API:
> Public API GET /api/data/v6.0/hightrust/db/1/elements/80 → 200 OK
> Public API GET /api/data/v6.0/hightrust/db/1/elements/115 → 200 OK
> Public API GET /api/data/v6.0/hightrust/db/1/elements/180 → 200 OK
-----------------
*Exception from administration tools*:
Public Api POST /api/data/v6.0/db/1/elements
Status code: 409 Error message: Validation error for fields:
Field FieldName1 (guid: 43e896d4-1382-4a71-83c7-333f265015e6 id: 399 has invalid value: Value with id: '115' does not exist
Field FieldName2 (guid: 8a6d26cc-4d88-40d9-b92d-8095d1946d2c id: 403 has invalid value: Value with id: '80' does not exist
Field FieldName3 (guid: d330700a-8af1-4749-98d1-e5626c248bc8 id: 406 has invalid value: Value with id: '118' does not exist
Callstack: WebCon.BPSCloud.Core.PublicApi.Exceptions.InvalidFieldDataException: Validation error for fields:
Field FieldName1 (guid: 43e896d4-1382-4a71-83c7-333f265015e6 id: 399 has invalid value: Value with id: '115' does not exist
Field FieldName2 (guid: 8a6d26cc-4d88-40d9-b92d-8095d1946d2c id: 403 has invalid value: Value with id: '80' does not exist
Field FieldName3 (guid: d330700a-8af1-4749-98d1-e5626c248bc8 id: 406 has invalid value: Value with id: '118' does not exist
at WebCon.BPSCloud.Core.PublicApi.Root.Validators.ElementsValidator.ValidateFieldsValues(InvalidFieldsCollections invalidFields)
at WebCon.BPSCloud.Core.PublicApi.Root.Managers.PublicApiFormManager.SetFormFieldsAsync(IElementForm element, NewElement model)
at WebCon.BPSCloud.Core.PublicApi.Root.Managers.PublicApiFormManager.StartNewElementAsync(Int32 dbId, String path, NewElement element)
at WebCon.BPSCloud.Portal.API.Public.v60.PublicApiElementsController.AddNewElement(Int32 dbId, String path, ApiMode mode, NewElement element)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)