将博客条目发布到社区 [英] Posting Blog Entries to a Community

查看:104
本文介绍了将博客条目发布到社区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的工具是使用Connections API将博客条目提交给配置社区的id博客.

Our tool is submitting blog entries to the idation blog for a configured community by using the Connections API.

因此,我使用以下工作流程,仅提供社区ID:

Therefore, I use the following workflow, given only a community ID:

1) query /blogs/api/blogs?commUuid=<ID_HERE>&blogType=ideationblog
2) retrieve the link to the communities ideation blog from the xml result of aboves query. the xPath for this is "/app:service/app:workspace/app:collection[a:category[@term='entries']][1]/@href"
3) post the created blog entry payload to this url.

在我们的环境中,一切都很好.但是,当我在客户那里部署它时,它不再起作用了.第一步的url返回一个空的xml文档,因此无法执行以下步骤.我尝试在客户服务器上查询不同的url,例如/blogs/{homepageHandle}/api/blogs?commUuid =& blogType = ideationblog,它可以正常工作,但是对上述api服务文档的查询是唯一一个包含该集合的URL元素加上我需要的链接.

This all worked fine in our environment. However, when I deployed this at a customer, it did not work anymore. The url from the first step returns an empty xml document, and the following steps thus cannot be executed. I tried to query different urls on the customers server like /blogs/{homepageHandle}/api/blogs?commUuid=&blogType=ideationblog which work fine, however the query to the api service document above is the only one which contains the collection element with the link I need.

还有其他我可以做的API调用来获取此URL吗?您是否知道任何原因,为什么通话在我们的环境中可以正常工作,但对客户而言却失败了?这可能是访问权限问题吗?

Is there any other API call I can do, to get this url? Do you know of any reason, why the call is working just fine in our environment, but fails at the customer? Might this be an access rights problem?

我知道,我可能可以创建一个像"blogs//api/entries"之类的网址并发布到该网址,但是我更喜欢上面的方式,因为我只配置了communityUuid,并且因为完全符合API文档描述的方式:

I am aware, that I could probably just create a url like "blogs//api/entries" and post to it, however I would prefer the above way, since I only have the communityUuid configured, and also because it is exactly the way that the API Documentation describes:

ServiceDoc->集合-> href

ServiceDoc -> Collection -> href

更新:

这确实可能是SBT的问题.我的假设是,返回了一个空的xml文档是错误的,而是通过SBT Endpoint类进行的调用返回了null.

This might be a problem with the SBT really. My assumption, that an empty xml document was returned was wrong, it is rather that calls via the SBT Endpoint classes are returning null.

Endpoint endpoint = EndpointFactory.getEndpoint("connections");
Object result = endpoint.xhrGet("/blogs/api"); // also tried for /blogs/<homepage>/api

当我再次在浏览器中尝试这些URL时,得到了完整的结果.所有这一切的问题是,我既不能在自己的环境中复制它,也不能在客户那里调试它.我试图从中捕获可能的异常,但是没有抛出异常.只是结果为空.

When I again tried those URLs in the Browser, I got the complete results. Problem with all this is, that I can neither reproduce this in our own environment nor am I able to debug this at the customer. I tried to catch possible exceptions from this, but none are thrown. It's just that the result is null.

要澄清:在我们自己的(Connections 4.0)环境中,以及从客户的浏览器中,相同的请求都可以很好地工作.我当然在浏览器中使用相同的用户进行身份验证,就像在API调用中一样.

To clarify: The same requests work perfectly fine in our own (Connections 4.0) environment, and also from the browser at the customer. I am of course using the same user to authenticate as well in the browser as in the API calls.

endpoint.isAuthenticationValid();

也会返回true,所以那里似乎没问题...

also returns true, so seemingly no problem there...

推荐答案

我很早就放弃了尝试遵循IBM记录的REST API指令(尤其重要的是,因为它总是以无数的REST请求结尾,只是为了获得我需要向其发送请求的网址).

I have long ago given up trying to follow the IBM documented REST API instructions (not least of all because it always ends in a myriard of REST requests just to get to the URL I need to send my request to).

我在所有Connections 4.5系统上都尝试了两个URL(/blogs/api/blogs?commUuid = ...和/blogs/< homepage>/api/blogs ...),但尽管我确实得到了xml文档,它在任何地方都不包含对ideationblog的引用(是的,我确保要针对确实包含ideation博客的社区进行查询.)

I tried both your URLs (/blogs/api/blogs?commUuid=... and /blogs/<homepage>/api/blogs...) against all our Connections 4.5 systems, but although I do get an xml document back it doesn't contain a reference to the ideationblog anywhere (and yes, I made sure to quest against a Community that does contain an ideation blog).

这是一个肮脏的解决方法,您提到您不想这样做,但是由于记录的方法不起作用,所以我使用了它:

This is a dirty workaround, which you mentioned you did not want to do, but which I do use because the documented way doesn't work:

要发布博客条目,您需要针对

To post blog entries, you need to POST against

/blogs/<bloghandle>/api/entries

要在您的社区中找到想法博客的句柄(< snx:handle>),您可以执行以下操作:

To find out the handle (<snx:handle>) of the ideation blog in your community, you can do the following:

1.) Get the widgets-feed for the community: /communities/service/atom/community/widgets?communityUuid=...
2.) Navigate to the entry of the Ideation Blog widget: <snx:widgetDefId>IdeationBlog</snx:widgetDefId>. 

除非您的客户系统中的某人弄乱了widgets-config.xml,否则widgetDefId将是IdeationBlog.

Unless someone in your customer system has messed with the widgets-config.xml, the widgetDefId will be IdeationBlog.

3.) Take the <snx:widgetInstanceId> text of the Ideation Blog entry. 

这是您构想博客的内容. (是的,社区构思博客是使用Ideation Blog窗口小部件的widgetInstanceId作为句柄创建的.普通博客是使用其标题的某些混搭作为句柄来创建的).现在,您可以构造URL,以将条目发布到该地址.

That is the handle of your ideation blog. (Yes, community ideation blogs are created with the widgetInstanceId of the Ideation Blog widget as handle. Normal blogs are created with some mashup of their title as handle). You can now construct the URL to post the entries to.

这篇关于将博客条目发布到社区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆