Validate Request Parameters in Appian Web-API

Dears, I need to validate all the request parameters i.e. CaseFees is Integer or not, in case its null or not integer then the WEB-API should throw an exception and shall not proceed next.

Kindly, need an answer as soonest

 

Thanks

  Discussion posts and replies are publicly visible

Parents
  • Hi asifh,
    Please let us know if this helps.
    with(
    local!task:http!request.queryParameters.taskId,
    local!taskId: tonumber(local!task),
    local!entities: if(
    rule!APN_isBlank(local!taskId),
    null,
    a!queryEntity(
    entity: cons!AMS_TASK_ENTITY,
    query: a!query(
    pagingInfo: topagingInfo(1,-1),
    filter: a!queryFilter(
    field: "taskID",
    operator: "=",
    value: local!taskId
    )
    )
    ).data
    ),
    a!httpResponse_17r4(
    headers: {
    a!httpHeader(
    name: "Content-Type",
    value: "application/json"
    )
    },
    body: if(
    rule!APN_isBlank(local!taskId),
    a!toJson_17r1(
    value: {Error:"Task Id Required please use query parameter eg: url/.../getTaskDetails

    ),
    a!toJson_17r1(
    value: local!entities
    )
    )
    )
    )
Reply
  • Hi asifh,
    Please let us know if this helps.
    with(
    local!task:http!request.queryParameters.taskId,
    local!taskId: tonumber(local!task),
    local!entities: if(
    rule!APN_isBlank(local!taskId),
    null,
    a!queryEntity(
    entity: cons!AMS_TASK_ENTITY,
    query: a!query(
    pagingInfo: topagingInfo(1,-1),
    filter: a!queryFilter(
    field: "taskID",
    operator: "=",
    value: local!taskId
    )
    )
    ).data
    ),
    a!httpResponse_17r4(
    headers: {
    a!httpHeader(
    name: "Content-Type",
    value: "application/json"
    )
    },
    body: if(
    rule!APN_isBlank(local!taskId),
    a!toJson_17r1(
    value: {Error:"Task Id Required please use query parameter eg: url/.../getTaskDetails

    ),
    a!toJson_17r1(
    value: local!entities
    )
    )
    )
    )
Children
No Data