Olen/Spond

get Spond data

Closed this issue · 8 comments

Thank you for this code. I'm a PHP-developper, so I have to translate it. I work with "cUrl".
Now, I just finished the first step (login), so I get back a token and my phonenumber. Additionally I get a message on my mobile with a code.
But I don't know how to resend this, to get the data (e.g. getEvents).
Can someone help me?
Thank you in advance.

Olen commented

Sounds like 2 factor authentication. Since the message is sent to your phone, it is extremely hard to automate any login with 2FA enabled.
So either you need to turn off 2FA in Spond, or you must find a way to manually enter the code every time.

Since I've disabled the 2fa, no data is in the response (only "{}").
When using a wrong name/passwort, I'll receive a message ("wrongEmailOrPassword"). So I think, my code is right.
Any other hints?

Olen commented

You need to first log in, to get a token, and then use that token in all further requests.
In python I use a "cookiejar" to store the cookies received when logging in, and sending the proper cookies back to the server for each request.
Exactly how to do it in PHP is unfortunately not something I can help you with.

Thanks a lot for your help. Now it works for me with PHP.
Do you know if there are other methods to work with?

Re 'other methods': what are you trying to do?

I wan't to get the events of all subgroups, but this is only possible, if the user is part of the group. Do you know if there is another way to do that?
Another idea is to send posts over the api. Is this possible?
I want to send messages to a group (type="GROUP", name="test"). How do I put this into the "recipient"?

get the events of all subgroups, but this is only possible, if the user is part of the group

As far as I know the user has to be a member of a group to get info about it - this is a built-in feature of the Spond system.

send messages to a group

I have never used this functionality, but I guess you could get all the members of a group, then send to each one individually. I believe migrating to the 'Spond Clubs' functionality gives more messaging options in the UI.

Remember that the API is undocumented, so functions provided in the code here are the result of experimenting, and examining the resulting API calls made from the browser.

Closing as it appears to have been answered as far as possible (and it's really about Spond API in general, not within scope of this project)