API Information

API URL: https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/<context-name>[/<primary-key-value>]

Available Contexts

Context NameAuthenticationReadCreateUpdateDelete
personRequiredOKOKOKOK
contactRequiredOKOKOKOK
contact_wayRequiredOKOKOKOK
cor_way_kindnameRequiredOK---
historyRequiredOKOKOKOK

Examples

Read Table from Database

SummaryGetting all records in context.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person
MethodGET
Result[{"id":1,"name":"Updated","address":"Saitama, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null},{"id":2,"name":"Updated","address":"Tokyo, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null},{"id":3,"name":"Updated2","address":"Osaka, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null}]
SummaryGetting a specific record in context.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/3
MethodGET
Result[{"id":3,"name":"Updated2","address":"Osaka, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null}]
SummaryGetting a specific record in context with a parameter.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/?id=3
MethodGET
Result[{"id":3,"name":"Updated2","address":"Osaka, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null}]
SummaryGetting a specific record in context with a parameter.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/?id=2&id_operator=%3E%3D
MethodGET
Result[{"id":2,"name":"Updated","address":"Tokyo, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null},{"id":3,"name":"Updated2","address":"Osaka, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null}]
Comment The query parameters of the URL are basically in the field-name=field-value format, and the operator is equal (field=value). If you want to specify the operator, the key should be "field-name_operator" as this example.

Create Record in Table from Database

SummaryCreating a record.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person
MethodPOST
Body{"name": "Created", "address": "Anyplace"}
Result[{"id":7,"name":"Created","address":"Anyplace","mail":null,"category":null,"checking":null,"location":null,"memo":null}]
CommentThe create operations return the created record, and you can get the primary key value from the result.

Update Record in Table from Database

SummaryUpdating a record.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/7
MethodPUT
Body{"name": "Test", "address": "TestTest"}
Result[{"id":7,"name":"Test","address":"TestTest","mail":null,"category":null,"checking":null,"location":null,"memo":null}]
CommentThe last component of the URL is the "id" field value to edit.

Delete Record in Table from Database

SummaryDeleting a record.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/7
MethodDELETE
Resulttrue
CommentThe last component of the URL is the "id" field value to delete.

Authentication with Operations

SummaryReading records with authentication.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person
MethodGET
HeadersContent-Type: application/json
Authorization: Bearer f9b73706b337feee318b3527a464f39108016e9facab848f42e37426594ebafe
Result[...some records....]
Comment If the context definition requires authentication, the accessToken field is checked with the value of the Authorization header. If a record matches, it is considered a successful authentication. The authuser table is the default user table of INTER-Mediator. Some documents describe the details of authentication.

To successfully authenticate on a web API using INTER-Mediator, the 'authuser' table must have the accessToken field. The field value can be any string, but the following example uses SHA-256 of a random string. On the API call, the Authorization header must be the value of the accessToken field with the 'Bearer' prefix.

mysql> select id,username,accessToken from authuser;
+----+----------+------------------------------------------------------------------+
| id | username | accessToken                                                      |
+----+----------+------------------------------------------------------------------+
|  1 | user1    | b10e7da88d2d4b624604efda92730cf61367f41e3f81b34e53194105e99c7dbd |
|  2 | user2    | f9b73706b337feee318b3527a464f39108016e9facab848f42e37426594ebafe |
|  3 | user3    | 7b216afd67d3e4b153520ba24961421d014b2bb7d1a88e70047ca8fd9f9211bc |
|  4 | user4    | c972efb826a8a343a8e270a3325131ff069ecdb8c870b856a66850da19942c7a |
|  5 | user5    | b7ff8c95ca93a392879d09a7aabcca00bc92ec391678d7e7c0c751ce31ae1192 |
|  6 | mig2m    | e9c18ff869b3490c735a4b8d9c497e9abb138099105b4c0aaa46919af7980250 |
|  7 | mig2     | 0e9ab52d44807dcaf42b80372f0d45ee8c40a5e9d1027c6531bd8b11f71e1c38 |
+----+----------+------------------------------------------------------------------+
SummaryReading records without authentication.
URLhttps://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person
MethodGET
HeadersContent-Type: application/json
Result{"message":"Credential is not valid.","date-time":"2025-09-13 03:30:19","definition-file":"..\/Sample_Auth\/MySQL_definitions.php"}
Comment In case of an error, a message is returned with the date, time, and the definition file used for this API.