NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Other Clients Old Stuff (legacy) NextPVR Enhanced Web Admin (NEWA) v
« Previous 1 … 5 6 7 8 9 … 47 Next »
NEWA RESTful API using Swagger

 
  • 0 Vote(s) - 0 Average
NEWA RESTful API using Swagger
theason
Offline

Junior Member

Posts: 33
Threads: 4
Joined: Oct 2012
#1
2014-01-27, 03:36 AM
Ok, I'll admit it. I seem to have gotten stuck drinking MSFT cool-aid for too many years. The transition from SOAP to WCF was pretty reasonable, but this JSON stuff that's all the rage with the cool kids has me a bit mystified. I can fully appreciate you wanting to use this system as a competing standard to WCF because it removes that dependency on MSFT, so please don't take this as a rant against it. I'm willing to work with it Smile

Can somebody help a poor old MSFT guy with your new fancy Swagger documented API? Can I somehow generate all the classes from the API; and make calls to the API with the old school things I am used to, or do I really need to invoke the HTTP methods and make all the calls myself, passing everything correctly. You know, like we used to do with the WSDL generator?

The interwebs is full of people talking about how to use the Swagger system to document code, but nobody seems to have a guide for generating the classes for your client (particularly when it comes to .net clients).

Hint: Maybe the project itself already has the objects I'm looking for and they could be provided Smile

Thanks!
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,586
Threads: 384
Joined: Dec 2004
#2
2014-01-27, 04:58 AM
theason Wrote:...but this JSON stuff that's all the rage with the cool kids has me a bit mystified.
Wow, I'm a "cool kid". Smile

Quote:Can I somehow generate all the classes from the API; and make calls to the API with the old school things I am used to, or do I really need to invoke the HTTP methods and make all the calls myself, passing everything correctly. You know, like we used to do with the WSDL generator?
Search Google for "generate classes from swagger" - there's a Github project out there. I haven't tried it as I'm personally just doing boiler-plate stuff at the moment as it fits my needs for testing (I don't need the full set of services yet).

Quote:Hint: Maybe the project itself already has the objects I'm looking for and they could be provided Smile Thanks!
The source for NEWA is provided as it always has been bearing in mind it's an ASP.NET app.

I suspect UJB can give you more information though.

Cheers,
Brian
UncleJohnsBand
Offline

Posting Freak

U.S.A.
Posts: 5,643
Threads: 258
Joined: Feb 2005
#3
2014-01-28, 05:05 AM
The API doc tells you about the different locations and necessary values. Although the API doc allows direct interaction with the services I find it not to work all the time.

I much prefer using the Chrome plugin Advanced Rest client to interact with the API's.

Objects that need to be submitted I believe I have included an API to get a default JSON object that can be used on Post's. If you want to make a corresponding c# class you could look for a JSON to c# class converter.

JSON is a RESTful transaction service implementation and most often does not need submission of objects.

API's are exected based on url. Sometimes you pass a parameter in as part of the url path /public/api-method-name/value-to-pass othertimes you are just doing a query /public/api-method-name/ and other times you may use querystrings as additional identifiers for the API call /public/api-method/value-to-pass?parm1=abc&parm2=123

with the introduction of a security token that will come out in the next release of NEWA and NPVR you can securely access the API over the internet without worry of someone running the API's without permission.

As for the Swagger documentation specification.... I spent a good week or so researching.... nothing provides you automated full-proof generation.

I simply opted to build in a stand alone implementation and manually create an maintain the doc objects.

The web/api/ directory in NEWA is a full stand-alone implementation of the Swagger documentation standard. Once you code the classes for the documentation a few times it really isn't that bad.
Intel Core i7 @ 4.00GHz Skylake 14nm
ASUSTeK COMPUTER INC. Z170-DELUXE
Windows 10 Pro x64
PVR Software: NPVR 5.1.1
SiliconDust HDHomeRun HDHR5-4US Connect Quatro 4 Channel Tuner
Roku Ultra
2 PCH A-100's
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Broken X-NEWA Info Link on NextPVR.com cweseloh 4 2,766 2020-05-02, 01:02 AM
Last Post: cweseloh
  gbpvr.com still somewhere in the NEWA code? jksmurf 0 2,092 2019-02-26, 01:29 AM
Last Post: jksmurf
  NEWA scheduled recording update ability broken in 4.2.2 snagglewest 0 2,047 2018-07-11, 12:12 AM
Last Post: snagglewest
  Where does NEWA read the Show name from in the NEWA Web App? jksmurf 3 3,174 2018-07-03, 03:26 AM
Last Post: jksmurf
  Newa snaitaz 8 4,717 2018-05-17, 09:30 PM
Last Post: sub
  NEWA Auto-Search Command Line Interface (CLI) UncleJohnsBand 40 38,112 2018-05-09, 12:50 AM
Last Post: jksmurf
  NEWA modern "NEW" page missing urls??? snagglewest 3 3,452 2017-12-03, 12:48 AM
Last Post: snagglewest
  Difference between NPVR and NEWA recordings lists Bobins 4 5,146 2017-09-27, 10:16 PM
Last Post: Bobins
  Legacy NEWA stu2j 4 4,542 2017-07-19, 12:21 AM
Last Post: stu2j
  Open classic EPG in NEWA very slow Peter Ingham 11 6,856 2017-04-21, 12:35 AM
Last Post: Peter Ingham

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode