I am not a expert with RAML, but I think this syntax is used only for
documentation purpose of your API.

Based on your sample, you can for exemple send this kind of REST call with
AngularJS, and get some JSON formatted data.

POST http://online.invensio.com/test/sheeps/index.php

Manu
@EmmanuelDemey

2015-08-15 14:26 GMT+02:00 Paul Wahtel <[email protected]>:

> I have a preaty simple task, to display all salats from restaurant menu
> from RESTful api, i had never work with .raml extension files, but i
> thought 'cool, it will be easy', but when i get all data from this api.raml
> and display it, i was confused, i got many different and strange data, i
> don't see any salats, i started to watch different videos about RESTful
> apis, but anyway i can't find examples how to display some data from this
> apis, i feel stupid. This is how this data looks like:
> #%RAML 0.8
> title: barashki.net
> baseUri: http://online.invensio.com/test/sheeps
> version: v0.01
> /index.php:
>   displayName: All values data
>   post:
>     description: Return array of all dishes on site
>     responses:
>       200:
>         body:
>           application/json:
>             schema: |
>               - AllDishesResponse: {"$schema": "
> http://json-schema.org/schema";,
>                 "type": "array",
>                 "items": { "$ref": "AllDishesResponseItem" }
>               }
>               - AllDishesResponseItem: |
>                 {
>                   "type": "object",
>                   "properties": {
>                     "tid":  { "type": "number" },
>                     "vid":  { "type": "number" },
>                     "name":  { "type": "string" },
>                     "description":  { "type": "string" },
>                     "format":  { "type": "string" }
>                   }
>                 }
>             example: |
>               [
>                 {
>                   "tid": "10",
>                   "vid": "7",
>                   "name": "Завтраки",
>                   "description": "",
>                   "format": "filtered_html"
>                 },
>                 {
>                   "tid": "11",
>                   "vid": "7",
>                   "name": "Салаты",
>                   "description": "",
>                   "format": "filtered_html"
>                 },
>                 {
>                   "tid": "12",
>                   "vid": "7",
>                   "name": "Супы",
>                   "description": "",
>                   "format": "filtered_html"
>                 }
>               ]
> /dishes.php:
>   displayName: list of dishes
>   post:
>     description: Request to the server with dishes category. return the
> list of dishes in category.
>     body:
>       application/json:
>         schema: |
>           - ConsumerRequest: {"$schema": "http://json-schema.org/schema";,
>             "type": "object",
>             "properties": {
>               "id":  { "type": "number" }
>             }
>           }
>         example: |
>           {
>             "id":"11"
>           }
>     responses:
>       200:
>         body:
>           application/json:
>             schema: |
>               schema: |
>               - CategoryDishesResponse: {"$schema": "
> http://json-schema.org/schema";,
>                 "type": "array",
>                 "items": { "$ref": "CategoryDishesResponseItem" }
>               }
>               - CategoryDishesResponseItem: |
>                 {
>                   "type": "object",
>                   "properties": {
>                     "nid":  { "type": "number" },
>                     "node_created":  { "type": "number" },
>                     "img_path":  { "type": "string" },
>                     "node_title":  { "type": "string" }
>                   }
>                 }
>             example: |
>               [
>                 {
>                   "nid": "29",
>                   "node_created": "1432460612",
>                   "img_path": "
> http://barashki.net/sites/default/files/styles/________170x145_/public/kare-yagnenka-v-souse-med-balzamik-1390_2.jpg
> ",
>                   "node_title": "Каре свинины с соусом BBQ"
>                 },
>                 {
>                   "nid": "28",
>                   "node_created": "1432460570",
>                   "img_path": "
> http://barashki.net/sites/default/files/styles/________170x145_/public/kare-yagnenka-v-souse-med-balzamik-1390_0.jpg
> ",
>                   "node_title": "Каре баранины с коньячным соусом 35"
>                 },
>                 {
>                   "nid": "27",
>                   "node_created": "1432460525",
>                   "img_path": "
> http://barashki.net/sites/default/files/styles/________170x145_/public/kare-yagnenka-v-souse-med-balzamik-1390.jpg
> ",
>                   "node_title": "Каре баранины с коньячным соусом 34"
>                 }
>               ]
> /product.php:
>   displayName: list of dishes
>   post:
>     description: Request to the server for describe current product.
> return the parameters of current product.
>     body:
>       application/json:
>         schema: |
>           - ConsumerRequest: {"$schema": "http://json-schema.org/schema";,
>             "type": "object",
>             "properties": {
>               "id":  { "type": "number" }
>             }
>           }
>         example: |
>           {
>             "id":"21"
>           }
>     responses:
>       200:
>         body:
>           application/json:
>             schema: |
>               {"$schema": "http://json-schema.org/schema";,
>                   "type": "object",
>                   "properties": {
>                     "nid":  { "type": "number" },
>                     "title":  { "type": "string" },
>                     "price":  { "type": "number" },
>                     "weight":  { "type": "number" },
>                     "sku":  { "type": "number" },
>                     "img_path":  { "type": "string" }
>                   }
>                 }
>             example: |
>               {
>                 "nid": "21",
>                 "title": "Каре баранины с коньячным соусом 3",
>                 "price": "26000",
>                 "weight": "380",
>                 "sku": "Product-3",
>                 "img_path": "
> http://barashki.net/sites/default/files/styles/________170x145_/public/kare-yagnenka-v-souse-med-balzamik-1390_2.jpg
> "
>               }
> /delivery/index.php:
>   displayName: delivery data
>   post:
>     description: Return start values for creating basket price process.
> points - array points list for ComboBox with prices. discounts - array
> items list for math operation. consist from
>     responses:
>       200:
>         body:
>           application/json:
>             schema: |
>               - ResponseDiscount: {"$schema": "
> http://json-schema.org/schema";,
>                 "type": "object",
>                 "properties": {
>                   "points": {
>                     "type": "array",
>                     "items": { "$ref": "PointsItems" }
>                   },
>                   "discounts": {
>                     "type": "array",
>                     "items": { "$ref": "DiscountItems" }
>                   }
>                 }
>               }
>               - PointsItems: |
>                 {
>                   "type": "object",
>                   "properties": {
>                     "tid":  { "type": "number" },
>                     "name":  { "type": "string" },
>                     "price":  { "type": "number" }
>                   }
>                 }
>               - DiscountItems: |
>                 {
>                   "type": "object",
>                   "properties": {
>                     "value":  { "type": "number" },
>                     "discount":  { "type": "number" },
>                     "enddelivery":  { "type": "number" }
>                   }
>                 }
>             example: |
>               {
>                 "points": [
>                   {
>                     "tid": "21",
>                     "name": "БСИ до компании ПОДРЯД",
>                     "price": "15000"
>                   },
>                   {
>                     "tid": "22",
>                     "name": "БСИ после компании ПОДРЯД",
>                     "price": "17000"
>                   }
>                 ],
>                 "discounts": [
>                   {
>                     "value": "60000",
>                     "discount": "10000",
>                     "enddelivery": "-1"
>                   },
>                   {
>                     "value": "100000",
>                     "discount": "-1",
>                     "enddelivery": "0"
>                   }
>                 ]
>               }
> /consumer/index.php:
>   displayName: consumer's basket
>   post:
>     description: Request to server with buy parameters. Notice -
> "delivery" might be in two states "0" - "Самовывоз", "1" - "Курьер".
> "delivery_count" - the amount of cutlery in order. "delivery_coin" - bank
> bill, which would pay for the order.
>     body:
>       application/json:
>         schema: |
>           - ConsumerRequest: {"$schema": "http://json-schema.org/schema";,
>             "type": "object",
>             "properties": {
>               "products": {
>                 "type": "array",
>                 "items": { "$ref": "ProductItems" }
>               },
>               "delivery":  { "type": "number" },
>               "delivery_price":  { "type": "string" },
>               "delivery_district":  { "type": "string" },
>               "delivery_adress":  { "type": "string" },
>               "delivery_name":  { "type": "string" },
>               "delivery_phone":  { "type": "string" },
>               "delivery_count":  { "type": "string" },
>               "delivery_coin":  { "type": "number" },
>               "delivery_description":  { "type": "string" }
>             }
>           }
>           - ProductItems: |
>             {
>               "type": "object",
>               "properties": {
>                 "id":  { "type": "number" },
>                 "count":  { "type": "number" }
>               }
>             }
>         example: |
>           {
>             "products":[
>               {
>                 "id":"21",
>                 "count":"1"
>               },
>               {
>                 "id":"20",
>                 "count":"2"
>               }
>             ],
>             "delivery":"0",
>             "delivery_price":"20000",
>             "delivery_city":"Набережные Челны",
>             "delivery_district":"БСИ до компании ПОДРЯД",
>             "delivery_adress":"ул. Ленина. д5 кв61",
>             "delivery_name":"Вертер",
>             "delivery_phone":"82291234567",
>             "delivery_count":"1",
>             "delivery_coin":"100000",
>             "delivery_description":"масло машинное ффтопку"
>           }
>     responses:
>       200:
>         body:
>           application/json:
>             schema: |
>               {
>                 "type": "object",
>                 "properties": {
>                   "result":  { "type": "number" }
>                 }
>               }
>             example: |
>               {"result":"200"}
>
> Maybe someone know how can i display info from this RESTful api?
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Emmanuel DEMEY
Consultant
Zenika
+33 (0)6 47 47 42 02
[email protected]

   - fr.linkedin.com/in/emmanueldemey/


Twitter : @EmmanuelDemey

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to