INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Json response to MCWS query?  (Read 4670 times)

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Json response to MCWS query?
« on: May 17, 2017, 08:03:11 am »

I'm playing around with MCWS API queries, trying to get a parseable response to the file query. The result is coming back as a string with no separators (which I assume is correct).

I'm looking to create a php web page that lets me view my TV guide (saved to a smartlists).

Any advice? Am I able to get the file info in json format?

Thanks in advance,

J

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10931
Re: Json response to MCWS query?
« Reply #1 on: May 17, 2017, 08:12:36 am »

All responses should be in XML format, we don't do JSON at the moment. Is there any particular command that you think is not working?
Logged
~ nevcairiel
~ Author of LAV Filters

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: Json response to MCWS query?
« Reply #2 on: May 17, 2017, 08:47:41 am »

any plans to add support for "Accept: application/json"? is easier to deal with than xml imv
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10931
Re: Json response to MCWS query?
« Reply #3 on: May 17, 2017, 09:54:04 am »

Not at this time. Would likely require quite a lot of work to disentangle everything.
Logged
~ nevcairiel
~ Author of LAV Filters

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Re: Json response to MCWS query?
« Reply #4 on: May 18, 2017, 03:26:39 am »

All responses should be in XML format, we don't do JSON at the moment. Is there any particular command that you think is not working?

It's not that I think it's not working, it's just not doing what I'd like it to  :)

For instance -

If I call the following url

Code: [Select]
http://192.168.2.101:52199/MCWS/v1/Playlist/Files?Playlist=46487519&PlaylistType=ID&Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Token=[token]
from the url bar, I get an mpl(xml) file download.

If I call the same URL using curl from within a php file, I get the following:

Code: [Select]
262136 209612 2017-5-29, 9:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.3958333332993789 262137 209612 2017-5-29, 10:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.4375 262138 209612 2017-5-29, 11:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.4791666666278616 262139 209612 2017-5-29, 12:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.5208333332921029 262140 209612 2017-5-29, 13:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.5625 262141 209612 2017-5-29, 14:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.6041666666205856 262142 209612 2017-5-29, 15:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.645833333284827 262143 209612 2017-5-29, 16:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.6875 262144 209612 2017-5-29, 17:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.7291666666133096 262145 209612 2017-5-29, 18:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.770833333277551 262146 209612 2017-5-29, 19:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.8125 262147 209612 2017-5-29, 20:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.8541666666060337 262148 209612 2017-5-29, 21:30:0.tvgd Program info not available 3600 TV 1494854230 209612 42884.895833333270275 262149 209612 2017-5-29, 22:30:0.tvgd Program info not available 1800 TV 1494854230 209612 42884.9375 262150 209613 2017-5-22, 0:0:0.tvgd Series 2017: Episode 15 Other 41132 http://images.icetv.com.au/0ecb-9902-4bd0-a0c9.jpg 3600 TV SDTV G Pip Courtney & a team of Landline reporters around the country bring you up to date with the issues affecting rural & regional Australia. From farming, agriculture, food, economics, innovation, climate, infrastructure & more. TV Show Australia English 1494854230 G 16:9 Landline 2017 15 209613 42877 1 34112-251106 281571 262151 209613 2017-5-28, 20:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42883.8541666666642413 262152 209613 2017-5-28, 21:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42883.8958333333284827 262153 209613 2017-5-28, 22:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42883.9375 262154 209613 2017-5-28, 23:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42883.9791666666569654 262155 209613 2017-5-29, 0:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.0208333333212067 262156 209613 2017-5-29, 1:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.0625 262157 209613 2017-5-29, 2:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.1041666666496894 262158 209613 2017-5-29, 3:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.1458333333139308 262159 209613 2017-5-29, 4:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.1875 262160 209613 2017-5-29, 5:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.2291666666424135 262161 209613 2017-5-29, 6:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.2708333333066548 262162 209613 2017-5-29, 7:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.3125 262163 209613 2017-5-29, 8:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.3541666666351375 262164 209613 2017-5-29, 9:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.3958333332993789 262165 209613 2017-5-29, 10:30:0.tvgd Program info not available 3600 TV 1494854230 209613 42884.4375
Which is the same data, just without the xml tags, or any separators (e.g ";").

So I suppose my questions are 1. Is this what is supposed to happen? and 2. Is there a way I can get the xml tags

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10931
Re: Json response to MCWS query?
« Reply #5 on: May 18, 2017, 04:04:11 am »

Are you sure curl isn't just stripping the tags, or something?
MCWS only outputs one format and one format only.
Logged
~ nevcairiel
~ Author of LAV Filters

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Re: Json response to MCWS query?
« Reply #6 on: May 18, 2017, 05:07:29 am »

It's all good.

I decided better to load the xml data to a file via cron once or twice a day, then call that rather than call a 9mb file with every page load :-)

Thanks Hendrik.
Pages: [1]   Go Up