Hi All,
I get this response from one of the integration,
{ "media_id": 710511363345354753, "media_id_string": "710511363345354753", "size": 11065, "expires_after_secs": 86400, "image": { "image_type": "image/jpeg", "w": 800, "h": 320 } }
once get the response , i have to use the media_id value for passing as a request to another api. When i get that media_id, it is coming like infinity value(∞).
Can you please guide how can I get that value.
Regards,
Bhanu
Discussion posts and replies are publicly visible
instead of using media_id use media_id_string and then convert string value to decimal
load( local!data: { "media_id": 710511363345354753, "media_id_string": "710511363345354753", "size": 11065, "expires_after_secs": 86400, "image": { "image_type": "image/jpeg", "w": 800, "h": 320 } }, todecimal( local!data.media_id_string ))
when I used todecimal to media_id_string, output coming like "7.105114e+17"
when i used tostring(local!data.media_id_string), but value is coming like "710511363345354753" . when I pass this value to another api as a request .the value is {id:"710511363345354753"} like this. so , i got a error invalid id..when i pass only value without quote ..now it is working fine..
I tired to remove the quote(""), in this value..it is not coming..can you please help me in this atleast.
pass value like 7.105114e+17
even it is not working. {"errors":[{"code":44,"message":"media_ids parameter is invalid."}]}
If number integer is more that nine digits then it will show as (∞) in appian ,so we have converted it in to decimal,by passing decimal also you are not getting result.
it is easy if the parameter for api is "media_id_string"
media_id_string is not a parameter for api
These are your options:
1 Use another API
2 Figure out how to get the API to acknowledge a string because it has to be a string
3 Create a Java plugin that can convert your media_id_string to a long numeral format
Appian does not support that number. 710511363345354753 simply cannot ever be expressed as a literal numeric value with all it's digits in Appian no matter how hard you try. You're at 710 quadrillion, and the max safe integer value for 64 bit Double type is only a little above 9 quadrillion; you can't even store that in the Decimal type accurately. You're about two orders of magnitude above the maximum odd integer that will fit in the variable. You'd need a Java BigDecimal or Java long type or a C# Decimal to have a hope of storing it all. The makers of this API were honestly quite foolish to demand a numeric value this long. An ID should never be a numeric value anyway. I would never store a social security number as anything but a string, especially since social security numbers can begin with a zero. The main problem is that leaving them as a numeric type can cause developers to mistakenly perform arithmetic on it.
This is not Appian's fault. This is the API's fault, honestly. I don't understand either why the number is that large or even how it is that large. How did they even return a JSON number that large? Javascript uses exclusively 64 bit Double float type for numbers, so again wouldn't JSON have a cap at 9 quadrillion?