Feature: REST API refactoring

Your opinion is very appreciated!

what's your opinion?

That's hot, i like it!
5
100%
Yes, but not need it!
0
No votes
Maybe later.
0
No votes
Better not.
0
No votes
 
Total votes: 5

User avatar
Madsonic
Administrator
Administrator
Posts: 984
Joined: 07 Dec 2012, 03:58
Answers: 7
Has thanked: 1201 times
Been thanked: 470 times

Feature: REST API refactoring

Unread post by Madsonic »

FEATURE:

REST API 2.0

Version 2.0 of the REST API implies the Subsonic protocol.

to make it more backwards compatibly

* add new security layer and inteceptors
* native support of the Subsonic REST API 5.3


Example:

http://localhost:4040/rest/ping.view?u= ... 3.0&c=rest

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.13.0"/>


http://localhost:4040/rest2/ping.view?u ... 0.0&c=rest

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<madsonic-response xmlns="http://madsonic.org/restapi" status="ok" version="2.0.0"/>
daneren2005
Developer
Developer
Posts: 23
Joined: 03 Jan 2014, 00:20
Has thanked: 1 time
Been thanked: 8 times

Re: Feature: REST API refactoring

Unread post by daneren2005 »

I like it, BUT can you add something else such as madsonic="2.0.0" so I know that I can also use 2.0.0. Otherwise I will run the first test and it will return 1.13.0 and I will just continue on ignoring the newer API version.
User avatar
Madsonic
Administrator
Administrator
Posts: 984
Joined: 07 Dec 2012, 03:58
Answers: 7
Has thanked: 1201 times
Been thanked: 470 times

Re: Feature: REST API refactoring

Unread post by Madsonic »

with Madsonic 6.0 default installation build >7300

environment

host: localhost
port: 4040
user: admin
password: admin
secret: xfhn8gf4gv
token: md5("admin" + "xfhn8gf4gv") = abf0abaeeb6ac8328828576c64c8cc2a&s

REST API SYNTAX

Code: Select all

SUBSONIC REST: 1.13.0 <SERVER>:<PORT>/REST/<API-METHODE>/?<ARGUMENTS>
MADSONIC REST: 2.0.0  <SERVER>:<PORT>/REST2/<API-METHODE>/?<<ARGUMENTS>
return

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.13.0" type="subsonic"/>

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<madsonic-response xmlns="http://madsonic.org/restapi" status="ok" version="2.0.0" type="madsonic"/>

Subsonic REST 1.13.0 emulator service

http://localhost:4040/rest/ping.view?u= ... rest&f=xml
http://localhost:4040/rest/ping.view?u= ... rest&f=xml
http://localhost:4040/rest/ping.view?u= ... rest&f=xml

Madsonic native REST 2.0.0 service

http://localhost:4040/rest2/ping.view?u ... rest&f=xml
http://localhost:4040/rest2/ping.view?u ... rest&f=xml
http://localhost:4040/rest2/ping.view?u ... rest&f=xml

Example with difference

http://localhost:4040/rest/getGenres.vi ... rest&f=xml
http://localhost:4040/rest2/getGenres.v ... rest&f=xml

will fail: wrong version against server (don't use)

http://localhost:4040/rest/ping.view?u= ... est&f=json
http://localhost:4040/rest2/ping.view?u ... est&f=json

recommended use

http://localhost:4040/rest/ping.view?u= ... rest&f=xml
http://localhost:4040/rest2/ping.view?u ... rest&f=xml

Online demo test

http://demo.madsonic.org/rest/ping.view ... rest&f=xml
http://demo.madsonic.org/rest2/ping.vie ... rest&f=xml

http://demo.madsonic.org/rest/getGenres ... rest&f=xml
http://demo.madsonic.org/rest2/getGenre ... rest&f=xml

http://demo.madsonic.org/rest/getArtist ... rest&f=xml
http://demo.madsonic.org/rest2/getArtis ... rest&f=xml


best regards
daneren2005
Developer
Developer
Posts: 23
Joined: 03 Jan 2014, 00:20
Has thanked: 1 time
Been thanked: 8 times

Re: Feature: REST API refactoring

Unread post by daneren2005 »

With that I have no way of knowing that I can switch to using the 2.0 API for Madsonic. By default I will send a request saying that the app requires a min of 1.2. It will then respond with saying that it is subsonic and the version is 1.13. I will have no way of knowing that it is a Madsonic server and I can switch to 2.0. In the first response some sort of madsonic-version would be nice so I can key onto that and use it.
User avatar
Madsonic
Administrator
Administrator
Posts: 984
Joined: 07 Dec 2012, 03:58
Answers: 7
Has thanked: 1201 times
Been thanked: 470 times

Re: Feature: REST API refactoring

Unread post by Madsonic »

daneren2005 wrote:With that I have no way of knowing that I can switch to using the 2.0 API for Madsonic. By default I will send a request saying that the app requires a min of 1.2. It will then respond with saying that it is subsonic and the version is 1.13. I will have no way of knowing that it is a Madsonic server and I can switch to 2.0. In the first response some sort of madsonic-version would be nice so I can key onto that and use it.

Hi Scott,

i saw the same problems with the madsonic client, so i changed some things that help API clients to communicate with the server.

http://beta.madsonic.org/pages/api.jsp#Implementation

http://beta.madsonic.org/pages/api.jsp#getApi

PS: comes with next build

best regards
Post Reply