Ms.banners

Fields

name
Type: string

Required: Yes
{ "name" : "test banner" }
Name of banner. It is required field
image
Type: file

Required: Yes
{
image: {
    data: "image_url",
    uploadType: 'url',
    //size:'210412',
    type: "image/jpeg"
}
} 

Image of banner.It is required field
url
Type: string
{ "url" :'url' }

Url of bannner
title
Type: string
{  "title":"tester" }

Title of banner
subtitle
Type: string
{"subtitle" : "Test_banner"}

Subtitle of banner
 
publish
Type: string
{"publish" : '1'}

Publishing of banner 
sort_order
Type: number
{"sort_order" : 4}

Sorting the banner of orderwise
Add POST /api/1/entity/ms.banners

Add the record in the entity.

Example

Banner Add Example
POST

Example Request Json

{
  name: 'banner1',
  image: {
    data: "http://s3.amazonaws.com/mystore.in/s/57027a58079833564ac17211/ms.local_themes/57c010b7b4344f7524261e0d/ajax-loader.gif",
    uploadType: 'url',
    //size:'210412',
    type: "image/jpeg"
  },
  url: 'url',
  title: 'tester',
  subtitle: 'testing'
};

Example Response

Response to request will be like this:

Example Response Json

{
  data: {
    _id: '58456795e5e21ec76c4ab1af'
  },
  messages: [
    {
      level: 'success',
      key: 'ms.entity.banners.add',
      message: ''
    }
  ]
}

Message

Code Message
ms.entity.banners.add

Query Parameters

Code Message
entityName The entity in which you want to add.
data(request) The required details to add a banner.
Update PUT /api/1/entity/ms.banners/#{_id}

Update the record in the entity.

Example

Banner update Example
PUT

Example Request Json

{
  name: 'testing',
  image: {
    data: "http://s3.amazonaws.com/mystore.in/s/57027a58079833564ac17211/ms.local_themes/57c010b7b4344f7524261e0d/ajax-loader.gif",
    uploadType: 'url',
    type: "image/jpeg"
  }
};

Example Response

Response to request will be like this:

Example Response Json

{
  data: 'updated successfully',
  messages: [
    {
      level: 'success',
      key: 'ms.entity.banners.edit',
      message: ''
    }
  ]
}

Message

Code Message
ms.entity.banners.edit

Query Parameters

Code Message
EntityName The entity in which you want to update.
data(request) The required details to update a banner.
_id Unique ID of the banner that is update.
List GET /api/1/entity/ms.banners

List the records saved in the entity.

Example

Banner list Example
GET

Example Request Json

{
  entity: 'ms.banners',
  command: 'list'
}

Example Response

Response to request will be like this:

Example Response Json

{
  data: [
    {
      _id: '584568bde5e21ec76c4ab29f',
      name: 'eretertrt',
      image: 'ms.banners/584568c0bd188511792b45fa.gif',
      url: 'url',
      title: 'tester',
      subtitle: 'testing',
      publish: '1',
      _metadata: [
        Object
      ],
      sort_order: 0,
      created_on: '2016-12-05T13:16:47.788Z',
      updated_on: '2016-12-05T13:16:49.652Z'
    }
  ],
  messages: [
    {
      level: 'success',
      key: 'ms.entity.banners.list',
      message: ''
    }
  ],
  paging: {
    limit: 50,
    start: 0,
    count: 1,
    total: 1
  }
}

Message

Code Message
ms.entity.banners.list

Query Parameters

Code Message
EntityName The entity in which you want to list.
Query Parameter In Query we pass the name filter which we list according its name.
Delete DELETE /api/1/entity/ms.banners/#{_id}

This method helps to delete a banner with given resourceId

Example

Banner delete Example
DELETE

Example Request Json

{
  entity: 'ms.banners',
  recordId: '58456a86e5e21ec76c4ab513',
  command: 'delete'
};

Example Response

Response to request will be like this:

Example Response Json

{
  data: 'updated successfully',
  messages: [
    {
      level: 'success',
      key: 'ms.entity.banners.delete',
      message: ''
    }
  ]
}

Message

Code Message
ms.entity.banners.delete

Query Parameters

Code Message
entityName Name of the entity
resourceId Unique user Id of banner that needs to be deleted
Get GET /api/1/entity/ms.banners/#{_id}

Get the record in the entity.

Example

Banner get Example
GET

Example Request Json

{
  entity: 'ms.banners',
  recordId: '58456e5ce5e21ec76c4abac2',
  command: 'get'
}

Example Response

<pre> Response to request will be like this: </pre>

Example Response Json

{
  data: {
    _id: '58456e5ce5e21ec76c4abac2',
    name: 'banner1',
    image: 'ms.banners/58456e5cbd188511792b4686.gif',
    url: 'url',
    title: 'banner123',
    subtitle: 'banner1231221',
    publish: '1',
    sort_order: 0,
    created_on: '2016-12-05T13:40:45.993Z'
  },
  messages: [
    {
      level: 'success',
      key: 'ms.entity.banners.get',
      message: ''
    }
  ]
}

Message

Code Message
ms.entity.banners.get