Skip to main content
Known Participant
Apr 4, 2023 9:49 PM UTC
Question

Issue creating Web API

Hi there,

trying to learn building web api in Appian, could anyone know what's the problem here? the second parameter can not be CASTed?

Best regards,

5 replies

linp0001Author
Known Participant
Apr 4, 2023 10:02 PM UTC

found the reason, the "sn" should be "SN" match the definition in data type

abhayd3663
Brainy
Apr 5, 2023 3:34 PM UTC

Use typeof() function as shown below.

cast(
  typeof('type!{urn:com:appian:types:AWM}AWM_SN'()),
  {
    id: 1,
    sn: "XXX-XX-123"
  }
)

sanchitg0002
Inspiring
Apr 5, 2023 4:06 PM UTC

FYI, No need to use typeof() when referencing a CDT

abhayd3663
Brainy
Apr 5, 2023 4:14 PM UTC

Agree. The syntax is little bit tricky.

If you use () it means you are referring to empty CDT instance and you need to use typeof(). if you reference directly to the cdt type like 'type!{urn:com:appian:types:AWM}AWM_SN' then no need to use typeof().

cast(
typeof('type!{urn:com:appian:types:AWM}AWM_SN'()),
{
id: 1,
sn: "XXX-XX-123"
}
)

linp0001Author
Known Participant
Apr 5, 2023 4:42 PM UTC

Thanks everyone, I have made it work.