0

So I am able to make a post on weibo account using statuses/upload but I am unable to make a post on weibo account using statuses/share.

Both takes access_token, status,pic as mandatory parameter with multipart / form-data.

And I am getting the following error

{"error":"text not find domain!","error_code":10017,"request":"/2/statuses/share.json"}

Now, I narrowed down the source of the exception to status field but I still couldn't solve it:

status field for statuses/share says 用户分享到微博的文本内容,必须做URLencode,内容不超过140个汉字,文本中不能包含“#话题词#”,同时文本中必须包含至少一个第三方分享到微博的网页URL,且该URL只能是该第三方(调用方)绑定域下的URL链接,绑定域在“我的应用 - 应用信息 - 基本应用信息编辑 - 安全域名”里设置。

In english : Users to share text content microblogging, must do URLencode, the content is not more than 140 characters, the text can not contain "# # topic word," while the text must contain at least one third-party web page URL to share micro-blog, and the URL is only URL links under the third party (the caller) binding domain, a binding domain in the "my Apps - application information - basic information editing application - security domain" in the settings.

status field for statuses/upload says 要发布的微博文本内容,必须做URLencode,内容不超过140个汉字。

In English: To publish microblogging text content, must do URLencode, the content is not more than 140 characters.

So, status in statuses/share expects URL, but even though

  1. I am URLencoding it

  2. I have added a domain in security domain secion

  3. I am passing the domain URL in it status.

    it still gives me the above error.

So I am assuming status field is looking for some format which I missed. Anyone encountered and fixed such exception?

Community
  • 1
  • 1
j4rey
  • 2,582
  • 20
  • 34

2 Answers2

1

Sorry for late answer. Hopefully this helps someone in the future.

Weibo API is very unclear regarding the accepted format of parameter it expects.

So, statuses/upload accepts a pic as a binary and status as a string, you can pass a URL in status and it will publish it just fine.

however, statuses/share also accepts a pic as a binary and status as a string, but status will accept URL if that URL domain is added as one of the security domain in application information of your Weibo Application.

Now here's what I doing wrong.

I was adding 'google.com', because the error message on that box says

"Please fill in the main domain name and secondary domain name..." enter image description here

I later on decided to add the full URL 'www.google.com' and then it worked.

So when you try to save only 'google' in security domain, it won't allow you and will give you an error message. When you try to save 'google.com', it will let you save it but it won't be able to find any URL you provide like 'http://www.google.com' and will give you an error message when you try to send it with statuses/share. You have to save 'www.google.com' in security domain then only you will be able to pass 'http://www.google.com' in status parameter of statuses/share

Hopefully I am able to explain it clearly to those who comes here with this error.

j4rey
  • 2,582
  • 20
  • 34
0

Update:

I'm now sure that the share API won't work if the domain of the shared URL in the status is not exactly the one set in your App settings.

What's worse, for PC App, you can only set one domain for your App. So if you set it to your "main" domain then you can't share URLs from your subdomain.

However the workaround solution is simple: just share a URL from your "main" domain and redirect it to your subdomain. Say you shared http://subdomain/abc before, then you may share http://maindomain/share/abc, and then redirect the latter to the former. It involves minor changes in your HTTP config. Take apache for example, you can add this line to your "main" server's config:

Redirect "/share" "http://subdomain"

That's it!


I have the same problem. I doubt this is because the URL in your status points to a domain other than the one set in your application settings - it doesn't work even when pointing to a subdomain of your binding domain. I'm communicating with support of Weibo for this and will update the answer when I get feedback, though their support is always slow.

BTW, it seems like Stackoverflow doesn't support pure Chinese answer. Damn it!

Robert
  • 1,964
  • 1
  • 22
  • 22
  • You are right subdomain will not work. You will need to add that subdomain in your security domain. I chosen to use *statuses/upload*. I have found it exactly the same except without the URL domain checking. – j4rey Jul 04 '17 at 09:54
  • But `statuses/upload` is not available any longer. See http://open.weibo.com/blog/%E3%80%90%E5%B9%B3%E5%8F%B0%E5%85%AC%E5%91%8A%E3%80%91%E5%BE%AE%E5%8D%9A%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0%E5%88%86%E4%BA%AB%E5%88%B0%E5%BE%AE%E5%8D%9A%E6%8E%A5%E5%8F%A3%E5%8D%87%E7%BA%A7%E5%85%AC – Robert Jul 04 '17 at 12:03
  • `statuses/upload` is still working for now....it might get deprecated or if it does get deprecated then will have to switch to `statuses/share` – j4rey Jul 04 '17 at 13:31