Problems with subscriptions

1 view
Skip to first unread message

Dave Cracknell

unread,
Jan 7, 2010, 6:01:54 PM1/7/10
to MySpace APIs
Yesterday I was able to successfully generate a subscription request
and receive data. We had a system problem and our endpoint went
down, which meant that the subscription became deactivated. I am able
to issue a GET request for that subscription and see the following
info returned (I have removed the referrence to the actual endpoint):
{"Subscription" : {
"id" : 1875,
"Status" : "Deactivated",
"Type" : "All",
"Endpoint" : "http://<enpoint url>",
"Query" : {},
"MetaData" : "",
"BatchSize" : 1,
"Rate" : 1,
"Format" : "application/atom+xml",
"UserList" : {
"AddList" : [],
"RemoveList" : []
}
}}

I then use exactly the same logic as the GET request, but replace GET
with DELETE and I am getting error 401 returned. Is there a problem
with DELETE or am I doing something incorrectly?

I then attempted to submit the same subscription request (running the
same Python script) that worked yesterday and I am getting error 400
returned. Is there a problem with subscription handling?

Dave Cracknell

unread,
Jan 8, 2010, 9:09:08 PM1/8/10
to MySpace APIs
For the POST problem, here is the subscription request that I getting
error 400 returned on:
'{"Subscription": {"Rate": 1, "Endpoint": "http://<endpoint url>",
"Type": "All", "BatchSize": 1, "Format": "application/atom+xml"}}

I have not shown the actual endpoint above.

The POST problem is the more urgent as it is preventing me from
accessing any data.

Thanks for any help with this.

ken ellis

unread,
Jan 9, 2010, 3:04:09 PM1/9/10
to MySpace APIs
For the DELETE, if you're using that python script I wrote, you have
to set the http method manually through a urllib2 request, for
example:

delreq = urllib2.Request(req.to_url())
delreq.get_method = lambda: 'DELETE'
resp = urllib2.urlopen(delreq)

Sorry for the confusion. I'm kind of hacking my way through oauth,
since that python library doesn't fully support the operations needed
for the stream API, although in this case it might have a way of
supporting simple deletes. I just use the library for signing
requests and generating URLs. I'll add a note to it.

ken ellis

unread,
Jan 9, 2010, 2:49:33 PM1/9/10
to MySpace APIs
For the POST problem, do you already have a subscription with the same
definition? If you try to create duplicate subscriptions, even if the
other one has a status of deactivated, it will return a 400 bad
request.

Dave Cracknell

unread,
Jan 10, 2010, 10:30:23 PM1/10/10
to MySpace APIs
Ken,
You were correct, the problem was that I was trying to create a
duplicate subscription. Once I was able to delete the exisitng
subscription I was then able to create a new subscription.

Thanks,
Dave

> > > returned.  Is there a problem with subscription handling?- Hide quoted text -
>
> - Show quoted text -

Bryan

unread,
Jan 11, 2010, 2:48:42 PM1/11/10
to MySpace APIs
If a subscription gets deactivated, it can be re-activated by doing a
PUT with the status set to "Active". You don't need to delete and re-
create.

Also, if you get an error, check the HTTP response header "x-
opensocial-error" for additional error info such as:
x-opensocial-error: The subscription is a duplicate of subscription
12345 associated with this application.

Reply all
Reply to author
Forward
0 new messages