How can I get the id of some Weibo post - weibo

I need to know the ID of the posts in Weibo, because I want to do a call to the API and the weibo ID is required, so I don't know how to obtain this ID from an URL.
this is an example for a URL:
http://www.weibo.com/1833141401/AC1klvp6U?mod=weibotime
I thought that 1833141401 was the ID but the API response that the weibo doesn´t exist.
Has anyone worked with this API?

For the url http://www.weibo.com/1833141401/AC1klvp6U :
1833141401 is the user id (uid).
AC1klvp6U is the microblogging id (mid) as weibo calls it.
that mid is base62 encoded.
You could call the weibo API to get the id.
The endpoint you want is /statuses/queryid/en
Example call:
https://api.weibo.com/2/statuses/queryid.json?mid=AC1klvp6U&type=1&isBase62=1
Or you can add your own function to convert that mid to the id like in this post: http://tech.kawo.com/post/74682997654/using-base62-to-generate-a-sina-weibo-post

Weibo uses 2 formats for the same id. You can base64 encode that ID to get the id in the same format that the API accepts.
More info and code samples to perform the operation here: http://blog.sina.com.cn/s/blog_4a238ec201012pnb.html

Related

What data can I save in my database to verify a user with Google sign in API?

I need to store data related to a (Google) user in my database. I tried to store the id_token, but later found out that the part after the '.' changed. What can be used instead, or can I just save the part infront of the "." from the id_token?
Thanks Steven Soneff
Use the 'sub' field of the ID token, it is invariant for the Google user https://developers.google.com/identity/sign-in/android/backend-auth#calling-the-tokeninfo-endpoint
The ID token have three parts; the header, body and signature, divided by a '.' (header.body.signature). Each part is encoded with base64. If you decode the body, you will get a JSON like this:
{
"iss":"https://accounts.google.com",
"at_hash":"xxx",
"aud":"xxx.apps.googleusercontent.com",
"sub":"xxx",
"email_verified":true,
"azp":"xxx.apps.googleusercontent.com",
"email":"xxx#gmail.com",
"iat":xxx,
"exp":xxx
}
...you can safely retrieve and use the user's unique Google ID from the sub claim
So you can save the sub in your database to identify your user

Get post code from getlinkinfo

Is there a way to get the post code as part of the address returned by the getlinkinfo resource of the routing API? Example:- http://route.st.nlp.nokia.com/routing/6.2/getlinkinfo.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&waypoint=50.05564304861044,8.38889128575724&linkattributes=all returns street, city, country but not postcode
You can use the HERE Geocoder API and do a reverse geocode for the position. This will get you the postal code among other location information and link attributes (locationattributes=linkInfo). The last option is new since this week. Let me know if this helps or what exactly you are trying to do and what response details you need.
Following is an example call:
http://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&gen=8&maxresults=1&mode=retrieveAddresses&prox=50.05564304861044%2C8.38889128575724%2C250&locationattributes=linkInfo

Universal Analytics: Client ID

The documentation about Client ID states that it must be a UUID
Example usage: cid=35009a79-1a05-49d7-b876-2b884d0f825b
But when looking at the calls that analytics.js is issuing, I see that the value has another format:
cid:714937391.1406537193
What are those values? and how are they generated? Can I use the same value if I want to append events to that session from a different application?
Is the Client ID used as the session identifier?
The documentation is a bit misleading. The client ID doesn't technically need to be a UUID hash in that format. It's merely suggesting that format to help people avoid generating duplicate client IDs by accident.
The format of the client ID in analytics.js is a randomly generated 31-bit integer followed by a dot (".") followed by the current time in seconds.
If you wanted to generate a client ID in this format yourself (for whatever reason) you could do something like the following:
var cid = Math.floor(Math.random() * 0x7FFFFFFF) + "." + Math.floor(Date.now() / 1000);
To answer your other question, yes, you can use the same client ID in a server-side Measurement Protocol hit as you find in the cookie generated by analytics.js and the sessions will be linked.
Furthermore, if you wanted to make sure your server-side hits were as closely linked to your client-side hit as possible, you should also use the User Agent and IP override fields, which are new to the measurement protocol. If you don't, then all the geo data for your server-side hits will look like it came from wherever your server is located.
UPDATE
Also, in case it's not clear how to get the client ID from JavaScript, here's what the documentation recommends:
ga(function(tracker) {
var clientId = tracker.get('clientId');
});
Note that it recommends not reading the data directly from the cookie.

Find segment ID in Google analytics?

I am trying to output the content of a Google Analytics segment using a script called Oochart.
To do this I need the segment ID, how do I find this?
There's no simple way. You either have to try to read it from the URL when you apply the segment, or select the segment in the query explorer (http://ga-dev-tools.appspot.com/explorer/) which will then show the segment ID.
While the best answer is the one from LCarey (to use the Query Explorer: http://ga-dev-tools.appspot.com/explorer/) I found that the answer from Pavel needs update if you want to go that way instead, as the URL structure has changed.
Consider the following URL:
https://analytics.google.com/analytics/web/#report/defaultid/a23080303w45291587p45450834/%3F_.useg%3DuserfSRDEURzSXe_Kspo6mxgXw/
You're looking for the string "_.useg%3Duser", after which the segment ID (fSRDEURzSXe_Kspo6mxgXw) follows. To use this in API I would use gaid::fSRDEURzSXe_Kspo6mxgXw.
The advanced segment feed provides a listing of all the default and user-created advanced segments. You can retrieve the ID of all the segments here in this standalone Explorer. (under the Try it! headline):
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/segments/list#try-it
You'll need to authenticate the requests using OAuth 2.0.
As LCarey briefly mentioned, you can read it from URL. I will clarify that by example.
Apply the segment and see the URL.
Example:
https://www.google.com/analytics/web/#report/visitors-overview/a27824002w53282758p54121492/%3F_.advseg%3Duser1417962107/
You are looking for advseg parameter. In this case the segment ID is user1417962107. Characters %3D mean encoded equal sign "=".
In API you would use segment=gaid::user1417962107

Is it possible to use a search string url with Google Calendar

Would any body know if it is possible to search calendar events with a url string?
For example with gMail you could use:
https://mail.google.com/mail/?shva=1#search/Search+Term
to search for the words 'search' and 'term'
Any help or advice greatly appreciated.
Cheers
Noel
This is how you can search Google Calendar using a query parameter in the url:
https://www.google.com/calendar/render?q=TERM
where TERM is the string you're searching for.
So, you can search using a GET request.
Using Chrome's dev tools, it appears as though Google Calendar searches are performed using a POST request, so you won't be able to pass search terms into urls to fetch a response (which would be a GET request).
Update: Looks like a GET request will still return results, but the response is some form of JSON.
Here is the url (I x'd out my specific info), looks like its not meant for what you want to use it for:
https://www.google.com/calendar/search?ctz=America/New_York&hl=en&as_tp=basic&as_myuids=xxx&as_otheruids=xxx&as_q=kai%20mallea&as_cal=xxx;xxx&secid=xxx
A generalization of the current answer is:
https://calendar.google.com/calendar/b/0/render?q=TERM
where 0 is the index of the desired Google account (if you have multiple accounts).

Resources