How to instantiate a service template with custom name in oneflow

Would like to know the method name and params to pass to instantiate a service template and give a customer name to the instantiated tempate using oneflow method

Example here:

$ NAME="myname`" $ echo "{ \"name\": \"$NAME\" }" > service-name.json $ cat flow-name.json { "name": "nyname" } $ oneflow-template instantiate 0 service-name.json ID: 2 $ oneflow show 2 | grep ^NAME NAME : myname $ rm service-name.json

Hi Jamie,

Thanks for the reply.

We are using a web application from where the one flow methods are been invoked.

I am referencing the below mentioned document

https://docs.opennebula.org/5.2/integration/system_interfaces/appflow_api.html#appflow-api

Please find the below c# code which is been used at our end to create the service.

 string json = "{\"action\": {\"perform\":\"instantiate\"}   }";
        var url =  http://oneflowIP:2474/service_template/3/action; //3 being the service template id
        string abc = POST(string.Format(@url, templateId), json); //POST is the custom method created to make http POST request to one flow

The above code creates/instantiates the service with the same name as that of the service template

My query is how do we instantiate a service with a customized name (generated/passed from the user web application) using one flow api.

  1.  Do I need to change the json string to pass the service name
    
  2.  Or as suggest by you a json file needs to be create at server which I can call using a the one flow api url.
    

Thanks & Regards
Ganesh Nayak
Global Demo & Learning Labs
Solutions Engineering and Technical Operations

Hitachi Data Systems
Mumbai(India)
Tel: +91 22 30511000 (Ext: 1017) || Mobile: +91 9892650573

Hi.

Did you find any solution to this issue? I’m at the same point,

Thanks in advance

Hi Jorge,

Json string is as follows

“action": {
“perform”: “instantiate”,
“params”: {
“merge_template”: {
“custom_attrs_values”: {
“CustomAttribute1”:“111”," CustomAttribute2":“804” //Sample values
},
“name”:“Your custom name goes here” }
}
}
}

Service url

var url = OpenNebulaOneFlowURL + “/service_template/123/action”;
where 123 is the template id

string response = POST(@url, json);

Hope this helps

It works perfectly

Thanks nayakganeshus