| Context Name | Authentication | Read | Create | Update | Delete |
|---|---|---|---|---|---|
| person | Required | OK | OK | OK | OK |
| contact | Required | OK | OK | OK | OK |
| contact_way | Required | OK | OK | OK | OK |
| cor_way_kindname | Required | OK | - | - | - |
| history | Required | OK | OK | OK | OK |
| Summary | Getting all records in context. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person |
| Method | GET |
| 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}] |
| Summary | Getting a specific record in context. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/3 |
| Method | GET |
| Result | [{"id":3,"name":"Updated2","address":"Osaka, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null}] |
| Summary | Getting a specific record in context with a parameter. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/?id=3 |
| Method | GET |
| Result | [{"id":3,"name":"Updated2","address":"Osaka, Japan","mail":"msyk@msyk.net","category":null,"checking":null,"location":null,"memo":null}] |
| Summary | Getting a specific record in context with a parameter. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/?id=2&id_operator=%3E%3D |
| Method | GET |
| 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. |
| Summary | Creating a record. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person |
| Method | POST |
| Body | {"name": "Created", "address": "Anyplace"} |
| Result | [{"id":7,"name":"Created","address":"Anyplace","mail":null,"category":null,"checking":null,"location":null,"memo":null}] |
| Comment | The create operations return the created record, and you can get the primary key value from the result. |
| Summary | Updating a record. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/7 |
| Method | PUT |
| Body | {"name": "Test", "address": "TestTest"} |
| Result | [{"id":7,"name":"Test","address":"TestTest","mail":null,"category":null,"checking":null,"location":null,"memo":null}] |
| Comment | The last component of the URL is the "id" field value to edit. |
| Summary | Deleting a record. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person/7 |
| Method | DELETE |
| Result | true |
| Comment | The last component of the URL is the "id" field value to delete. |
| Summary | Reading records with authentication. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person |
| Method | GET |
| Headers | Content-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 |
+----+----------+------------------------------------------------------------------+
| Summary | Reading records without authentication. |
|---|---|
| URL | https://demo.inter-mediator.com/INTER-Mediator/samples/Sample_API/api.php/person |
| Method | GET |
| Headers | Content-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. |