The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

JSON API - optimize website

Discussion in 'cPanel Developers' started by outpostmm, Nov 8, 2013.

  1. outpostmm

    outpostmm Member

    Joined:
    Dec 3, 2008
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I'm not seeing it in the documentation, but is it possible to use the JSON API to set the "Optimize Website" settings to enable compression for specific MIME types?

    Thanks
     
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    Yes, this is implemented as an API1 call which can be called via the JSON API. You can find how something is called by looking at the page which the <form> references on the page of cPanel where the action is being taken.

    In this case, it's /usr/local/cpanel/base/frontend/x3/optimize/dooptimize.html:

    <cpanel OptimizeWS="optimizews($RAW_FORM{'deflate'},$RAW_FORM{'deflate-mime-list'})">

    Here's an example of how to call it:

    https://<HOSTNAME>:2083/cpsess6366747/json-api/cpanel?cpanel_jsonapi_module=OptimizeWS&cpanel_jsonapi_func=optimizews&cpanel_jsonapi_apiversion=1&arg-0=list&arg-1=text/html%20text/plain%20text/xml

    There's documentation available in cPanel's API1 docs:

    OptimizeWS Module Documentation
     
Loading...

Share This Page