Skip to main content
April 4, 2023
Question

Issue creating Web API

  • April 4, 2023
  • 5 replies
  • 0 views

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
April 4, 2023

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

abhayd3663
April 5, 2023

Use typeof() function as shown below.

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

April 5, 2023

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

abhayd3663
April 5, 2023

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
April 5, 2023

Thanks everyone, I have made it work.