question

ren avatar image
ren asked

Is there an invalid value in the instance ID

I have an Instance ID (ItemInstanceID) in ulong and want to determine if that value is an invalid value. Is there an invalid value (0 etc.) in the InstanceID?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

The ItemInstanceId is a hex-encoded number that can consist of letters from A to F and numbers from 0 to 9. It can’t contain the letters that beyond F, and the punctuation marks, special characters, etc. If you submit the invalid ItemInstanceId that contains the invalid characters to PlayFab API, such as GetUserInventory, it will return the error "ItemInstanceId": [must be a hex-encoded number"].

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ren avatar image ren commented ·

Hello, Thanks for the your answer!

Am I right in thinking that the instance ID may return all the values that u64 can take?

If that's the case, then if I want to handle invalid values in my game, I need to keep them in a null-allowed type like string or boost's optional<ulong>, which is a bit cumbersome.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang ren commented ·

Currently, our hexadecimal-encoded numbers are 16-bit strings. Their corresponding decimal numbers can be taken as u64. But there are no obvious restrictions on hexadecimal coded numbers. It may exceed the value range of u64 in the future.

0 Likes 0 ·
ren avatar image ren Sarah Zhang commented ·

Thank you for answering!
It was very helpful

0 Likes 0 ·
Show more comments
ren avatar image ren commented ·

@Sarah Zhang
Thank you for answering!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.