0

So I'm using Apiary to hold and array of data, and then call the data to display on HTML but I only want Apiary to send a limited amount of data to HTML, not the full array. Still trying to get my head around Apiary syntax, so just wondering if I'm heading in the right direction (or would I be doing this via the frontend?), because what I'm using doesn't work and the documentation isn't clear to me :

##news updates [/articles{?limit}]
###Get all news [GET]

+ Parameters

+ limit (number, optional)
    + Default: '3'



+ Request

  + Header

        Authorization: Basic dXNlcjpwYXNzd29yZA==
        x-api-verson: 1.0



+ Response 200 (application/json)


        {
                "articles": [
                    {
                        *array item one*
                    },
                    {
                        *array item two*
                    },
                    {
                        *array item three*
                    },
                    {
                        *array item four*
                    },
                  ]
         }
Whirlwind990
  • 99
  • 2
  • 14

1 Answers1

0

You can set up multiple examples, per here:

https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#example-multiple-transaction-examples

And then you can access different examples using the Prefer header in a mock request per "Invoking non-default responses" section here:

http://support.apiary.io/knowledgebase/articles/117119-handling-multiple-actions-on-a-single-resource

fosrias
  • 211
  • 1
  • 3
  • 7
  • thanks, I had a read of those documentations but they aren't specifically clear as how to sent limited data from the array to the HTML – Whirlwind990 Jul 21 '15 at 02:55
  • 1
    Apiary has no concept of the array inside the response. *You* have to prepare the filtered arrays yourself as different responses. – vzsg Jul 22 '15 at 05:32