Can not delete items via POST

35 views
Skip to first unread message

sziegler

unread,
Dec 15, 2011, 5:22:15 PM12/15/11
to Springpad Developers
Hi everyone,

I'm having trouble to delete items via https://springpadit.com/api/users/me/commands
and POST method. I authenticate via headers and not via oauth!
Everything with GET works well.

This is what I send as body:
[["delete","/UUID(3632c2a4-ad45-4b60-b653-af78aed2d9ae)/"]]

I always get the following response:
{"status":"error","message":"Invalid input"}

Can somebody please help me?

Cheers,
Sven

Chuck Garofalo

unread,
Dec 16, 2011, 9:22:01 AM12/16/11
to Springpad Developers
Hi Sven,

The POST body as you described is correct. I was able to successfully
POST a command with that body. However, on a hunch I tried an invalid
Content-Type header and I was able to get the same error message that
you are experiencing with such an invalid value. Perhaps this is the
cause of your issue. The most accurate Content-Type is "application/
json", though I also tried "text/plain" and that worked as well.

Can you give that a try? Please let us know if that doesn't work for
you and we can explore further into this problem.

Regards,
Chuck

On Dec 15, 5:22 pm, sziegler <dunkings...@googlemail.com> wrote:
> Hi everyone,
>

> I'm having trouble to delete items viahttps://springpadit.com/api/users/me/commands

sziegler

unread,
Dec 16, 2011, 11:15:17 AM12/16/11
to Springpad Developers
Hi Chuck,

thanks for your response, but I already use this content-type. This is
my header:

headers = {
"X-Spring-Username": "myuser",
"X-Spring-Password" : "mypass",
"X-Spring-Api-Token" : "mytoken",
'X-Spring-Client-Version': "1.0.0",
'X-Spring-Client': "SpingOnTouch",
'Content-Type': 'application/json; charset=UTF-8',
'Referer': "http://sven-ziegler.com",
'X-Spring-Api-Version' : '6'
};

And as I mentioned before, for GET this headers works.

Cheers,
Sven

Chuck Garofalo

unread,
Dec 19, 2011, 9:24:27 AM12/19/11
to Springpad Developers
Hi Sven,

You have me a bit stumped here. I was able to successfully send a
post request with the headers and data as you described above
(substituting user, pass, token and I changed up the uuid a bit). I
received the success response. Here is the exact command I ran.
Maybe you could examine this and see any differences from what I'm
doing and what you are doing.

curl -XPOST "https://springpadit.com/api/users/me/commands" --header
"X-Spring-Username:user" --header "X-Spring-Password:pass" --header "X-
Spring-Api-Token:token" --header "Content-Type:application/json;
charset=UTF-8" --header "X-Spring-Client-Version:1.0.0" --header "X-
Spring-Client:SpingOnTouch" --header "Referer:http://sven-ziegler.com"
--header "X-Spring-Api-Version:6" -d "[[\"delete\",\"/UUID(3632c2a4-
ad45-4b60-b653-af78aed2d9bb)/\"]]"

I can tell you that specifically this is related to the request
payload. That error is only generated when we cannot parse the data
in the body of the message as valid json. So you would get this
message if your json is malformed or if your Content-Type is a
mismatch such that we read the payload as empty data. What you have
there looks ok to me but perhaps it isn't properly escaped or
something similar to that.

Can you try running this curl command with your user/pass/token and
see what happens?

Regards,
Chuck

sziegler

unread,
Dec 19, 2011, 1:50:59 PM12/19/11
to Springpad Developers
Hi Chuck,

that curl command tuns without problems. So after looking at my code
and doing some more tests I was able to get it working, but the
mysterious is: I don't exactly know what makes it work. :( But I'm
happy that it works now.

Thanks for helping my out with this curl string, that was a good test
for my implementation!

Cheers,
Sven

Sven Ziegler

unread,
Feb 7, 2013, 4:17:37 PM2/7/13
to Sampath Vangari, spring...@googlegroups.com, Sven Ziegler
Hi,

I'm sorry but I do not use oAuth currently.

Best,
Sven


2013/2/7 Sampath Vangari <vbsa...@gmail.com>
Hi Sven

Did you use oAuth? Well if you have used oAuth then I might require your knowledge on manipulating data on springpad. All I can do for now is that get all my blocks and by using oAuth ...but when I started working on POST requests I get authentication failure kind of messages. If you have any experience in any of my problems please help me. If you are not sure then I can post my code here.
Reply all
Reply to author
Forward
0 new messages