MBurger Headless CMS
User GuideCMS HeadlessEngagement Platform
  • 🍔MBurger Documentation🍔
  • 🔑 API
    • Introduction
      • Getting Started
      • Structure
    • Common Path
      • Basics
      • POST Bodies
      • POST Relations
      • Evaluating Responses
    • API Authentication
    • Project
    • Blocks
      • Get Blocks
      • Get Block
    • Sections
      • Get Sections
      • Get Section
      • Create Section
      • Update Section
      • Delete Section
    • Media
      • Get All Media
      • Upload Media
      • Get Media
      • Delete Media
    • Integrations / Extensions
      • Authentication Provider
        • Registration
        • Login
        • Logout
        • Get Profile
        • Update Profile
        • Delete Profile
        • Change Password
        • Forgot Password
      • Live Messages
        • Get All Live Messages
        • Send Live Message
        • Delete Live Message
      • In-App Subscriptions
        • InApp Subscription
        • Resume InApp Subscription
      • Shopify
        • Create a Shopify private app
        • Enable Shopify in MBurger
        • Collections Editor
      • Stripe
        • Create Customer
        • Get Cards
        • Create Card
        • Make Default
        • Delete Card
        • Subscription
        • Cancel Subscription
        • Resume Subscription
        • Payment
    • Going Deeper
      • Available Data Types (Elements)
  • 📱 Android SDK
    • Introduction
    • Installation
    • Initialization
    • Fetch for blocks
    • Fetch sections from blocks
    • Mapping to custom objects
    • Admin
      • Delete a Section/Media
      • Create a new Section
      • Update an existing Section
    • Auth
      • Register a new user
      • Authenticate a user
      • User profile
      • Edit profile
      • Other features
    • Proguard Rules
    • Plugins
    • Sample Apps
      • MBurger Explorer
      • MBurger Radio
    • MBurger Apps
  • 🍏 iOS SDK
    • Introduction
    • Installation
    • Initialization
    • Fetch the project
    • Fetch blocks
    • Fetch sections
    • Media
    • Encoding & Decoding
    • Serialization & Equality
    • Admin
      • Add/Edit a section
      • Delete a section
      • Upload media
      • Delete a media
    • Auth
      • Register a user
      • Authenticate a user
      • Retrieve user information
      • Update user profile
    • Plugins
    • Sample Apps
      • MBurger Explorer
      • MBurger Radio
    • MBurger Apps
  • 💻 PHP SDK
    • Installation & Configuration
    • How to use
    • Support & Feedback
    • License
  • ☕ JavaScript SDK
    • Introduction
    • Installation
    • Configuration
    • Methods Reference
    • Support & Feedback
    • License
  • 🔷Flutter SDK
    • Installation
    • Initialization
    • Fetch the project
    • Fetch blocks
    • Fetch sections
    • Media
    • Admin
      • Add/Edit a section
      • Delete a section
      • Upload a media
      • Delete a media
    • Auth
      • Register a user
      • Authenticate a user
      • Retrieve user information
      • Update user profile
  • ❓How to?
    • Basic interactions
      • Blocks
        • Get a Single Block
        • Get multiple Blocks
      • Sections
        • Get a single Section
        • Get Multiple Sections
        • Create a Section
        • Update a Section
        • Delete a Section
    • Advanced section retrieval
      • Filter sections
      • Obtain distance from a section
      • Manage locales and the fallback language
      • Get a section by SLUG
      • Obtain only sections with a defined relation
    • Advanced section creation
      • Create a section with a relation
      • Set the value of a checkbox element
      • Create a section with a multiple or dropdown element
      • Create a section with a SLUG
      • Create a section with SEO
      • Send or schedule a push when creating a section
    • Set the visibility of a section
    • Get images with various format
  • 👻 Sample App
    • Introduction
    • Create an MBurger project
    • Create Home, News and Gallery blocks
    • Create the project
    • Setup the SDK
    • Query the API for items
    • Map your objects from MBurger objects
    • Implement push notifications
    • Take a bite
Powered by GitBook
On this page

Was this helpful?

  1. JavaScript SDK

Methods Reference

3.1 - Initiate the connection

Init the connection to MBurger with your API Key.

const instance = mburger.createClient({
    api_key: '1234567890'
});

3.2 - Retrieve a single Section

Specification

Data Type

Description

section_id

Integer

ID of the requested Section

original_media

Boolean

Indicate if you want the original media or the converted ones

use_slug

Boolean

Declare if you want to use the section slug instead of the ID to retrieve data

locale

String

Country code of the required locale

3.2.1 - Sample code

 // Import MBurger SDK
 const mburger = require('mburger');
 
// Init the connection
const instance = mburger.createClient({
    api_key: '1234567890'
});

// Get a specific block
instance.getSection({
    section_id: 10088,
    locale: 'it',
    original_media: false
}).then(result => console.log(result));

3.3 - Retrieve a single Block

Specification

Data Type

Description

block_id

Integer

ID of the requested Block

force_locale_fallback

Boolean

Set the parameters force_locale_fallback as indicated in the documentation

locale

String

Country code of the required locale

original_media

Boolean

Indicate if you want the original media or the converted ones

params

Object

The parameters you want to pass to the MBurger params variable. Check our API Reference for more informations

order_asc

Boolean

Declare if you want the data in ascendent or descendent order

3.3.1 - Sample code

 // Import MBurger SDK
 const mburger = require('mburger');
 
// Init the connection
const instance = mburger.createClient({
    api_key: '1234567890'
});

// Retrieve a specific block
instance.getBlock({
    block_id: 884,
    locale: 'it',
    original_media: false
}).then(result => console.log(result));

3.4 - Retrieve multiple Blocks

Specification

Data Type

Description

block_ids

Array

ID of the requested Blocks

filters

Object

The filters you want to pass to the MBurger params variable. Check our API Reference for more informations

order_asc

Boolean

Declare if you want the data in ascendent or descendent order

3.4.1 - Sample code

// Import MBurger SDK
const mburger = require('mburger');

// Init the connection
const instance = mburger.createClient({
    api_key: '1234567890'
});

// Retrieve data from the block
instance.getBlocks({
    block_ids: [884, 886],
    locale: 'it'
}).then(result => console.log(result));

PreviousConfigurationNextSupport & Feedback

Last updated 4 years ago

Was this helpful?

☕