Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,075 of 9,075 pages
About the help in other languages
All help pages

ezjscore server functions for your app

When an app needs an endpoint no REST route or service offers - what to ask a PHP developer for, how an ezjscore server function is registered and called, its answer wrapper, the permission rules it must follow…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/mobile-app-developers/json-endpoints/ezjscore-server-functions-for-your-app.md

On this page

ezjscore server functions for your app

This page is for app developers who need an endpoint that does not exist yet, for example one call that gives a home screen everything it shows. It explains what to ask a PHP developer for and how the app calls the result. The server-side how-to is JSON endpoints with ezjscore.

Contents

  1. When to ask for one
  2. What gets built
  3. Calling it
  4. Authentication from a native app
  5. A brief for the PHP developer

When to ask for one

NeedBetter choice
Read nodes, children, fieldsthe REST API, no new code
Search, image alias URLs, updates, languagesan existing remote service, no new code
One answer combining several of the above for one screena server function, or your own back end (A back end for your app)
Data from a custom table of an extensiona server function or a remote service domain of the extension
Routes that should be versioned and use OAuth like the content APIa REST provider of your own (REST API for applications)

What gets built

A server function is a public static PHP method registered in an [ezjscServer_<name>] block of an extension's ezjscore.ini.append.php. The router refuses any name without such a block, calls <class>::<function>( array $args ) and wraps the return value (How a call works). If the extension writes it as an expservices domain instead (a class extending expServiceBase), it gets the envelope, the catalog entry and API tokens for free (A service domain of your own).

Calling it

curl -s 'https://example.com/ezjscore/call/<name>::<function>::<argument>?ContentType=json'
{"error_text": "", "content": {"...": "the function's return value"}}

A plain server function answers its own value in content; an expservices domain answers the {"ok":...} envelope inside content (Calling expservices from an app). Check error_text first: it is set when the router refused the call.

ezjscore ships a test function you can use to check the interface: ezjsc::time.

Authentication from a native app

A plain server function runs as the current user of the request: a session cookie, or anonymous. It does not understand REST keys, OAuth tokens or expservices tokens by itself. For an app that is a reason to prefer an expservices domain, which accepts expservices tokens, or a REST provider, which uses the REST authentication.

Classic server functions can also be guarded by the policy ezjscore/call with the FunctionList limitation; how strictly is set by RequirePolicy (not set, disabled or enabled) in the function's block (expservices reference: access).

A brief for the PHP developer

  • The screen and the exact JSON it needs (an example answer).
  • The user the call runs as, and which content that user may read.
  • Read or write; writes are POST only, with the form token for sessions or a bearer token for expservices.
  • Paging: limit and offset as the last arguments.
  • Error cases and how the app should see them.
  • Caching: how fresh the answer must be.
  • "Check permissions in every function; validate and cast every argument; return data, not HTML" are the rules of JSON endpoints with ezjscore: security.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x