Hi I am working with RAML and just want to perform CRUD operations in DB. How to perform DB operations using RAML please help me with any examples that can perform any CRUD operations in DB using RAML.
So you want DB RAML CRUD operations?
Are you familiar with REST, how to apply it to API design, etc?
There are a ton of examples including the tutorials that can explain a lot of this to you. Typically you are going to match up HTTP methods like POST, PUT, DELETE to CRUD operations. POST is usually used to create something, PUT to update/replace, DELETE is obvious as is GET. I wont duplicate the RAML here as I said most of the examples show how to apply those in RAML.
Thanks @Kevin_Duffey I am new to RAML , but it will be great if you help me with simple example where i can post data from postman and then it is inserted in to DB using RAML. It will be a good example for me to start with.
RAML is used to document the API between the client (postman) and the server. RAML does not perform the actual interaction with the database. You would have to import the RAML document into a programming language that would create a RESTful application skeleton. That way you would “only” have to implement each of the calls but all the RESTful API part would be implemented automagically.
Thank you for the credit but rojocapo is the one that gave you the better explanation. To be fair, I just read your previous reply and was going to say a similar thing… RAML is only used to define the API… you have to use RAML tools to generate server side, client side, etc for it to be of any further use.
What you can do is try creating a simple API with a RAML which will define your API structure, behavior, operations(GET, POST etc), resource etc and then you need to import this RAML file in some programming tools and then implement the business logic there like connecting the DB and retrieve, insert data there.
A good example will be creating a RAML file, import the RAML in Anypoint studio, where your flows will be generated as per the specs in your RAML file, and the you can write the DB implementation logic in your mule flow.
Here RAML will act as an interface specification creating your interface and you need to take care to implement you interface the way you want
Yes @anir37 is this the right way of doing this. You mean to say i have to design a RAML suppose for POST and then i have to import this in anypoint studio after that i have to generate flows and then i will drag and drop DB connector to perform Insert operation.
Is this the right way. ?
Yes, the flow that will be generated are the structure of API you define in your RAML file.
Now to implement any business logic or Database layer, you need to implement that in your flow using DB connector or JAVA class etc