• Can you please point me to an example of CRUD / REST code where it just CRUDs a table • I want to see your pattern to design a program to create auto-REST/CRUD routines

Probably the simplest example is http_sysusers_services.#

Check out the GOSUB get. You’ll see a variable called filter that is a select statement. If you leave that null, it selects the entire table by default. Alternatively it could be a delimited list of keys. There’s a columnnames variable where you can specify which dicts you want returned. Leave it null and everything is returned.

the request would be api/sysusers with a method of “GET”. If you wanted a specific record the only change is to add the record id to the request like this api/sysusers/, still with a method of “GET”.

  • That covers your “R”. The “D” would be the same request as above but change the method to “DELETE”.
  • I have commented out that code in this service but it’s still there and only a couple of lines.

  • “C” and “U” I don’t really have a good example for you but with the infrastructure we have it would be again the same request as above api/sysusers/ but with a method of “POST”. The principle works on if the doesn’t exist then it’s a create and if it does exist it’s an update.

The difference with these two is you pass in a json body that has the dicts and corresponding data. It’s a simple json string where the label is the dictname and the data is the data. For an mv field, you make it an array.

To update an employee’s name for example it would be

    api/employees/abc123                 POST

    with a body of 
    FIRST_NAME: John,