Sina Weibo data mining recently, need to call the Sina Weibo API, which requires the incoming user ID, that is, UID, for the int64 type.
source_id |
False |
Int64 |
The UID of the source user. |
And there is no int64 type in Java, it's natural to start with long, because the range is not enough with Int.
Long uid = 2479449007l; or long uid = 2479449007;
Invokes the UID as a parameter to the API, resulting in an error
{"Error": "Parameter (source_id) ' s value invalid,expect (long), but get (2.479449007E9), and the doc for more info.", "error_cod E ": 10017," request ":"/2/friendships/show.json "}
You can see that Java automatically uses the UID notation in scientific notation.
How to not let it automatically converted into scientific counting method, toss for a long time, has not been able to ruyi.
At last I tried to pass the string directly,
String uid = "2479449007";
It seems that this API document, although it says you want to pass in the int64, can be passed in directly to the string.
BTW
If you read a string as a parameter modulation API in text file (TXT) form, the encoding format is ansi,utf-8 and the following error will be reported.
{"Error": "Parameter" (source_id) ' s value invalid,expect (long), but get (1978506667), and the doc for more info. "," Error_code " : 10017, "request": "/2/friendships/show.json"} Sina Weibo is so proud ....