Skip to content

Routes

Summary

All route patterns the 2Wee client uses. Your server must implement these routes and return the expected JSON.

Entry points

The client knows two hardcoded paths (relative to the base URL):

PathPurpose
/menu/mainMain menu (fetched on startup)
/auth/loginLogin form (fetched on 401)

All other URLs come from the server — in actions, on_select, lookup.endpoint, menu item URLs, etc. The client does not construct them.

Standard routes

PatternMethodRequest bodyResponsePurpose
/menu/{menu_id}GETScreenContract (Menu)Menu screen
/screen/{resource}_listGETScreenContract (List)List view
/screen/{resource}_card/{id}GETScreenContract (Card)Card view
/screen/{resource}_card/newGETScreenContract (Card)Empty card for creation
/screen/{resource}_card/newPOSTSaveChangesetScreenContract (Card)Create record
/screen/{resource}_card/{id}/savePOSTSaveChangesetScreenContract (Card)Save changes
/screen/{resource}_card/{id}/deletePOSTDeleteRequestScreenContract (List)Delete record

Grid routes

PatternMethodRequest bodyResponsePurpose
/screen/{grid_id}GETScreenContract (Grid)Grid screen
/screen/{grid_id}/savePOSTSaveChangesetScreenContract (Grid)Save grid data

Lookup and validation routes

PatternMethodRequest bodyResponsePurpose
/lookup/{field_id}GETScreenContract (List)Lookup list for a field
/validate/{field_id}/{value}GETValidateResponseBlur validation
/drilldown/{field_id}/{key}GETScreenContractDrill-down

Action routes

PatternMethodRequest bodyResponsePurpose
/action/{resource}/{id}/{action_id}POSTActionRequestActionResponseExecute action

Action endpoints are defined by the server in screen_actions[].endpoint. The patterns above are conventions — use any URL structure. See Screen Actions for details.

Authentication routes

PatternMethodAuth requiredRequest bodyResponsePurpose
/auth/loginGETNoScreenContract (Card)Login form
/auth/loginPOSTNoAuthRequestAuthResponseSubmit credentials

Query parameters

ParameterUsed onPurpose
?query=textList and lookup GETsSearch/filter rows server-side
?selected=valueLookup GETsCurrent field value for pre-selection positioning
?{param}={value}Lookup and validate GETsContext parameters from lookup.context definitions

?query=

The client sends search queries on list and full-screen lookup screens. Your server should filter rows and return only matching results.

GET /screen/customer_list?query=cannon
GET /lookup/customer_no?query=cannon

Modal lookups (display: "modal") do not use ?query= — the client filters locally.

Context parameters

When a lookup has a context array, the client reads the referenced field/column values and appends them as query parameters:

GET /lookup/no?type=Resource
GET /validate/no/8100?type=Resource
GET /lookup/post_code?country_code=FO

See Lookups — Context-dependent lookups for details.

URL architecture

The client takes a base URL (e.g., http://2wee.test/terminal).

  • Entry points use the base URL: {base_url}/menu/main
  • All other paths from the server are absolute (from the host root)
  • The client resolves them by prepending only the scheme and host

Example with prefix:

  • Base URL: http://2wee.test/terminal
  • Client hits: http://2wee.test/terminal/menu/main
  • Server returns paths like: /terminal/screen/customer_list
  • Client resolves: http://2wee.test + /terminal/screen/customer_list

Example without prefix:

  • Base URL: http://localhost:3000
  • Client hits: http://localhost:3000/menu/main
  • Server returns paths like: /screen/customer_list
  • Client resolves: http://localhost:3000 + /screen/customer_list

Your server controls its own URL structure. The client follows it.

Naming conventions

These route patterns are conventions, not requirements. You can use any URL structure. The only hard requirement is:

  1. /menu/main exists (client entry point)
  2. /auth/login exists if authentication is enabled
  3. All other URLs you return in your JSON are valid and return the expected response types