Traveller Store CotI Features New Posts Mark Forums Read Register


Go Back TravellerRPG.com > Citizens of the Imperium > General Traveller Discussions > Software Solutions

Software Solutions Discussions on Traveller related software.

Reply
 
Thread Tools Display Modes
  #1  
Old October 19th, 2017, 01:01 AM
robject's Avatar
robject robject is offline
Marquis
 
Join Date: Mar 2002
Posts: 13,279
Gallery : 9
Visit robject's Blog
robject has disabled reputation
Default Trader RESTful API

With cargo working, I turn to my next project: a RESTful API.

Here's my working concept. Suggestions welcome.

Code:
World actions:
GET /v0/map/spin/1910 ; data about Regina
GET /v0/map/spin/1910/jump/6 ; jump-6 list around Regina

Player actions:
POST /v0/<playerID>/player ; create a new player
GET /v0/<playerID>/player ; player status

Ship actions:
PUT    /v0/<playerID>/location?sector=<sector>&hex=<hex> ; jump to hex
PUT    /v0/<playerID>/fuelPurchase?type=refined&tons=<tons> ; buy refined fuel
GET    /v0/<playerID>/passengers
PUT    /v0/<playerID>/passengers/high ; load high passengers (etc)
DELETE /v0/<playerID>/passengers  ; unload all passengers
GET    /v0/<playerID>/cargo
PUT    /v0/<playerID>/cargo?tons=<tons> ; buy speculative cargo
DELETE /v0/<playerID>/cargo?tons=<tons>; sell/ditch
GET    /v0/<playerID>/freight
PUT    /v0/<playerID>/freight?tons=<tons>
DELETE /v0/<playerID>/freight
For the code itself, since I'm working in plain old Java, I'm writing a server (I'll thread pool it later) with an abstract factory that knows how to create the right API Version, which in turn has the appropriate Commands mapped to the actions described above (e.g. CREATE passengers, DELETE cargo, PUT ship). I'm thinking that mapping is just a switch statement router, although it could be a HashMap.
__________________
Imperiallines magazine
My Helpful Stuff for Traveller5
IMTU tc+ t5++ 3i(+) au ls+ / OTU 44% an+ dt+ ge- j- jf+ n- pi+ pp+ tr+ tv- uwp+ xb+
Tools Link

Last edited by robject; October 21st, 2017 at 10:12 AM..
Reply With Quote

Welcome!
To see more of this thread, please login or register.
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MGT Only: 200 T J2 Trader - Cheaper better than a Far Trader HG_B Mongoose Traveller 22 October 31st, 2014 04:39 PM
[Shipyard] Speculative Trader (Spice Trader, Flat Trader) robject Traveller 5 0 May 30th, 2013 12:14 AM
Type A trader or A2 Far Trader options madmike The Fleet 24 January 30th, 2012 05:19 AM
Book 7 Reprint, Free Trader/Far Trader/Fat Trader Details Missing? ebullient Classic Traveller 2 April 29th, 2009 07:29 PM
Free trader vrs far trader Jamus Mongoose Traveller 12 December 9th, 2008 07:19 PM

This website and its contents are copyright ©2010-2013 Far Future Enterprises. All rights reserved. Traveller is a registered trademark of Far Future Enterprises .
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright (c) 2010-2013, Far Future Enterprises. All Rights Reserved.