new to combination of Baas & Edge application.

Not applicable

Hello,

I am new to combination of Baas & Edge application. I am looking for working example of Edge application where , application access different collections from Baas into edge , then manipulating that into edge and either update or insert new record of collection into Baas.

If there is a working example of that then please share with me.

Thank you.

Regards,

Dhwani.

0 2 219
2 REPLIES 2

Building an API proxy in Edge with BaaS is no different from using any other backend. You provision an API proxy with backend pointing it to BaaS. Eg -

http://api.usergrid.com/{your_baas_org}/{baas_application}/{collection_you_want_to_work_on}

Eg :

http://api.usergrid.com/sudheendra/testapp/hotels

Then you configure various conditional flows for the CRUD operations. I have attached a simple proxy here which connects to a *hotels* collection in my BaaS instance. I have multiple conditional flows (Get hotels, create hotels, update hotel and delete hotel) configured as well.

After you import this proxy, you can run following commands to see how it works.

  1. To get the list of all hotels
curl http://{your_Edge_Org}-{environment}.apigee.net/v1/{proxy_name}

2. To create a new hotel entity

 curl -X POST http://{your_Edge_Org}-{environment}.apigee.net/v1/{proxy_name} -d '{"type":"hotel", "name": "myhotel"}'

3. To edit an existing hotels entity

curl -X PUT http://{your_Edge_Org}-{environment}.apigee.net/v1/{proxy_name}/{UUID_of_the_entity_you_want_to_edit... -d '{"type":"hotel", "name": "myhotel", "addeess" : "new address"}'

4. To delete a hotel entity

curl -X DELETE http://{your_Edge_Org}-{environment}.apigee.net/v1/{proxy_name}/{UUID_of_the_entity_you_want_to_dele...

Hope it helps!

Thanks,

Sudhee

myhotels-rev3-2015-11-24.zip

Thank you @sudheendra1 . I have one more thing to ask you.

I am having node back end app which need some data store to Baas but the structure is in node app is some thing like below & I don't know how I am going to save that in Baas:

var abc= {

keys:{

key1:{

name: "dhwani",

type: string,

default:true/false,

value: "trivedi"

},

key2:{

name: "age",

type: number,

default:true/false,

value: 10

}

},

myArray: [{

index: "name",

name: "abcdef",

value: null,

type: string,

default: true/false

},{

index: "name",

name: "pqrst",

value: "black",

type: string,

default: true/false

}],

myArrayInNewArray: [{

index: "name",

name: "abcdef",

value: null,

type: string,

default: true/false

},{

index: "name",

name: "abcdef",

type: array,

default: true/false,

value: newArray[{

index: "name",

name: "abcdef",

type: array,

default: true/false,

value: insideNewArray [{

type: 12345,

value:"test.com",

type: string

}]

}]

}]

}

Please guide me how I am going to save this above dat structure saves in Baas.