Best way to log API calls that create records

Many of our records are created via an API call from an external source.  Is there a way I can log those calls so I can see what was sent in via the API versus what is in the record now.  I just want an irrefutable way to see what they are sending into the system.

I need to see all the data included in the POST.

Parents
  • If you have access to core code you can add logging to ~/include/api/RestService.php just below the comment that has "// This looks like the post contents are JSON".

    Something like:

                        // This looks like the post contents are JSON
                        // Note: If we want to support rest based XML, we will need to change this
    
    @$GLOBALS['log']->fatal("POSTED DATA:$postContents");

    Add extra code to filter out unwanted requests based on $this->getRequest()->getRequestURI().

    If it is sugarondemand then you may be able to create a ~/custom/include/api/RestService.php, derive from the core code RestService and override getRequestArgs(). I've not tried that though.

Reply
  • If you have access to core code you can add logging to ~/include/api/RestService.php just below the comment that has "// This looks like the post contents are JSON".

    Something like:

                        // This looks like the post contents are JSON
                        // Note: If we want to support rest based XML, we will need to change this
    
    @$GLOBALS['log']->fatal("POSTED DATA:$postContents");

    Add extra code to filter out unwanted requests based on $this->getRequest()->getRequestURI().

    If it is sugarondemand then you may be able to create a ~/custom/include/api/RestService.php, derive from the core code RestService and override getRequestArgs(). I've not tried that though.

Children