# How to manage opennebula-sandbox using API

**URL:** <https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502>\
**Category:** Product Support\
**Created:** [November 20, 2015, 4:15pm UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502 "2015-11-20T16:15:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![capvt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/capvt/32/4497_2.png) [@capvt](https://forum.opennebula.io/u/capvt)\
**Post date:** [November 20, 2015, 4:15pm UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/1 "2015-11-20T16:15:47Z")

</div>

Hi all!!  
I’m using the opennebula sandbox on virtualbox…I’d like to manage VMs with a java program using API…  
I downloaded OCA and started programming but I don’t know how to communicate with the sandbox on virtualbox  
Thank you

---

<div class="post-metadata">

**Author:** ![Arash](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Arash](https://forum.opennebula.io/u/Arash)\
**Post date:** [November 21, 2015, 7:46am UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/2 "2015-11-21T07:46:48Z")

</div>

we use oca to connect to opennebula with xmlrpc with this address: [http://IPORHOSTNAME:2633/RPC2](http://IPORHOSTNAME:2633/RPC2)’  
check your sandbox networking type and find your ip address to connect to opennebula .

---

<div class="post-metadata">

**Author:** ![capvt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/capvt/32/4497_2.png) [@capvt](https://forum.opennebula.io/u/capvt)\
**Post date:** [November 22, 2015, 12:09pm UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/3 "2015-11-22T12:09:48Z")

</div>

Hi thank you for your reply!!  
In virtualbox settings I setted the network to NAT and as suggested in the sandbox guide I forwarded ports 9869 to 9869 and 29876 to 29876.  
I am using Ubuntu 14.04 to execute virtualbox and to execute the java program wich will control the sandbox  
if in the browser I enter localhost:9869 it opens sunstone page… instead if i put localhost:29876 it says:  
Error response  
Error code 405.  
Message: Method Not Allowed.  
Error code explanation: 405 = Specified method is invalid for this resource…

when you say

> [@Arash](#):
>
> check your sandbox networking type and find your ip address to connect to opennebula

you mean virtualbox network settings?

---

<div class="post-metadata">

**Author:** ![Arash](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Arash](https://forum.opennebula.io/u/Arash)\
**Post date:** [November 24, 2015, 9:24am UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/4 "2015-11-24T09:24:00Z")

</div>

yes in both Nat and Bridge you have one IP address for your machine . to connecting to api you have to use virtual machine ip address : [http://machineipaddress:2633/RPC2](http://machineipaddress:2633/RPC2)  
another way that im not testing it yet is forwarding 2633 port using virtuabox forwarding setting . after that maybe you can connect to api using [http://localhost:2633/RPC2](http://localhost:2633/RPC2)

---

<div class="post-metadata">

**Author:** ![capvt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/capvt/32/4497_2.png) [@capvt](https://forum.opennebula.io/u/capvt)\
**Post date:** [November 24, 2015, 9:39am UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/5 "2015-11-24T09:39:16Z")

</div>

thank you for your reply  
I portforwarded 2633 to 2633 quickly and now when i browse to [http://localhost:2633](http://localhost:2633) i get

```
Error 404

This XML-RPC For C/C++ Abyss XML-RPC server responds to only one URI path. I don't know what URI path that is, but it's not the one you requested: '/'. (Typically, it's '/RPC2')

ABYSS Web Server for XML-RPC For C/C++ version 1.33.6

```

if I put [http://localhost:2633/RPC2](http://localhost:2633/RPC2) in the browser I get  
Error 405

```
POST is the only HTTP method this server understands

ABYSS Web Server for XML-RPC For C/C++ version 1.33.6

```

I’m on the right way?

---

<div class="post-metadata">

**Author:** ![Arash](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Arash](https://forum.opennebula.io/u/Arash)\
**Post date:** [November 24, 2015, 9:51am UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/6 "2015-11-24T09:51:00Z")

</div>

yes now you can now start using api 🙂

---

<div class="post-metadata">

**Author:** ![capvt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/capvt/32/4497_2.png) [@capvt](https://forum.opennebula.io/u/capvt)\
**Post date:** [November 24, 2015, 5:06pm UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/7 "2015-11-24T17:06:38Z")

</div>

Thank you  
next step…  
I am trying the code sample from this page  
[http://docs.opennebula.org/4.6/integration/system\_interfaces/java.html](http://docs.opennebula.org/4.6/integration/system_interfaces/java.html)  
what I have to do to use XRPC?  
before the sample code I put these imports

```
import org.opennebula.client.Client;
import org.opennebula.client.vm.VirtualMachine;
import org.opennebula.client.OneResponse;
import org.apache.xmlrpc.client.XmlRpcClient;

```

if i compile it i get

`ONE_AUTH file not present`

How can i set the $ONE\_AUTH path?  
I’m executing the program on netbeans and openenbula is running on virtualbox…

Thanks!!

---

<div class="post-metadata">

**Author:** ![Arash](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Arash](https://forum.opennebula.io/u/Arash)\
**Post date:** [November 24, 2015, 5:45pm UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/8 "2015-11-24T17:45:11Z")

</div>

ONE\_AUTH can be an environment variable with this format  
`export ONE_AUTH=oneadmin:password`  
or a file `~/.one/one_auth` contains `oneadmin:password`

---

<div class="post-metadata">

**Author:** ![nour](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@nour](https://forum.opennebula.io/u/nour)\
**Post date:** [October 5, 2018, 11:44am UTC](https://forum.opennebula.io/t/how-to-manage-opennebula-sandbox-using-api/1502/9 "2018-10-05T11:44:56Z")

</div>

Hi capvt,  
How did you execute the program that uses the opennebula API ?  
Did you use any server such as Tomcat ?  
which type of program did you write (e.g., java program pr dynamic program or spring boot program)?
