API


Getting Started

HTTP Methods 

GET
POST
PUT
DELETE


DELETE

Model records:

  • DELETE /api/{model}/

Parameters

  • filter (mandatory):

    This is used to filter data to delete. For example

    DELETE /api/product.template/?filter=[["id", "=", 95]]

    Response

                          {
        "result": true
    }
    
                        

    Note: If the result is true it means success and if false or otherwise it means there was an error during deletion.

Model records:

  • DELETE /api/{model}/{id}

Parameters

  • This takes no parameter and we don't have a filter parameter because id of record to be deleted is passed on URL as {id}. Example to give us an idea of how this works.

    DELETE /api/product.template/95/

    Response

                          {
        "result": true
    }
    
                        

Calling Model's Function

  • Sometimes you might need to call the model's function or a function bound to a record, in order to do so, send a POST request with a body containing arguments(args) and keyword arguments(kwargs) required by the function you want to call.

    Below is how you can call the model's function

    POST /object/{model}/{function name}

    Request Body

                          {
        "params": {
    	"args": [arg1, arg2, ..],
    	"kwargs ": {
    	    "key1": "value1",
    	    "key2": "value2",
    	    ...
    	}
        }
    }
    
                        

    And below is how you can call a function bound to a record

    POST /object/{model}/{record_id}/{function name}

    Request Body

                          {
        "params": {
    	"args": [arg1, arg2, ..],
    	"kwargs ": {
    	    "key1": "value1",
    	    "key2": "value2",
    	    ...
    	}
        }
    }