Git Product home page Git Product logo

statamic-fetch's Introduction

Fetch

Access content directly as JSON using URL endpoints or via a simple tag.

This addon will automatically make any of your collections, entries, pages & globals accessible via a URL endpoint, GET / POST request, or via a simple tag.

Accessing your content via URL endpoints can be very useful when you need to fetch your site's data dynamically using Ajax or when you need access from another domain.

Getting started

To get started and for a list of available parameters, check out the docs.

Example

Say we have a simple collection of blog entries and a single entry looks like:

title: My Awesome Blog Post
id: f1f92ae6-00a8-4626-a1fc-de900a7f9203
content: Lorem ipsum aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
categories:
  - statamic
  - addons
images:
  - /assets/img/cool-stuff.jpg
  - /assets/img/pretty-flowers.jpg

The returned data would look like:

[
    {
        "title": "My Awesome Blog Post",
        "id": "7285536e-c383-46fc-8b09-8ae117446d85",
        "content": "Lorem ipsum aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.",
        "categories": [
            {
                "title": "Statamic",
                "id": "categories/statamic",
                "slug": "statamic",
                ...
            },
            {
                "title": "Awesome Addons",
                "id": "categories/addons",
                "slug": "addons",
                ...
            }
        ],
        "images": [
            "http://domain.com/assets/img/cool-stuff.jpg",
            "http://domain.com/assets/img/pretty-flowers.jpg"
        ],
        "slug": "my-awesome-blog-post",
        "url": "/blog/2016-11-09-my-awesome-blog-post",
        "permalink": "http://domain.com/blog/2016-11-09-my-awesome-blog-post",
        ...
    },
    ...
]

Note: a lot more data is returned, this is simply a summary for the example.

statamic-fetch's People

Contributors

aryehraber avatar rrelmy avatar bognarl avatar makkinga avatar

Watchers

Alexander Muischneek avatar Dennis Schenk avatar James Cloos avatar Stefan Wanzenried avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.