Web API : what is the post key value ?
|
03-10-2016, 18:32
Post: #1
|
|||
|
|||
Web API : what is the post key value ?
Hello Simon
I am testing the web API. I have an issue, and have not been able to see where is the answer on your site; sorry if I just need to change glasses.. What is the value of the key when sending a POST ? As an example : I have created a file named dsfTranscode.txt which contains the only line prop stream.transcode=flac:wav24, dsf:wav24;176 This file is on my Synology, on the web server directory. I want call the web API. So here is my script. But what should I put instead of xxx ??? Many Thanks ! $.ajax({ type: "POST", url: "http://192.168.73.22:9790/", data: {xxx:"dsfTranscode.txt"}, dataType: "text", success: function(retour) {} }); // end ajax function |
|||
03-10-2016, 20:05
(This post was last modified: 03-10-2016 20:06 by simoncn.)
Post: #2
|
|||
|
|||
RE: Web API : what is the post key value ?
I haven't used AJAX myself. From a quick web search, I think it should be something like:
$.ajax({ type: "POST", url: "http://192.168.73.22:9790/", data: "prop stream.transcode=flac:wav24, dsf:wav24;176", dataType: "text", success: function(retour) {} }); // end ajax function |
|||
04-10-2016, 06:55
(This post was last modified: 04-10-2016 06:57 by lyapounov.)
Post: #3
|
|||
|
|||
RE: Web API : what is the post key value ?
In my understanding, a POST call is always sets of key & value
In the case of ajax, it is key:value all sent as a JSON string In the case of an input field, it is <INPUT name="key"> and the value is in the field For me, unless I am confused, "prop stream.transcode=flac:wav24, dsf:wav24;176" is the value; but what is the associated key ? If I look at your webpage for managing minimserver, it seems the key is "sub". I will try this |
|||
04-10-2016, 07:15
Post: #4
|
|||
|
|||
RE: Web API : what is the post key value ?
No, it does not work.
I am using cocoArestClient I send a post request to http://192.168.73.22:9790/ with key sub and value prop stream.transcode=flac:wav24, dsf:wav24;176 I put the header Content-type to text/plain It returns "Request content missing" There is something I don't get here. |
|||
04-10-2016, 07:57
Post: #5
|
|||
|
|||
RE: Web API : what is the post key value ?
There is not always a key for a POST request. This depends on the content type. For a content type of text/plain, there is no key.
Under Body in CocoaRestClient, you need to check 'Raw input'. This gives you an input field without keys. I have tried doing this in CocoaRestClient with a content type of text/plain and it is working for me. |
|||
04-10-2016, 12:20
(This post was last modified: 04-10-2016 12:21 by lyapounov.)
Post: #6
|
|||
|
|||
RE: Web API : what is the post key value ?
(04-10-2016 07:57)simoncn Wrote: There is not always a key for a POST request. This depends on the content type. For a content type of text/plain, there is no key. It works for me too ! I had never really noticed the raw input checkbox. Will try with an ajax call. Thank you , Simon ! |
|||
06-10-2016, 09:37
(This post was last modified: 06-10-2016 09:38 by lyapounov.)
Post: #7
|
|||
|
|||
RE: Web API : what is the post key value ?
Still struggling with ajax call. Now facing CORS issue (the fact that the server is on a different port means cross-origin)
Actually, what I want to do, because of the fact that Lumin app does not recognizes what format the renderers accepts (so dsf:-/wav24;176 does not work) is a html file with ajax call, which I can use from my iPad without the need of a laptop, to switch from direct dsf to dsf conversion (I guess there is no iPad app to control minimserver parameter :-) Basically, I want to reproduce your nice web access page, but with more parameters than just the content directory. |
|||
06-10-2016, 12:32
Post: #8
|
|||
|
|||
RE: Web API : what is the post key value ?
I understand and this seems like a good idea that might also be useful for other people. I haven't done any AJAX programming so I can't offer any advice on this. Perhaps you could get some help on an AJAX developer forum.
|
|||
06-10-2016, 13:08
Post: #9
|
|||
|
|||
RE: Web API : what is the post key value ?
(06-10-2016 12:32)simoncn Wrote: I understand and this seems like a good idea that might also be useful for other people. I haven't done any AJAX programming so I can't offer any advice on this. Perhaps you could get some help on an AJAX developer forum. Ajax is not the problem. It is CORS the problem. I will keep you informed, and if it works, I will share. |
|||
08-10-2016, 16:57
Post: #10
|
|||
|
|||
RE: Web API : what is the post key value ?
Test reply
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)