Message Boards Message Boards

A ServiceConnection for Wolfram Community

GROUPS:

Wolfram Community has no API, unlike StackExchange , but as Sander Huisman showed that just means we need to be a bit more creative (read hacky).

To that effect, I built a ServiceConnection using a framework I wrote up ~6 months ago and have been hacking away with ever since.

Installation

I've loaded the connection onto my paclet server so you can load it like this:

PacletInstall["ServiceConnection_WolframCommunity",
 "Site"->"http://www.wolframcloud.com/objects/b3m2a1.paclets/PacletServer"
 ]

(*Out:*)

paclet-blob

Connecting to the "API"

Connect as usual:

$so=ServiceConnect["WolframCommunity"]

(*Out:*)

conn

And it's ready to go.

Requests:

Currently I only have a few requests:

$so["Requests"]

(*Out:*)

{"Authentication","DiscussionInfo","Discussions","ID","Information","Name","People","PersonInfo","RawRequests","RequestData","RequestParameters"}

Discussions

That "Discussions" request is adapted almost directly from the one Sander showed:

disc=$so["Discussions"]

(*Out:*)

dics

People

But I've added a people searcher:

peep=$so["People", "Page"->1,"Tab"->"B"]

(*Out:*)

peep

PersonInfo

And I can extract my data:

me=peep[[2, "ID"]]

(*Out:*)

1186443

$so["PersonInfo", "ID"->me]

(*Out:*)

me

Or someone else's:

$so["PersonInfo", "ID"->78216]

(*Out:*)

other

And that's pretty much all I have for now, but I can add features on request.

RequestParameters

You can check the available parameters to a command using the "RequestParameters" I stick in all of my paclets:

$so["RequestParameters", "r"->"Discussions"]

(*Out:*)

<|"Parameters"->{"GroupType","DiscussionType","SortBy","PageSize","Page"},"Required"->{"GroupType","DiscussionType","SortBy","PageSize","Page"}|>

Although this is currently broken for the "People"

$so["RequestParameters", "r"->"People"]

(*Out:*)

<|"Parameters"->{"p_p_id","p_p_lifecycle","p_p_state","p_p_mode","p_p_col_id","p_p_col_pos","p_p_col_count","_people_WAR_peopleportlet_tabs1","_people_WAR_peopleportlet_orderVar","_people_WAR_peopleportlet_delta","_people_WAR_peopleportlet_keywords","_people_WAR_peopleportlet_advancedSearch","_people_WAR_peopleportlet_andOperator","_people_WAR_peopleportlet_cur"},"Required"->{}|>

The parameters for that are actually:

{
 "PortletID",
 "PortletLifecycle",
 "PortletState",
 "PortletMode",
 "PortletColumnID",
 "PortletColumnPosition",
 "PortletColumnCount",
 "Tab",
 "SortBy",
 "PageSize",
 "KeyWords",
 "AdvancedSearch",
 "AndOperator",
 "Page"
 }

But there's an internal detail my introspection code doesn't account for yet, so you see the nasty looking actual parameter names.

Performance

One final detail: this service connection is slooooooooooow .

But unfortunately there's nothing to do about that because Wolfram Community is sloooooooooooooooooooooooow . Something's probably misconfigured in the underlying API or framework. Or maybe it's just a bad framework to begin with.

In any case this:

URLRead["http://community.wolfram.com", "StatusCode"]//AbsoluteTiming

(*Out:*)

{3.924212`,200}

Is really unacceptable for a modern website.

And this:

URLRead["http://community.wolfram.com/people", "StatusCode"]//AbsoluteTiming

(*Out:*)

{12.649381`,200}

Is just ridiculous.

Until Wolfram Community joins the modern era performance wise, the ServiceConnection will be creaky.

POSTED BY: b3m2a1 ​ 
Answer
14 days ago

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming! We are working on resolving slowness issues, and hope members can be tolerant and patient as we are moving towards better architecture.

POSTED BY: Moderation Team
Answer
13 days ago

Group Abstract Group Abstract