cPanel API 2 Functions - RoR::addapp

Description

This function adds a Ruby application.

Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.

 

Examples 


 WHM API (JSON)

https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=RoR&cpanel_jsonapi_func=addapp&appname=Test&env=0&loadonboot=0&path=test

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Add the Ruby app "Test"
$add_app $cpanel->api2(
    'RoR''addapp',
 array(
        'appname'       => 'Test',
        'env'           => '0',
        'loadonboot'    => '0',
        'path'          => 'test',
 
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Add the Ruby app "Test"
my $add_app $cpliveapi->api2(
    'RoR''addapp',
{
        'appname'       => 'Test',
        'env'           => '0',
        'loadonboot'    => '0',
        'path'          => 'test',
 }
);

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use theLiveAPI system to call the cPanel APIs.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read ourDeprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.

 

 Command Line

cpapi2 --user=username RoR addapp appname=Test env=0 loadonboot=0 path=test

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
  "cpanelresult": {
    "apiversion"2,
    "func""addapp",
    "data": [
      {
        "installdetails""      exists  \n      create  app/controllers\n      create  app/helpers\n      create  app/models\n      create  app/views/layouts\n      create  config/environments\n      create  config/initializers\n      create  config/locales\n      create  db\n      create  doc\n      create  lib\n      create  lib/tasks\n      create  log\n      create  public/images\n      create  public/javascripts\n      create  public/stylesheets\n      create  script/performance\n      create  test/fixtures\n      create  test/functional\n      create  test/integration\n      create  test/performance\n      create  test/unit\n      create  vendor\n      create  vendor/plugins\n      create  tmp/sessions\n      create  tmp/sockets\n      create  tmp/cache\n      create  tmp/pids\n      create  Rakefile\n      create  README\n      create  app/controllers/application_controller.rb\n      create  app/helpers/application_helper.rb\n      create  config/database.yml\n      create  config/routes.rb\n      create  config/locales/en.yml\n      create  db/seeds.rb\n      create  config/initializers/backtrace_silencers.rb\n      create  config/initializers/inflections.rb\n      create  config/initializers/mime_types.rb\n      create  config/initializers/new_rails_defaults.rb\n      create  config/initializers/session_store.rb\n      create  config/initializers/cookie_verification_secret.rb\n      create  config/environment.rb\n      create  config/boot.rb\n      create  config/environments/production.rb\n      create  config/environments/development.rb\n      create  config/environments/test.rb\n      create  script/about\n      create  script/console\n      create  script/dbconsole\n      create  script/destroy\n      create  script/generate\n      create  script/runner\n      create  script/server\n      create  script/plugin\n      create  script/performance/benchmarker\n      create  script/performance/profiler\n      create  test/test_helper.rb\n      create  test/performance/browsing_test.rb\n      create  public/404.html\n      create  public/422.html\n      create  public/500.html\n      create  public/index.html\n      create  public/favicon.ico\n      create  public/robots.txt\n      create  public/images/rails.png\n      create  public/javascripts/prototype.js\n      create  public/javascripts/effects.js\n      create  public/javascripts/dragdrop.js\n      create  public/javascripts/controls.js\n      create  public/javascripts/application.js\n      create  doc/README_FOR_APP\n      create  log/server.log\n      create  log/production.log\n      create  log/development.log\n      create  log/test.log\n",
        "statusmsg""App Added",
        "env""production",
        "status"1,
        "name""Test",
        "path""/test",
        "port""12002",
        "loadonboot"0
      }
    ],
    "event": {
      "result"1
    },
    "module""RoR"
  }
}

Note:

Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.

 

   

Parameters

 Parameter 

Type

Description

Possible values

 Example 

appname

string

Required

The Ruby application's name.

A valid string.

Test

env

 Boolean 

 Whether to use the development or production environment. 

This value defaults to 1.

  • 1 — Production.
  • 0 — Development.

1

path

string

Required

The path to the Ruby application.

A valid file path, relative to the cPanel account's home directory.

Note:

 You cannot specify an already-installed Ruby application's directory. 

test

loadonboot

Boolean

Whether to load the application on boot.

This value defaults to 0.

  • 1 — Load on boot.
  • 0 — Do not load on boot.

0

 

Returns

Return

Type

Description

Possible values

Example

 installdetails 

string

The Ruby application's installation details.

A valid string.

 

env

string

 Whether to use the development or production environment. 

  • production
  • development

production

statusmsg

string

Ruby's status.

  • New Settings Saved
  • error

New Settings Saved

status

Boolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.

0

name

string

The Ruby application's name.

A valid string.

Test

path

string

The path to the Ruby application.

A valid string.

test

port

integer

The Ruby application's port number.

A positive integer.

12002

loadonboot

 Boolean 

Whether to load the application on boot.

  • 1 — Load on boot.
  • 0 — Do not load on boot.

0

reason

string

A reason for failure.

Note:

This function only returns a reason value if it failed.

A string that describes the error.

 This is an error message. 

result

Boolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.

1

 

  • 13 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....