Trongate Docs
switch to dark modeswitch to dark mode
Testing Your API Endpoints

Testing Your API Endpoints

Trongate makes it easy for you to test your API endpoints by including an API Explorer page.  The URL for opening the API Explorer is your base URL followed by:


For your app, replace 'module' with the name of the module directory where your api.json settings are to be applied.

For the API Explorer to work, you will need to have a database table that shares the same name as the module directory where your api.json file resides.  Also, please be aware that the API Explorer page will only work when your app is in 'dev' mode.

So, if you were building an app called 'autoshop' with a module named 'cars' then the URL for testing your API endpoints for 'cars' would be (something like):


Just To Let You Know
The API Explorer will only work when your environment (as defined in config.php) is set to 'dev'.

How To Test A Particular Endpoint

On your opening API Explorer page, you'll see rows, representing each of your endpoints.  Towards the left hand side of each row, you'll see a coloured button with the name of the request type on the button.  For example, 'GET'.  Clicking on one of those buttons, opens up a pop-up window:


Understanding The Pop-Up Windows

The pop-up windows, on the API Explorer, contains information and features that can help you to understand how your endpoint works.  From here, we can also submit HTTP requests and test our endpoints.  

endpoint pop-up window

Included here, we have:

  • The endpoint name
  • A textarea for submitting optional parameters
  • An area on the right-hand side displaying the response from the server
  • A checkbox, giving you the option of bypassing authorization tests
  • A checkbox for clearing the parameters textarea
  • A check for displaying response header values
  • A button for copying the server response body
  • A button for viewing the settings for your API endpoint
  • A submit button for sending requests to your API endpoint

Additional Information

Towards the bottom left-hand side of each pop-up window, you'll see a summary of some other important information, relating to your endpoint.  Specifically,

  • URL Segments - the URL segments that must be added to your base URL in order to invoke the endpoint.
  • Required HTTP Request Type - the type of HTTP request that the endpoint has been designed to receive.  For example, 'POST'
  • Endpoint Settings - the location of the file where the settings for the endpoint have been declared
  • Your Current Token - your current security token (refer to How Trongate's Token System Works for details)

Understanding Server Responses

When you submit an HTTP request, using the API Explorer, you'll see - near the top right-hand side of the pop-up window) an indication of the HTTP Response Code that has been issued by the server, along with an indication of the text (sometimes called 'the HTTP response body') that has been produced by the endpoint. 

Just To Let You Know
For more information about HTTP response codes, refer to Understanding HTTP Response Codes


Setting Tokens

On the top right-side of the main API Explorer page, you'll see a facility that allows you to set a Trongate security token for testing.

Top Tip
Instructions for how to easily generate valid Trongate security tokens can be found at Generating Tokens (JavaScript Friendly Version)


If you have a question or a comment relating to anything you've see here, please goto the Help Bar.