![]() |
|
Web API : what is the post key value ? - Printable Version +- MinimServer Forum (https://forum.minimserver.com) +-- Forum: MinimServer (/forumdisplay.php?fid=1) +--- Forum: Support (/forumdisplay.php?fid=4) +--- Thread: Web API : what is the post key value ? (/showthread.php?tid=3615) |
Web API : what is the post key value ? - lyapounov - 03-10-2016 18:32 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 RE: Web API : what is the post key value ? - simoncn - 03-10-2016 20:05 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 RE: Web API : what is the post key value ? - lyapounov - 04-10-2016 06:55 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 RE: Web API : what is the post key value ? - lyapounov - 04-10-2016 07:15 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. RE: Web API : what is the post key value ? - simoncn - 04-10-2016 07:57 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. RE: Web API : what is the post key value ? - lyapounov - 04-10-2016 12:20 (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 ! RE: Web API : what is the post key value ? - lyapounov - 06-10-2016 09:37 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. RE: Web API : what is the post key value ? - simoncn - 06-10-2016 12:32 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. RE: Web API : what is the post key value ? - lyapounov - 06-10-2016 13:08 (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. RE: Web API : what is the post key value ? - simoncn - 08-10-2016 16:57 Test reply |