{"_id":"58e76f2a654e3839008655dc","excerpt":"","hidden":false,"next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","title":"Getting Started","type":"basic","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655ce","api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","parentDoc":null,"user":"55a575ebaaf9cf1900114d73","__v":0,"body":"The MOCA API can be used to automate beacon fleet management, connect your CRM data, built custom functionalities, and query analytics reports. Through MOCA REST API, you can integrate third-party systems and access raw data. It enables the inclusion of maps and analysis of mobile users’ flow indoors and outdoors.\n\nThe MOCA API is organized around REST. The API lets you interact with MOCA Platform from anything that can send an HTTP request. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients, and we support cross-origin resource sharing to allow you to interact securely with our API from a client-side web application (though you should remember that you should never expose your secret API key in any public website's client-side code). JSON will be returned in all responses from the API, including errors.\n\nThere are many things you can do with the REST API. For example:\n* Register new mobile app\n* Manage fleet of beacons\n* Automatically register all your places (i.e. physical locations)\n* Create audience segments\n* Program marketing campaigns targeted to selected segments\n* Send push notifications\n* Query analytics data \n* Query user profiles\n* Export raw data\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"SSL only\"\n}\n[/block]\nWe require that all requests are done over SSL. Calls made over plain HTTP will fail. You must authenticate for all requests.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"UTF-8 encoding\"\n}\n[/block]\nEvery string passed to and from the MOCA API needs to be UTF-8 encoded. For maximum compatibility, normalize to [Unicode Normalization Form C (NFC)](http://unicode.org/reports/tr15/) before UTF-8 encoding.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Date & time format\"\n}\n[/block]\nAll dates and times in the API are 64-big long integer that encode number of milliseconds since midnight, January 1, 1970 UTC.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Making a request\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The MOCA REST API is accessed from the URL `https://api.mocaplatform.com/v2/`. The path is prefixed with the API version which is currently *`v2`*.\"\n}\n[/block]\nTo send a new request, you must include a `Content-Type` header and JSON payload.\t\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"HTTP verbs\"\n}\n[/block]\nWhere possible, API v1 strives to use appropriate HTTP verbs for each action.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Verb\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GET\",\n    \"1-0\": \"POST\",\n    \"2-0\": \"PUT\",\n    \"3-0\": \"DELETE\",\n    \"3-1\": \"Used for deleting resources.\",\n    \"2-1\": \"Used for replacing resources or collections. For PUT requests with no body attribute, be sure to set the Content-Length header to zero.\",\n    \"1-1\": \"Used for creating resources.\",\n    \"0-1\": \"Used for retrieving resources.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Error handling\"\n}\n[/block]\nMOCA uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the caller provided information (e.g. a required parameter was missing, a charge failed, etc.), and codes in the 5xx range indicate an error with MOCA's servers.\n\nErrors are returned using standard HTTP error code syntax. Any additional info is included in the body of the return call, JSON-formatted.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Code\",\n    \"h-1\": \"Name\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"200\",\n    \"0-1\": \"OK\",\n    \"0-2\": \"Everything worked successfully!\",\n    \"1-0\": \"201\",\n    \"1-1\": \"Created\",\n    \"1-2\": \"When you're creating a new object, this will be returned upon success.\",\n    \"2-0\": \"400\",\n    \"2-1\": \"Bad Request\",\n    \"2-2\": \"We could not process the action due to client error.\",\n    \"3-0\": \"403\",\n    \"3-1\": \"Forbidden\",\n    \"3-2\": \"We couldn't authenticate you, or you don't have access to that resource.\",\n    \"4-0\": \"404\",\n    \"4-1\": \"Not Found\",\n    \"4-2\": \"The requested resource could not be found.\",\n    \"5-0\": \"408\",\n    \"5-1\": \"Request Timeout\",\n    \"5-2\": \"The server timed out waiting for the request. The client may repeat the request without modifications at any later time.\",\n    \"7-0\": \"415\",\n    \"7-1\": \"Unsupported Media Type\",\n    \"7-2\": \"The request entity has a media type which the server or resource does not support.\",\n    \"8-0\": \"500\",\n    \"8-1\": \"Internal Server Error\",\n    \"8-2\": \"Ooops! Something went wrong in MOCA Backend. The team will look into it.\",\n    \"9-0\": \"503\",\n    \"9-1\": \"Service Unavailable\",\n    \"9-2\": \"The service is currently unavailable because it is overloaded or down for maintenance.\",\n    \"6-0\": \"409\",\n    \"6-1\": \"Conflict\",\n    \"6-2\": \"The request could not be processed because of a conflict in the request.\"\n  },\n  \"cols\": 3,\n  \"rows\": 10\n}\n[/block]\nOur API libraries can raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. We recommend always trying to gracefully handle exceptions from our API.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Pagination\"\n}\n[/block]\nAll top-level MOCA API resources have support for bulk fetches — \"list\" API methods. For instance you can *List Apps*, *List Beacons*, and *List Experiences*. These list API methods share a common structure.\n\nMOCA utilizes cursor-based pagination, using the parameters `offset` and `limit`.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Argument\",\n    \"h-1\": \"Optional?\",\n    \"h-2\": \"Data type\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"offset\",\n    \"0-3\": \"the sequential index of the first object to return.\",\n    \"0-1\": \"YES\",\n    \"0-2\": \"integer\",\n    \"1-0\": \"limit\",\n    \"1-1\": \"YES\",\n    \"1-2\": \"integer\",\n    \"1-3\": \"the maximum number of objects to retrieve.\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response headers\"\n}\n[/block]\nEach API response has an associated header automatically generated by MOCA servers.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Header name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"X-Server-Timestamp\",\n    \"0-1\": \"UTC timestamp generated by the server when generating this response.\",\n    \"1-0\": \"X-Api-Version\",\n    \"1-1\": \"REST API version number\",\n    \"2-0\": \"Server\",\n    \"2-1\": \"Name of the server that generated the response.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]","createdAt":"2015-07-14T22:16:48.027Z","isReference":true,"link_external":false,"link_url":"","order":0,"slug":"moca-api-getting-started","updates":[],"sync_unique":"","childrenPages":[]}

Getting Started


The MOCA API can be used to automate beacon fleet management, connect your CRM data, built custom functionalities, and query analytics reports. Through MOCA REST API, you can integrate third-party systems and access raw data. It enables the inclusion of maps and analysis of mobile users’ flow indoors and outdoors. The MOCA API is organized around REST. The API lets you interact with MOCA Platform from anything that can send an HTTP request. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients, and we support cross-origin resource sharing to allow you to interact securely with our API from a client-side web application (though you should remember that you should never expose your secret API key in any public website's client-side code). JSON will be returned in all responses from the API, including errors. There are many things you can do with the REST API. For example: * Register new mobile app * Manage fleet of beacons * Automatically register all your places (i.e. physical locations) * Create audience segments * Program marketing campaigns targeted to selected segments * Send push notifications * Query analytics data * Query user profiles * Export raw data [block:api-header] { "type": "basic", "title": "SSL only" } [/block] We require that all requests are done over SSL. Calls made over plain HTTP will fail. You must authenticate for all requests. [block:api-header] { "type": "basic", "title": "UTF-8 encoding" } [/block] Every string passed to and from the MOCA API needs to be UTF-8 encoded. For maximum compatibility, normalize to [Unicode Normalization Form C (NFC)](http://unicode.org/reports/tr15/) before UTF-8 encoding. [block:api-header] { "type": "basic", "title": "Date & time format" } [/block] All dates and times in the API are 64-big long integer that encode number of milliseconds since midnight, January 1, 1970 UTC. [block:api-header] { "type": "basic", "title": "Making a request" } [/block] [block:callout] { "type": "info", "body": "The MOCA REST API is accessed from the URL `https://api.mocaplatform.com/v2/`. The path is prefixed with the API version which is currently *`v2`*." } [/block] To send a new request, you must include a `Content-Type` header and JSON payload. [block:api-header] { "type": "basic", "title": "HTTP verbs" } [/block] Where possible, API v1 strives to use appropriate HTTP verbs for each action. [block:parameters] { "data": { "h-0": "Verb", "h-1": "Description", "0-0": "GET", "1-0": "POST", "2-0": "PUT", "3-0": "DELETE", "3-1": "Used for deleting resources.", "2-1": "Used for replacing resources or collections. For PUT requests with no body attribute, be sure to set the Content-Length header to zero.", "1-1": "Used for creating resources.", "0-1": "Used for retrieving resources." }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Error handling" } [/block] MOCA uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the caller provided information (e.g. a required parameter was missing, a charge failed, etc.), and codes in the 5xx range indicate an error with MOCA's servers. Errors are returned using standard HTTP error code syntax. Any additional info is included in the body of the return call, JSON-formatted. [block:parameters] { "data": { "h-0": "Code", "h-1": "Name", "h-2": "Description", "0-0": "200", "0-1": "OK", "0-2": "Everything worked successfully!", "1-0": "201", "1-1": "Created", "1-2": "When you're creating a new object, this will be returned upon success.", "2-0": "400", "2-1": "Bad Request", "2-2": "We could not process the action due to client error.", "3-0": "403", "3-1": "Forbidden", "3-2": "We couldn't authenticate you, or you don't have access to that resource.", "4-0": "404", "4-1": "Not Found", "4-2": "The requested resource could not be found.", "5-0": "408", "5-1": "Request Timeout", "5-2": "The server timed out waiting for the request. The client may repeat the request without modifications at any later time.", "7-0": "415", "7-1": "Unsupported Media Type", "7-2": "The request entity has a media type which the server or resource does not support.", "8-0": "500", "8-1": "Internal Server Error", "8-2": "Ooops! Something went wrong in MOCA Backend. The team will look into it.", "9-0": "503", "9-1": "Service Unavailable", "9-2": "The service is currently unavailable because it is overloaded or down for maintenance.", "6-0": "409", "6-1": "Conflict", "6-2": "The request could not be processed because of a conflict in the request." }, "cols": 3, "rows": 10 } [/block] Our API libraries can raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. We recommend always trying to gracefully handle exceptions from our API. [block:api-header] { "type": "basic", "title": "Pagination" } [/block] All top-level MOCA API resources have support for bulk fetches — "list" API methods. For instance you can *List Apps*, *List Beacons*, and *List Experiences*. These list API methods share a common structure. MOCA utilizes cursor-based pagination, using the parameters `offset` and `limit`. [block:parameters] { "data": { "h-0": "Argument", "h-1": "Optional?", "h-2": "Data type", "h-3": "Description", "0-0": "offset", "0-3": "the sequential index of the first object to return.", "0-1": "YES", "0-2": "integer", "1-0": "limit", "1-1": "YES", "1-2": "integer", "1-3": "the maximum number of objects to retrieve." }, "cols": 4, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Response headers" } [/block] Each API response has an associated header automatically generated by MOCA servers. [block:parameters] { "data": { "h-0": "Header name", "h-1": "Description", "0-0": "X-Server-Timestamp", "0-1": "UTC timestamp generated by the server when generating this response.", "1-0": "X-Api-Version", "1-1": "REST API version number", "2-0": "Server", "2-1": "Name of the server that generated the response." }, "cols": 2, "rows": 3 } [/block]
View all 75 endpoints
The MOCA API can be used to automate beacon fleet management, connect your CRM data, built custom functionalities, and query analytics reports. Through MOCA REST API, you can integrate third-party systems and access raw data. It enables the inclusion of maps and analysis of mobile users’ flow indoors and outdoors. The MOCA API is organized around REST. The API lets you interact with MOCA Platform from anything that can send an HTTP request. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients, and we support cross-origin resource sharing to allow you to interact securely with our API from a client-side web application (though you should remember that you should never expose your secret API key in any public website's client-side code). JSON will be returned in all responses from the API, including errors. There are many things you can do with the REST API. For example: * Register new mobile app * Manage fleet of beacons * Automatically register all your places (i.e. physical locations) * Create audience segments * Program marketing campaigns targeted to selected segments * Send push notifications * Query analytics data * Query user profiles * Export raw data [block:api-header] { "type": "basic", "title": "SSL only" } [/block] We require that all requests are done over SSL. Calls made over plain HTTP will fail. You must authenticate for all requests. [block:api-header] { "type": "basic", "title": "UTF-8 encoding" } [/block] Every string passed to and from the MOCA API needs to be UTF-8 encoded. For maximum compatibility, normalize to [Unicode Normalization Form C (NFC)](http://unicode.org/reports/tr15/) before UTF-8 encoding. [block:api-header] { "type": "basic", "title": "Date & time format" } [/block] All dates and times in the API are 64-big long integer that encode number of milliseconds since midnight, January 1, 1970 UTC. [block:api-header] { "type": "basic", "title": "Making a request" } [/block] [block:callout] { "type": "info", "body": "The MOCA REST API is accessed from the URL `https://api.mocaplatform.com/v2/`. The path is prefixed with the API version which is currently *`v2`*." } [/block] To send a new request, you must include a `Content-Type` header and JSON payload. [block:api-header] { "type": "basic", "title": "HTTP verbs" } [/block] Where possible, API v1 strives to use appropriate HTTP verbs for each action. [block:parameters] { "data": { "h-0": "Verb", "h-1": "Description", "0-0": "GET", "1-0": "POST", "2-0": "PUT", "3-0": "DELETE", "3-1": "Used for deleting resources.", "2-1": "Used for replacing resources or collections. For PUT requests with no body attribute, be sure to set the Content-Length header to zero.", "1-1": "Used for creating resources.", "0-1": "Used for retrieving resources." }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Error handling" } [/block] MOCA uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the caller provided information (e.g. a required parameter was missing, a charge failed, etc.), and codes in the 5xx range indicate an error with MOCA's servers. Errors are returned using standard HTTP error code syntax. Any additional info is included in the body of the return call, JSON-formatted. [block:parameters] { "data": { "h-0": "Code", "h-1": "Name", "h-2": "Description", "0-0": "200", "0-1": "OK", "0-2": "Everything worked successfully!", "1-0": "201", "1-1": "Created", "1-2": "When you're creating a new object, this will be returned upon success.", "2-0": "400", "2-1": "Bad Request", "2-2": "We could not process the action due to client error.", "3-0": "403", "3-1": "Forbidden", "3-2": "We couldn't authenticate you, or you don't have access to that resource.", "4-0": "404", "4-1": "Not Found", "4-2": "The requested resource could not be found.", "5-0": "408", "5-1": "Request Timeout", "5-2": "The server timed out waiting for the request. The client may repeat the request without modifications at any later time.", "7-0": "415", "7-1": "Unsupported Media Type", "7-2": "The request entity has a media type which the server or resource does not support.", "8-0": "500", "8-1": "Internal Server Error", "8-2": "Ooops! Something went wrong in MOCA Backend. The team will look into it.", "9-0": "503", "9-1": "Service Unavailable", "9-2": "The service is currently unavailable because it is overloaded or down for maintenance.", "6-0": "409", "6-1": "Conflict", "6-2": "The request could not be processed because of a conflict in the request." }, "cols": 3, "rows": 10 } [/block] Our API libraries can raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. We recommend always trying to gracefully handle exceptions from our API. [block:api-header] { "type": "basic", "title": "Pagination" } [/block] All top-level MOCA API resources have support for bulk fetches — "list" API methods. For instance you can *List Apps*, *List Beacons*, and *List Experiences*. These list API methods share a common structure. MOCA utilizes cursor-based pagination, using the parameters `offset` and `limit`. [block:parameters] { "data": { "h-0": "Argument", "h-1": "Optional?", "h-2": "Data type", "h-3": "Description", "0-0": "offset", "0-3": "the sequential index of the first object to return.", "0-1": "YES", "0-2": "integer", "1-0": "limit", "1-1": "YES", "1-2": "integer", "1-3": "the maximum number of objects to retrieve." }, "cols": 4, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Response headers" } [/block] Each API response has an associated header automatically generated by MOCA servers. [block:parameters] { "data": { "h-0": "Header name", "h-1": "Description", "0-0": "X-Server-Timestamp", "0-1": "UTC timestamp generated by the server when generating this response.", "1-0": "X-Api-Version", "1-1": "REST API version number", "2-0": "Server", "2-1": "Name of the server that generated the response." }, "cols": 2, "rows": 3 } [/block]
{"_id":"593fb8666f2334000f6b00d5","project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655ce","user":"55a54dde9c32760d00ca78a8","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-13T10:03:18.328Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":1,"body":"MOCA API Version 2 uses [OAuth 2.0](http://oauth.net/) for authenticating all API requests.\n\nThe first step to use the API is to generate an Access Token, which is then included in all subsequent requests to the server.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Generating an Access Token\",\n  \"body\": \"Please note that the access to the API is only available for MOCA clients and MOCA Partners. Depending on MOCA product contracted the usage of the API may be subject to additional fees.\\n\\nIf you need an Access Token to access our API, please make a request at support@mocaplatform.com\"\n}\n[/block]\nOnce an Access Token is obtained, the following header must be added to all requests:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Authorization: Bearer XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nThis token will represent the user that generated it, and will allow access to all resources available to them.","excerpt":"","slug":"moca-api-authentication","type":"basic","title":"Authentication","__v":0,"parentDoc":null,"childrenPages":[]}

Authentication


MOCA API Version 2 uses [OAuth 2.0](http://oauth.net/) for authenticating all API requests. The first step to use the API is to generate an Access Token, which is then included in all subsequent requests to the server. [block:callout] { "type": "warning", "title": "Generating an Access Token", "body": "Please note that the access to the API is only available for MOCA clients and MOCA Partners. Depending on MOCA product contracted the usage of the API may be subject to additional fees.\n\nIf you need an Access Token to access our API, please make a request at support@mocaplatform.com" } [/block] Once an Access Token is obtained, the following header must be added to all requests: [block:code] { "codes": [ { "code": "Authorization: Bearer XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "language": "text" } ] } [/block] This token will represent the user that generated it, and will allow access to all resources available to them.
MOCA API Version 2 uses [OAuth 2.0](http://oauth.net/) for authenticating all API requests. The first step to use the API is to generate an Access Token, which is then included in all subsequent requests to the server. [block:callout] { "type": "warning", "title": "Generating an Access Token", "body": "Please note that the access to the API is only available for MOCA clients and MOCA Partners. Depending on MOCA product contracted the usage of the API may be subject to additional fees.\n\nIf you need an Access Token to access our API, please make a request at support@mocaplatform.com" } [/block] Once an Access Token is obtained, the following header must be added to all requests: [block:code] { "codes": [ { "code": "Authorization: Bearer XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "language": "text" } ] } [/block] This token will represent the user that generated it, and will allow access to all resources available to them.
{"_id":"58ef3f2f2c4ffc390008ad68","link_url":"","project":"559a61d2dbcfd20d00710b39","type":"basic","title":"Overview","updates":[],"__v":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Place object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"createdAt\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Mandatory?\",\n    \"h-3\": \"Description\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"2-0\": \"placeId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Place identifier.\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the Place.\",\n    \"5-0\": \"config.description\",\n    \"5-1\": \"string\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Description of the Place.\",\n    \"6-0\": \"config.geoFence\",\n    \"6-1\": \"GeoFence\",\n    \"6-2\": \"No\",\n    \"6-3\": \"GeoFence data of the place.\",\n    \"3-0\": \"accountId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"Id of the parent Account.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last update time (timestamp UTC).\",\n    \"7-0\": \"config.geoFence.latitude\",\n    \"7-1\": \"double\",\n    \"7-2\": \"Yes\",\n    \"7-3\": \"The latitude of the center of the GeoFence. Valid range: [-90, 90]\",\n    \"8-0\": \"config.geoFence.longitude\",\n    \"8-1\": \"double\",\n    \"8-2\": \"Yes\",\n    \"8-3\": \"The longitude of the center of the GeoFence. Valid range: [-180, 180]\",\n    \"9-0\": \"config.geoFence.radius\",\n    \"9-1\": \"float\",\n    \"9-2\": \"Yes\",\n    \"9-3\": \"The radius of the GeoFence. Minimum value: 100\",\n    \"10-0\": \"config.geoFence.geoTag\",\n    \"10-1\": \"GeoTag\",\n    \"10-2\": \"No\",\n    \"10-3\": \"Localization data of the GeoFence.\",\n    \"11-0\": \"zones\",\n    \"11-1\": \"Zone list\",\n    \"11-2\": \"No (Read only view)\",\n    \"11-3\": \"List of Zones contained in the Place\"\n  },\n  \"cols\": 4,\n  \"rows\": 12\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1491816253020,\\n  \\\"updatedAt\\\": 1492010406138,\\n  \\\"placeId\\\": \\\"rzwbxsgXSRSxqdjSe7xZTQ\\\",\\n  \\\"accountId\\\": \\\"TAPFXFowToO4dFsktFzz9Q\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"Innoquant HQ\\\",\\n    \\\"description\\\": \\\"This is our office!\\\",\\n    \\\"geoFence\\\": {\\n      \\\"latitude\\\": 41.46728360204384,\\n      \\\"longitude\\\": 2.0912861824035645,\\n      \\\"radius\\\": 100,\\n      \\\"type\\\": 0,\\n      \\\"geoTag\\\": {\\n        \\\"country\\\": \\\"ES\\\",\\n        \\\"region\\\": \\\"Catalunya\\\",\\n        \\\"county\\\": \\\"Barcelona\\\",\\n        \\\"locality\\\": \\\"Sant Cugat del Vallès, 57\\\",\\n        \\\"postCode\\\": \\\"08172\\\",\\n        \\\"streetName\\\": \\\"Avinguda de la Torre Blanca\\\",\\n        \\\"countryFID\\\": \\\"429f72bc-81ab-d2cc-438a-ace356bde631\\\",\\n        \\\"regionFID\\\": \\\"082a01de-81ab-d2cc-438a-ace356bde631\\\",\\n        \\\"countyFID\\\": \\\"082a09e0-81ab-d2cc-438a-ace356bde631\\\",\\n        \\\"localityFID\\\": \\\"0832922c-81ab-d2cc-438a-ace356bde631\\\",\\n        \\\"displayName\\\": \\\"Avinguda de la Torre Blanca, Sant Cugat del Vallès, 57, 08172, Barcelona\\\"\\n      }\\n    }\\n  },\\n  \\\"zones\\\": [\\n    {\\n      \\\"createdAt\\\": 1491816253021,\\n      \\\"updatedAt\\\": 1492010611380,\\n      \\\"zoneId\\\": \\\"1udDPRkMQrKivHgU8vIyUg\\\",\\n      \\\"placeId\\\": \\\"rzwbxsgXSRSxqdjSe7xZTQ\\\",\\n      \\\"config\\\": {\\n        \\\"name\\\": \\\"HQ Entrance\\\",\\n        \\\"description\\\": \\\"Building entrance\\\",\\n        \\\"floorNumber\\\": 0,\\n        \\\"category\\\": \\\"Entrance\\\",\\n        \\\"enabled\\\": true,\\n        \\\"type\\\": \\\"BeaconGroup\\\",\\n        \\\"provider\\\": \\\"MOCA\\\"\\n      },\\n      \\\"placeName\\\": \\\"Innoquant HQ\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Place\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","hidden":false,"isReference":true,"parentDoc":null,"githubsync":"","link_external":false,"order":0,"api":{"settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"auth":"required","params":[],"url":""},"category":"58e76f2a654e3839008655d9","createdAt":"2017-04-13T09:04:47.891Z","excerpt":"Represents a physical place. Can be composed of Zones and Beacons.","slug":"moca-api-places","user":"55a54dde9c32760d00ca78a8","next":{"pages":[],"description":""},"sync_unique":"","version":"58e76f2a654e3839008655c8","childrenPages":[]}

Overview

Represents a physical place. Can be composed of Zones and Beacons.

[block:api-header] { "type": "basic", "title": "The Place object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "placeId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Place identifier.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Place.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the Place.", "6-0": "config.geoFence", "6-1": "GeoFence", "6-2": "No", "6-3": "GeoFence data of the place.", "3-0": "accountId", "3-1": "string", "3-2": "Yes", "3-3": "Id of the parent Account.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last update time (timestamp UTC).", "7-0": "config.geoFence.latitude", "7-1": "double", "7-2": "Yes", "7-3": "The latitude of the center of the GeoFence. Valid range: [-90, 90]", "8-0": "config.geoFence.longitude", "8-1": "double", "8-2": "Yes", "8-3": "The longitude of the center of the GeoFence. Valid range: [-180, 180]", "9-0": "config.geoFence.radius", "9-1": "float", "9-2": "Yes", "9-3": "The radius of the GeoFence. Minimum value: 100", "10-0": "config.geoFence.geoTag", "10-1": "GeoTag", "10-2": "No", "10-3": "Localization data of the GeoFence.", "11-0": "zones", "11-1": "Zone list", "11-2": "No (Read only view)", "11-3": "List of Zones contained in the Place" }, "cols": 4, "rows": 12 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1491816253020,\n \"updatedAt\": 1492010406138,\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n \"config\": {\n \"name\": \"Innoquant HQ\",\n \"description\": \"This is our office!\",\n \"geoFence\": {\n \"latitude\": 41.46728360204384,\n \"longitude\": 2.0912861824035645,\n \"radius\": 100,\n \"type\": 0,\n \"geoTag\": {\n \"country\": \"ES\",\n \"region\": \"Catalunya\",\n \"county\": \"Barcelona\",\n \"locality\": \"Sant Cugat del Vallès, 57\",\n \"postCode\": \"08172\",\n \"streetName\": \"Avinguda de la Torre Blanca\",\n \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n \"displayName\": \"Avinguda de la Torre Blanca, Sant Cugat del Vallès, 57, 08172, Barcelona\"\n }\n }\n },\n \"zones\": [\n {\n \"createdAt\": 1491816253021,\n \"updatedAt\": 1492010611380,\n \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n \"config\": {\n \"name\": \"HQ Entrance\",\n \"description\": \"Building entrance\",\n \"floorNumber\": 0,\n \"category\": \"Entrance\",\n \"enabled\": true,\n \"type\": \"BeaconGroup\",\n \"provider\": \"MOCA\"\n },\n \"placeName\": \"Innoquant HQ\"\n }\n ]\n}", "language": "json", "name": "Sample Place" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "The Place object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "placeId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Place identifier.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Place.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the Place.", "6-0": "config.geoFence", "6-1": "GeoFence", "6-2": "No", "6-3": "GeoFence data of the place.", "3-0": "accountId", "3-1": "string", "3-2": "Yes", "3-3": "Id of the parent Account.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last update time (timestamp UTC).", "7-0": "config.geoFence.latitude", "7-1": "double", "7-2": "Yes", "7-3": "The latitude of the center of the GeoFence. Valid range: [-90, 90]", "8-0": "config.geoFence.longitude", "8-1": "double", "8-2": "Yes", "8-3": "The longitude of the center of the GeoFence. Valid range: [-180, 180]", "9-0": "config.geoFence.radius", "9-1": "float", "9-2": "Yes", "9-3": "The radius of the GeoFence. Minimum value: 100", "10-0": "config.geoFence.geoTag", "10-1": "GeoTag", "10-2": "No", "10-3": "Localization data of the GeoFence.", "11-0": "zones", "11-1": "Zone list", "11-2": "No (Read only view)", "11-3": "List of Zones contained in the Place" }, "cols": 4, "rows": 12 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1491816253020,\n \"updatedAt\": 1492010406138,\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n \"config\": {\n \"name\": \"Innoquant HQ\",\n \"description\": \"This is our office!\",\n \"geoFence\": {\n \"latitude\": 41.46728360204384,\n \"longitude\": 2.0912861824035645,\n \"radius\": 100,\n \"type\": 0,\n \"geoTag\": {\n \"country\": \"ES\",\n \"region\": \"Catalunya\",\n \"county\": \"Barcelona\",\n \"locality\": \"Sant Cugat del Vallès, 57\",\n \"postCode\": \"08172\",\n \"streetName\": \"Avinguda de la Torre Blanca\",\n \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n \"displayName\": \"Avinguda de la Torre Blanca, Sant Cugat del Vallès, 57, 08172, Barcelona\"\n }\n }\n },\n \"zones\": [\n {\n \"createdAt\": 1491816253021,\n \"updatedAt\": 1492010611380,\n \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n \"config\": {\n \"name\": \"HQ Entrance\",\n \"description\": \"Building entrance\",\n \"floorNumber\": 0,\n \"category\": \"Entrance\",\n \"enabled\": true,\n \"type\": \"BeaconGroup\",\n \"provider\": \"MOCA\"\n },\n \"placeName\": \"Innoquant HQ\"\n }\n ]\n}", "language": "json", "name": "Sample Place" } ], "sidebar": true } [/block]
{"_id":"58ef3f818646742f0099fdb0","githubsync":"","link_external":false,"sync_unique":"","title":"Get all places","type":"get","category":"58e76f2a654e3839008655d9","excerpt":"Returns a list of all Places across user's memberships, including Places both owned and from other accounts this user was invited to. The Places are returned in sorted order, with the most recent Place appearing last.\n\nSupports paging.","__v":0,"api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"default":"0","desc":"Paging offset. Used to indicate the index of the first object to be returned.","in":"query","name":"offset","ref":"","required":false,"type":"int","_id":"55ae008c8576b92300291c26"},{"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","in":"query","name":"limit","ref":"","required":false,"type":"int","_id":"55ae008c8576b92300291c25","default":"1000"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1491816253020,\n    \"updatedAt\": 1492010406138,\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"config\": {\n      \"name\": \"Innoquant HQ\",\n      \"description\": \"This is our office!\",\n      \"geoFence\": {\n        \"latitude\": 41.46728360204384,\n        \"longitude\": 2.0912861824035645,\n        \"radius\": 100,\n        \"geoTag\": {\n          \"country\": \"ES\",\n          \"region\": \"Catalunya\",\n          \"county\": \"Barcelona\",\n          \"locality\": \"Sant Cugat del Vallès, 57\",\n          \"postCode\": \"08172\",\n          \"streetName\": \"Avinguda de la Torre Blanca\",\n          \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n          \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n          \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n          \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n          \"displayName\": \"Avinguda de la Torre Blanca, Sant Cugat del Vallès, 57, 08172, Barcelona\"\n        }\n      }\n    },\n    \"zones\": [\n      {\n        \"createdAt\": 1491816253021,\n        \"updatedAt\": 1492010611380,\n        \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n        \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n        \"config\": {\n          \"name\": \"HQ Entrance\",\n          \"description\": \"Building entrance\",\n          \"floorNumber\": 0,\n          \"category\": \"Entrance\",\n          \"enabled\": true,\n          \"type\": \"BeaconGroup\",\n          \"provider\": \"MOCA\",\n          \"options\": {}\n        },\n        \"placeName\": \"Innoquant HQ\"\n      }\n    ]\n  }\n]","name":""},{"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401}]},"settings":"","url":"/places/?offset=:offset&limit=:limit"},"createdAt":"2017-04-13T09:06:09.972Z","isReference":true,"link_url":"","order":1,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","updates":[],"user":"55a54dde9c32760d00ca78a8","body":"","hidden":false,"next":{"pages":[],"description":""},"slug":"moca-api-get-places","version":"58e76f2a654e3839008655c8","childrenPages":[]}

getGet all places

Returns a list of all Places across user's memberships, including Places both owned and from other accounts this user was invited to. The Places are returned in sorted order, with the most recent Place appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef3fbd2c4ffc390008ad8a","updates":[],"order":2,"slug":"moca-api-get-place","type":"get","excerpt":"Retrieves the details of an existing Place.","hidden":false,"isReference":true,"link_external":false,"next":{"pages":[],"description":""},"__v":0,"api":{"examples":{"codes":[]},"method":"get","params":[{"name":"placeId","ref":"","required":true,"type":"string","_id":"55ae0ec0f302af23000ac07f","default":"","desc":"Request Place id.","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1491816253020,\n  \"updatedAt\": 1492010406138,\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"config\": {\n    \"name\": \"Innoquant HQ\",\n    \"description\": \"This is our office!\",\n    \"geoFence\": {\n      \"latitude\": 41.46728360204384,\n      \"longitude\": 2.0912861824035645,\n      \"radius\": 100,\n      \"geoTag\": {\n        \"country\": \"ES\",\n        \"region\": \"Catalunya\",\n        \"county\": \"Barcelona\",\n        \"locality\": \"Sant Cugat del Vallès, 57\",\n        \"postCode\": \"08172\",\n        \"streetName\": \"Avinguda de la Torre Blanca\",\n        \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n        \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n        \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n        \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n        \"displayName\": \"Avinguda de la Torre Blanca, Sant Cugat del Vallès, 57, 08172, Barcelona\"\n      }\n    }\n  },\n  \"zones\": [\n    {\n      \"createdAt\": 1491816253021,\n      \"updatedAt\": 1492010611380,\n      \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n      \"config\": {\n        \"name\": \"HQ Entrance\",\n        \"description\": \"Building entrance\",\n        \"floorNumber\": 0,\n        \"category\": \"Entrance\",\n        \"enabled\": true,\n        \"type\": \"BeaconGroup\",\n        \"provider\": \"MOCA\",\n        \"options\": {}\n      },\n      \"placeName\": \"Innoquant HQ\"\n    }\n  ]\n}","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"},{"language":"json","code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Place not found\"\n}","status":404}]},"settings":"","url":"/places/:placeId","auth":"required"},"parentDoc":null,"version":"58e76f2a654e3839008655c8","link_url":"","user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d9","createdAt":"2017-04-13T09:07:09.250Z","githubsync":"","title":"Get single place","body":"","project":"559a61d2dbcfd20d00710b39","sync_unique":"","childrenPages":[]}

getGet single place

Retrieves the details of an existing Place.

Path Params

placeId:
required
string
Request Place id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef3fed8646742f0099fdb2","body":"","link_url":"","next":{"pages":[],"description":""},"slug":"moca-api-search-places","sync_unique":"","type":"post","__v":0,"createdAt":"2017-04-13T09:07:57.536Z","githubsync":"","link_external":false,"updates":[],"category":"58e76f2a654e3839008655d9","excerpt":"Returns a list of Places that matched the requested criteria across user's memberships, including Places both owned and from other accounts this user was invited to. The Places are returned in sorted order, with the most recent Place appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","isReference":true,"project":"559a61d2dbcfd20d00710b39","title":"Search places","user":"55a54dde9c32760d00ca78a8","api":{"auth":"required","examples":{"codes":[{"name":null,"code":"{\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"name\": \"%Innoquant%\",\n    \"includeDeleted\": true,\n    \"offset\": 0,\n    \"limit\": 10\n}","language":"json"}]},"method":"post","params":[{"default":"","desc":"Account Id where Places will be searched.","in":"body","name":"accountId","ref":"","required":false,"type":"string","_id":"58ee4a7cc7df622300815ead"},{"in":"body","required":false,"desc":"Place name to be searched, use % as wildcard.","default":"","type":"string","name":"name","_id":"58ee4a7cc7df622300815eac","ref":""},{"name":"includeDeleted","ref":"","required":false,"type":"boolean","_id":"58ee4a7cc7df622300815eab","default":"false","desc":"Include already deleted Places in the search.","in":"body"},{"name":"offset","_id":"58ee4a7cc7df622300815eaa","ref":"","in":"body","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned","default":"0","type":"int"},{"type":"int","name":"limit","_id":"58ee4a7cc7df622300815ea9","ref":"","in":"body","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved","default":"1000"}],"results":{"codes":[{"name":"","code":"[\n  {\n    \"createdAt\": 1491816253020,\n    \"updatedAt\": 1492010406138,\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"config\": {\n      \"name\": \"Innoquant HQ\",\n      \"description\": \"This is our office!\",\n      \"geoFence\": {\n        \"latitude\": 41.46728360204384,\n        \"longitude\": 2.0912861824035645,\n        \"radius\": 100,\n        \"geoTag\": {\n          \"country\": \"ES\",\n          \"region\": \"Catalunya\",\n          \"county\": \"Barcelona\",\n          \"locality\": \"Sant Cugat del Vallès, 57\",\n          \"postCode\": \"08172\",\n          \"streetName\": \"Avinguda de la Torre Blanca\",\n          \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n          \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n          \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n          \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n          \"displayName\": \"Avinguda de la Torre Blanca, Sant Cugat del Vallès, 57, 08172, Barcelona\"\n        }\n      }\n    },\n    \"zones\": [\n      {\n        \"createdAt\": 1491816253021,\n        \"updatedAt\": 1492010611380,\n        \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n        \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n        \"config\": {\n          \"name\": \"HQ Entrance\",\n          \"description\": \"Building entrance\",\n          \"floorNumber\": 0,\n          \"category\": \"Entrance\",\n          \"enabled\": true,\n          \"type\": \"BeaconGroup\",\n          \"provider\": \"MOCA\",\n          \"options\": {}\n        },\n        \"placeName\": \"Innoquant HQ\"\n      }\n    ]\n  }\n]","language":"json","status":200},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}","language":"json","status":400,"name":""},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/places/search"},"hidden":false,"order":3,"parentDoc":null,"version":"58e76f2a654e3839008655c8","childrenPages":[]}

postSearch places

Returns a list of Places that matched the requested criteria across user's memberships, including Places both owned and from other accounts this user was invited to. The Places are returned in sorted order, with the most recent Place appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Places will be searched.
name:
string
Place name to be searched, use % as wildcard.
includeDeleted:
booleanfalse
Include already deleted Places in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef4004303ea40f00c2ed82","githubsync":"","hidden":false,"isReference":true,"parentDoc":null,"title":"Create new place","api":{"params":[{"required":true,"type":"string","_id":"58ee4b75e90d881b0052c7b5","default":"","desc":"Id of the Account where the Place will be created.","in":"query","name":"accountId","ref":""},{"in":"body","name":"name","ref":"","required":true,"type":"string","_id":"58ee4b75e90d881b0052c7b4","default":"","desc":"Name of the Place."},{"default":"","desc":"Place description.","in":"body","name":"description","ref":"","required":false,"type":"string","_id":"58ee4b75e90d881b0052c7b3"},{"ref":"","required":false,"type":"object","_id":"58ee4b75e90d881b0052c7b2","default":"","desc":"GeoFence data. See [Overview](doc:places-3) for more details.","in":"body","name":"geoFence"}],"results":{"codes":[{"name":"","status":201,"language":"json","code":"{\n    \"createdAt\": 1423002857298,\n    \"placeId\": \"vK-Ag8KWGASfi-rBh6VH0A\",\n    \"accountId\": \"AeZQ_Wm9iW2v7QgvdTtmx1\",\n    \"zones\": [],\n    \"config\": {\n      \"name\": \"Entrance\",\n      \"description\": \"Entrance\",\n      \"updatedAt\": 1423003086479,\n      \"geoFence\": {\n        \"latitude\": 46.355351652955464,\n        \"longitude\": -32.135888254928672,\n        \"radius\": 504.504,\n        \"geoTag\": {\n          \"country\": \"ES\",\n          \"region\": \"Catalunya\",\n          \"county\": \"Barcelona\",\n          \"locality\": \"Barcelona\",\n          \"postCode\": \"12345\",\n          \"streetName\": null,\n          \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n          \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n          \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n          \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n          \"displayName\": \"Barcelona, 12345, ES\"\n        }\n      }\n    }\n  }\n]"},{"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'accountId' is not present\"\n}","name":"","status":400},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]},"settings":"","url":"/places/?accountId=:accountId","auth":"required","examples":{"codes":[{"code":"{\n  \"name\": \"Innoquant HQ\",\n  \"description\": \"This is our office!\",\n  \"geoFence\": {\n    \"latitude\": 41.46728360204384,\n    \"longitude\": 2.0912861824035645,\n    \"radius\": 100,\n    \"geoTag\": {\n      \"country\": \"ES\",\n      \"region\": \"Catalunya\",\n      \"county\": \"Barcelona\",\n      \"locality\": \"Sant Cugat del Vallès, 57\",\n      \"postCode\": \"08172\",\n      \"streetName\": \"Avinguda de la Torre Blanca\",\n      \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n      \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n      \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n      \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\"\n    }\n  }\n}","language":"json"}]},"method":"post"},"createdAt":"2017-04-13T09:08:20.637Z","link_url":"","slug":"moca-api-create-place","version":"58e76f2a654e3839008655c8","excerpt":"Creates a new Place.","link_external":false,"order":4,"project":"559a61d2dbcfd20d00710b39","user":"55a54dde9c32760d00ca78a8","updates":[],"__v":0,"body":"","category":"58e76f2a654e3839008655d9","next":{"description":"","pages":[]},"sync_unique":"","type":"post","childrenPages":[]}

postCreate new place

Creates a new Place.

Query Params

accountId:
required
string
Id of the Account where the Place will be created.

Body Params

name:
required
string
Name of the Place.
description:
string
Place description.
geoFence:
object
GeoFence data. See [Overview](doc:places-3) for more details.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef401b8646742f0099fdb3","api":{"method":"post","params":[{"in":"query","name":"accountId","ref":"","required":true,"type":"string","_id":"58ee4b75e90d881b0052c7b5","default":"","desc":"Id of the Account where the Places will be created."},{"ref":"","in":"body","required":true,"desc":"File with place data","default":"","type":"file","name":"file","_id":"58ee4b75e90d881b0052c7b4"},{"desc":"If true, existing Place data will be replaced if the Place name is an exact match. If false, new Places are always created.","in":"query","name":"upsert","ref":"","required":false,"type":"string","_id":"58ee51f204a99a3700eafd2c","default":"true"},{"desc":"File format. Valid values: CSV, JSON","default":"JSON","type":"string","name":"format","_id":"58ee54d5edb2282f00937903","ref":"","in":"query","required":false}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"resources\": {\n    \"places\": [{\n      \"createdAt\": 1491816253020,\n      \"updatedAt\": 1492010406138,\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n      \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n      \"config\": {\n        \"name\": \"Innoquant HQ\",\n        \"description\": \"This is our office!\",\n        \"geoFence\": {\n          \"latitude\": 41.46728360204384,\n          \"longitude\": 2.0912861824035645,\n          \"radius\": 100,\n          \"geoTag\": null\n        }\n      }\n    }]\n  },\n  \"errors\": [{\n    \"source\": {\n      \"config\": {\n        \"name\": \"Invalid Place\",\n        \"description\": \"This is an invalid place!\",\n        \"geoFence\": {\n          \"latitude\": 12.3456789012345678,\n          \"longitude\": null,\n          \"radius\": 50,\n          \"geoTag\": null\n        }\n      }\n    },\n    \"error\": \"Bad Request\",\n    \"error_description\": \"Validation constraints violated\",\n    \"constraints\": {\n      \"batchCreate.config.geoFence.longitude\": \"cannot be null\",\n      \"batchCreate.config.geoFence.radius\": \"Invalid radius: 50. Minimum value: 100\"\n    }\n  }]\n}","name":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'accountId' is not present\"\n}","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/places/batch?accountId=:accountId&upsert=:upsert&format=:format","auth":"required","examples":{"codes":[{"language":"json","code":"[\n  {\n    \"config\": {\n      \"name\": \"Innoquant HQ\",\n      \"description\": \"This is our office!\",\n      \"geoFence\": {\n        \"latitude\": 41.46728360204384,\n        \"longitude\": 2.0912861824035645,\n        \"radius\": 100,\n        \"geoTag\": null\n      }\n    }\n  },\n  {\n    \"config\": {\n      \"name\": \"Invalid Place\",\n      \"description\": \"This is an invalid Place!\",\n      \"geoFence\": {\n        \"latitude\": 12.3456789012345678,\n        \"longitude\": null,\n        \"radius\": 50,\n        \"geoTag\": null\n      }\n    }\n  }\n]","name":"File: JSON"},{"code":"config.name,config.description,config.geoFence.latitude,config.geoFence.longitude,config.geoFence.radius,config.geoFence.geoTag.country,...\nInnoquant HQ,This is our office!,41.46728360204384,2.0912861824035645,100,ES,...\nInvalid Place,This is an invalid place!,12.3456789012345678,,50,,...","language":"text","name":"File: CSV"}]}},"next":{"description":"","pages":[]},"slug":"moca-api-batch-place","title":"Batch place upload","createdAt":"2017-04-13T09:08:43.835Z","excerpt":"Creates multiple Places from a file. Can also be used to update already existing places by name.","isReference":true,"updates":[],"version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d9","githubsync":"","link_external":false,"link_url":"","order":5,"sync_unique":"","user":"55a54dde9c32760d00ca78a8","__v":0,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"BETA Feature\",\n  \"body\": \"This feature is in Beta. If you have any issues, please contact us!\"\n}\n[/block]","hidden":false,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","type":"post","childrenPages":[]}

postBatch place upload

Creates multiple Places from a file. Can also be used to update already existing places by name.

Query Params

accountId:
required
string
Id of the Account where the Places will be created.
upsert:
stringtrue
If true, existing Place data will be replaced if the Place name is an exact match. If false, new Places are always created.
format:
stringJSON
File format. Valid values: CSV, JSON

Body Params

file:
required
file
File with place data
[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]
{"_id":"58ef403d8646742f0099fdb4","createdAt":"2017-04-13T09:09:17.936Z","project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d9","isReference":true,"updates":[],"next":{"pages":[],"description":""},"sync_unique":"","type":"put","api":{"examples":{"codes":[{"language":"json","code":"{\n  \"name\": \"Innoquant HQ\",\n  \"description\": \"This is our office!\",\n  \"geoFence\": {\n    \"latitude\": 41.46728360204384,\n    \"longitude\": 2.0912861824035645,\n    \"radius\": 100,\n    \"geoTag\": {\n      \"country\": \"ES\",\n      \"region\": \"Catalunya\",\n      \"county\": \"Barcelona\",\n      \"locality\": \"Sant Cugat del Vallès, 57\",\n      \"postCode\": \"08172\",\n      \"streetName\": \"Avinguda de la Torre Blanca\",\n      \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n      \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n      \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n      \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\"\n    }\n  }\n}"}]},"method":"put","params":[{"default":"","desc":"Id of the Place to be updated.","in":"path","name":"placeId","ref":"","required":true,"type":"string","_id":"55ae0ec0f302af23000ac07f"},{"in":"body","required":true,"desc":"Name of the Place","default":"","type":"string","name":"name","_id":"58ee4da5f5d0022d00a208c3","ref":""},{"required":false,"desc":"Place description","default":"","type":"string","name":"description","_id":"58ee4da5f5d0022d00a208c2","ref":"","in":"body"},{"type":"object","name":"geoFence","_id":"58ee4da5f5d0022d00a208c1","ref":"","in":"body","required":false,"desc":"GeoFence data. See [Overview](doc:places-3) for more details","default":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"createdAt\": 1423002857298,\n    \"placeId\": \"vK-Ag8KWGASfi-rBh6VH0A\",\n    \"accountId\": \"AeZQ_Wm9iW2v7QgvdTtmx1\",\n    \"zones\": [],\n    \"config\": {\n      \"name\": \"Entrance\",\n      \"description\": \"Entrance\",\n      \"updatedAt\": 1423003086479,\n      \"geoFence\": {\n        \"latitude\": 46.355351652955464,\n        \"longitude\": -32.135888254928672,\n        \"radius\": 504.504,\n        \"type\": 0,\n        \"geoTag\": {\n          \"country\": \"ES\",\n          \"region\": \"Catalunya\",\n          \"county\": \"Barcelona\",\n          \"locality\": \"Barcelona\",\n          \"postCode\": \"12345\",\n          \"streetName\": null,\n          \"countryFID\": \"429f72bc-81ab-d2cc-438a-ace356bde631\",\n          \"regionFID\": \"082a01de-81ab-d2cc-438a-ace356bde631\",\n          \"countyFID\": \"082a09e0-81ab-d2cc-438a-ace356bde631\",\n          \"localityFID\": \"0832922c-81ab-d2cc-438a-ace356bde631\",\n          \"displayName\": \"Barcelona, 12345, ES\"\n        }\n      }\n    },\n    \"floorPlan\": null,\n    \"space\": null,\n    \"placeUrl\": null\n  }\n]","name":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"update.config.name\": \"cannot be null\"\n  }\n}","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/places/:placeId","auth":"required"},"hidden":false,"link_external":false,"link_url":"","order":6,"parentDoc":null,"slug":"moca-api-update-place","title":"Update place","__v":0,"body":"","excerpt":"Updates an already existing Place.","githubsync":"","user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

putUpdate place

Updates an already existing Place.

Path Params

placeId:
required
string
Id of the Place to be updated.

Body Params

name:
required
string
Name of the Place
description:
string
Place description
geoFence:
object
GeoFence data. See [Overview](doc:places-3) for more details

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef40ca14ab683100de1368","link_url":"","slug":"moca-api-delete-place","updates":[],"user":"55a54dde9c32760d00ca78a8","body":"","category":"58e76f2a654e3839008655d9","createdAt":"2017-04-13T09:11:38.221Z","githubsync":"","hidden":false,"isReference":true,"next":{"pages":[],"description":""},"type":"delete","__v":1,"api":{"url":"/places/:placeId","auth":"required","examples":{"codes":[]},"method":"delete","params":[{"default":"","desc":"Id of the Place to be deleted.","in":"path","name":"placeId","ref":"","required":true,"type":"string","_id":"55ae0ec0f302af23000ac07f"}],"results":{"codes":[{"name":"","status":204,"language":"json","code":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":""},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","link_external":false,"order":7,"sync_unique":"","title":"Delete place","excerpt":"Deletes a Place.","childrenPages":[]}

deleteDelete place

Deletes a Place.

Path Params

placeId:
required
string
Id of the Place to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"58ef48ee24acc10f0096b027","slug":"moca-api-zones","updates":[],"api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]}},"createdAt":"2017-04-13T09:46:22.665Z","excerpt":"Represents a zone in a Place.","order":0,"project":"559a61d2dbcfd20d00710b39","user":"55a54dde9c32760d00ca78a8","__v":0,"category":"58e76f2a654e3839008655da","link_external":false,"parentDoc":null,"sync_unique":"","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Zone object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"createdAt\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Mandatory?\",\n    \"h-3\": \"Description\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"3-0\": \"placeId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"Id of the parent Place.\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the Zone.\",\n    \"7-0\": \"config.category\",\n    \"7-1\": \"string\",\n    \"7-2\": \"No\",\n    \"7-3\": \"Category of the Zone.\",\n    \"8-0\": \"config.type\",\n    \"8-1\": \"enum\",\n    \"8-2\": \"No\",\n    \"8-3\": \"Zone type. \\nDefault value: BeaconGroup\\nValid values: BeaconGroup, IndoorGeofence\",\n    \"9-0\": \"config.provider\",\n    \"9-1\": \"enum\",\n    \"9-2\": \"No\",\n    \"9-3\": \"Zone provider.\\nDefault value: MOCA\\nValid values: MOCA, NAO\",\n    \"2-0\": \"zoneId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Zone identifier.\",\n    \"6-0\": \"config.floorNumber\",\n    \"6-1\": \"integer\",\n    \"6-2\": \"No\",\n    \"6-3\": \"Floor number of the Zone.\",\n    \"1-3\": \"Last updated date (timestamp UTC).\",\n    \"1-2\": \"Autogenerated\",\n    \"1-1\": \"long\",\n    \"1-0\": \"updatedAt\",\n    \"5-0\": \"config.description\",\n    \"5-1\": \"string\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Description of the zone.\"\n  },\n  \"cols\": 4,\n  \"rows\": 10\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1491816253021,\\n  \\\"updatedAt\\\": 1492010611380,\\n  \\\"zoneId\\\": \\\"1udDPRkMQrKivHgU8vIyUg\\\",\\n  \\\"placeId\\\": \\\"rzwbxsgXSRSxqdjSe7xZTQ\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"HQ Entrance\\\",\\n    \\\"description\\\": \\\"Building entrance\\\",\\n    \\\"floorNumber\\\": 0,\\n    \\\"category\\\": \\\"Entrance\\\",\\n    \\\"type\\\": \\\"BeaconGroup\\\",\\n    \\\"provider\\\": \\\"MOCA\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Zone object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","hidden":false,"isReference":true,"version":"58e76f2a654e3839008655c8","type":"basic","githubsync":"","link_url":"","next":{"pages":[],"description":""},"title":"Overview","childrenPages":[]}

Overview

Represents a zone in a Place.

[block:api-header] { "type": "basic", "title": "The Zone object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "3-0": "placeId", "3-1": "string", "3-2": "Yes", "3-3": "Id of the parent Place.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Zone.", "7-0": "config.category", "7-1": "string", "7-2": "No", "7-3": "Category of the Zone.", "8-0": "config.type", "8-1": "enum", "8-2": "No", "8-3": "Zone type. \nDefault value: BeaconGroup\nValid values: BeaconGroup, IndoorGeofence", "9-0": "config.provider", "9-1": "enum", "9-2": "No", "9-3": "Zone provider.\nDefault value: MOCA\nValid values: MOCA, NAO", "2-0": "zoneId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Zone identifier.", "6-0": "config.floorNumber", "6-1": "integer", "6-2": "No", "6-3": "Floor number of the Zone.", "1-3": "Last updated date (timestamp UTC).", "1-2": "Autogenerated", "1-1": "long", "1-0": "updatedAt", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the zone." }, "cols": 4, "rows": 10 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1491816253021,\n \"updatedAt\": 1492010611380,\n \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n \"config\": {\n \"name\": \"HQ Entrance\",\n \"description\": \"Building entrance\",\n \"floorNumber\": 0,\n \"category\": \"Entrance\",\n \"type\": \"BeaconGroup\",\n \"provider\": \"MOCA\"\n }\n}", "language": "json", "name": "Sample Zone object" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "The Zone object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "3-0": "placeId", "3-1": "string", "3-2": "Yes", "3-3": "Id of the parent Place.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Zone.", "7-0": "config.category", "7-1": "string", "7-2": "No", "7-3": "Category of the Zone.", "8-0": "config.type", "8-1": "enum", "8-2": "No", "8-3": "Zone type. \nDefault value: BeaconGroup\nValid values: BeaconGroup, IndoorGeofence", "9-0": "config.provider", "9-1": "enum", "9-2": "No", "9-3": "Zone provider.\nDefault value: MOCA\nValid values: MOCA, NAO", "2-0": "zoneId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Zone identifier.", "6-0": "config.floorNumber", "6-1": "integer", "6-2": "No", "6-3": "Floor number of the Zone.", "1-3": "Last updated date (timestamp UTC).", "1-2": "Autogenerated", "1-1": "long", "1-0": "updatedAt", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the zone." }, "cols": 4, "rows": 10 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1491816253021,\n \"updatedAt\": 1492010611380,\n \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n \"config\": {\n \"name\": \"HQ Entrance\",\n \"description\": \"Building entrance\",\n \"floorNumber\": 0,\n \"category\": \"Entrance\",\n \"type\": \"BeaconGroup\",\n \"provider\": \"MOCA\"\n }\n}", "language": "json", "name": "Sample Zone object" } ], "sidebar": true } [/block]
{"_id":"58ef4a82f8c3b00f00011c99","title":"Get all zones","api":{"settings":"","url":"/zones/?offset=:offset&limit=:limit","auth":"required","examples":{"codes":[]},"method":"get","params":[{"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset","_id":"58ef4a2e303ea40f00c2ee9f","ref":"","in":"query","required":false},{"name":"limit","_id":"58ef4a2e303ea40f00c2ee9e","ref":"","in":"query","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","default":"1000","type":"int"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1491816253021,\n    \"updatedAt\": 1492010611380,\n    \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"config\": {\n      \"name\": \"HQ Entrance\",\n      \"description\": \"Building entrance\",\n      \"floorNumber\": 0,\n      \"category\": \"Entrance\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    }\n  },\n  {\n    \"createdAt\": 1492077063085,\n    \"updatedAt\": 1492077063088,\n    \"zoneId\": \"c38CJwNYQluV9OsZgnUaUw\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"config\": {\n      \"name\": \"Office\",\n      \"description\": \"Innoquant HQ Office\",\n      \"floorNumber\": 3,\n      \"category\": \"Office\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    }\n  }\n]","name":""},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]}},"category":"58e76f2a654e3839008655da","next":{"pages":[],"description":""},"order":1,"sync_unique":"","__v":0,"excerpt":"Returns a list of all Zones across user's memberships, including Zones both owned and from other accounts this user was invited to. The Zones are returned in sorted order, with the most recent Zone appearing last.\n\nSupports paging.","githubsync":"","parentDoc":null,"project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","createdAt":"2017-04-13T09:53:06.782Z","isReference":true,"link_url":"","slug":"moca-api-get-zones","type":"get","updates":[],"body":"","hidden":false,"link_external":false,"user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

getGet all zones

Returns a list of all Zones across user's memberships, including Zones both owned and from other accounts this user was invited to. The Zones are returned in sorted order, with the most recent Zone appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef4be514ab683100de1450","type":"get","version":"58e76f2a654e3839008655c8","hidden":false,"isReference":true,"link_url":"","next":{"pages":[],"description":""},"order":2,"sync_unique":"","api":{"method":"get","params":[{"in":"path","name":"zoneId","ref":"","required":true,"type":"string","_id":"55ae0ec0f302af23000ac07f","default":"","desc":"Requested Zone id."}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1491816253021,\n  \"updatedAt\": 1492010611380,\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"config\": {\n    \"name\": \"HQ Entrance\",\n    \"description\": \"Building entrance\",\n    \"floorNumber\": 0,\n    \"category\": \"Entrance\",\n    \"type\": \"BeaconGroup\",\n    \"provider\": \"MOCA\"\n  }\n}","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"},{"code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Zone not found\"\n}","language":"json","status":404}]},"settings":"","url":"/zones/:zoneId","auth":"required","examples":{"codes":[]}},"body":"","excerpt":"Retrieves the details of an existing Zone.","parentDoc":null,"project":"559a61d2dbcfd20d00710b39","updates":[],"__v":0,"category":"58e76f2a654e3839008655da","githubsync":"","title":"Get single zone","user":"55a54dde9c32760d00ca78a8","createdAt":"2017-04-13T09:59:01.523Z","link_external":false,"slug":"moca-api-get-zone","childrenPages":[]}

getGet single zone

Retrieves the details of an existing Zone.

Path Params

zoneId:
required
string
Requested Zone id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef4e53303ea40f00c2eea6","hidden":false,"isReference":true,"project":"559a61d2dbcfd20d00710b39","updates":[],"createdAt":"2017-04-13T10:09:23.538Z","sync_unique":"","type":"post","version":"58e76f2a654e3839008655c8","excerpt":"Returns a list of Zones that matched the requested criteria across user's memberships, including Zones both owned and from other accounts this user was invited to. The Zones are returned in sorted order, with the most recent Zone appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","link_url":"","body":"","category":"58e76f2a654e3839008655da","githubsync":"","link_external":false,"next":{"pages":[],"description":""},"order":3,"__v":2,"api":{"results":{"codes":[{"code":"[\n  {\n    \"createdAt\": 1491816253021,\n    \"updatedAt\": 1492010611380,\n    \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"config\": {\n      \"name\": \"HQ Entrance\",\n      \"description\": \"Building entrance\",\n      \"floorNumber\": 0,\n      \"category\": \"Entrance\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    }\n  }\n]","language":"json","status":200,"name":""},{"language":"json","status":400,"name":"","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/zones/search","auth":"required","examples":{"codes":[{"name":null,"code":"{\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"name\": \"%Innoquant%\",\n  \"type\": \"BeaconGroup\",\n  \"includeDeleted\": true,\n  \"offset\": 0,\n  \"limit\": 10\n}","language":"json"}]},"method":"post","params":[{"name":"accountId","_id":"58f60dcf4c413f19007a2b2f","ref":"","in":"body","required":false,"desc":"Account Id where Zones will be searched.","default":"","type":"string"},{"type":"string","name":"placeId","_id":"58ee4a7cc7df622300815ead","ref":"","in":"body","required":false,"desc":"Place Id where Zones will be searched.","default":""},{"desc":"Zone name to be searched, use % as wildcard.","default":"","type":"string","name":"name","_id":"58ee4a7cc7df622300815eac","ref":"","in":"body","required":false},{"name":"type","_id":"58ef4fd624acc10f0096b0dd","ref":"","in":"body","required":false,"desc":"Zone type to be searched.","default":"","type":"string"},{"default":"false","desc":"Include already deleted Zones in the search.","in":"body","name":"includeDeleted","ref":"","required":false,"type":"boolean","_id":"58ee4a7cc7df622300815eab"},{"ref":"","required":false,"type":"int","_id":"58ee4a7cc7df622300815eaa","default":"0","desc":"Paging offset. Used to indicate the index of the first object to be returned.","in":"body","name":"offset"},{"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","in":"body","name":"limit","ref":"","required":false,"type":"int","_id":"58ee4a7cc7df622300815ea9","default":"1000"}]},"parentDoc":null,"slug":"moca-api-search-zones","title":"Search zones","user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

postSearch zones

Returns a list of Zones that matched the requested criteria across user's memberships, including Zones both owned and from other accounts this user was invited to. The Zones are returned in sorted order, with the most recent Zone appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Zones will be searched.
placeId:
string
Place Id where Zones will be searched.
name:
string
Zone name to be searched, use % as wildcard.
type:
string
Zone type to be searched.
includeDeleted:
booleanfalse
Include already deleted Zones in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef4e288646742f0099feb1","updates":[],"user":"55a54dde9c32760d00ca78a8","createdAt":"2017-04-13T10:08:40.110Z","excerpt":"Creates a new Zone.","hidden":false,"sync_unique":"","api":{"settings":"","url":"/zones/?placeId=:placeId","auth":"required","examples":{"codes":[{"code":"{\n  \"name\": \"Office\",\n  \"description\": \"Innoquant HQ Office\",\n  \"floorNumber\": 3,\n  \"category\": \"Office\",\n  \"type\": \"BeaconGroup\",\n  \"provider\": \"MOCA\",\n  \"options\": {}\n}","language":"json"}]},"method":"post","params":[{"required":true,"desc":"Id of the Place where the Zone will be created.","default":"","type":"string","name":"placeId","_id":"58ef4c3e2c4ffc390008ae7a","ref":"","in":"query"},{"type":"string","name":"name","_id":"58ef4dd3f8c3b00f00011cc8","ref":"","in":"body","required":true,"desc":"Name of the Zone.","default":""},{"required":false,"desc":"Zone description.","default":"","type":"string","name":"description","_id":"58ef4dd3f8c3b00f00011cc7","ref":"","in":"body"},{"ref":"","in":"body","required":false,"desc":"Number of the floor the Zone is located at.","default":"0","type":"int","name":"floorNumber","_id":"58ef4dd3f8c3b00f00011cc6"},{"in":"body","required":false,"desc":"Zone category.","default":"","type":"string","name":"category","_id":"58ef4dd3f8c3b00f00011cc5","ref":""},{"desc":"Zone type.","default":"BeaconGroup","type":"string","name":"type","_id":"58ef4dd3f8c3b00f00011cc4","ref":"","in":"body","required":false},{"name":"provider","_id":"58ef4dd3f8c3b00f00011cc3","ref":"","in":"body","required":false,"desc":"Zone provider.","default":"MOCA","type":"string"}],"results":{"codes":[{"language":"json","status":201,"name":"","code":"{\n  \"createdAt\": 1491816253021,\n  \"updatedAt\": 1492010611380,\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"config\": {\n    \"name\": \"HQ Entrance\",\n    \"description\": \"Building entrance\",\n    \"floorNumber\": 0,\n    \"category\": \"Entrance\",\n    \"type\": \"BeaconGroup\",\n    \"provider\": \"MOCA\"\n  }\n}"},{"name":"","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'placeId' is not present\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}","language":"json","status":400},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field type: Can not deserialize value of type com.iq.moca.services.model.resources.Zone$Type from String \\\"Invalid\\\": value not one of declared Enum instance names: [BeaconGroup, IndoorGeofence]\"\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]}},"link_external":false,"project":"559a61d2dbcfd20d00710b39","title":"Create new zone","type":"post","githubsync":"","next":{"pages":[],"description":""},"order":4,"parentDoc":null,"isReference":true,"link_url":"","slug":"moca-api-create-zone","version":"58e76f2a654e3839008655c8","__v":0,"body":"","category":"58e76f2a654e3839008655da","childrenPages":[]}

postCreate new zone

Creates a new Zone.

Query Params

placeId:
required
string
Id of the Place where the Zone will be created.

Body Params

name:
required
string
Name of the Zone.
description:
string
Zone description.
floorNumber:
integer0
Number of the floor the Zone is located at.
category:
string
Zone category.
type:
stringBeaconGroup
Zone type.
provider:
stringMOCA
Zone provider.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef535f2c4ffc390008af3b","category":"58e76f2a654e3839008655da","hidden":false,"link_external":false,"next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","updates":[],"__v":0,"parentDoc":null,"title":"Batch zone upload","version":"58e76f2a654e3839008655c8","api":{"auth":"required","examples":{"codes":[{"language":"json","code":"[\n  {\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"config\": {\n      \"name\": \"Office\",\n      \"description\": \"Innoquant HQ Office\",\n      \"floorNumber\": 3,\n      \"category\": \"Office\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    }\n  },\n  {\n    \"place\": {\n      \"name\": \"Innoquant HQ\"\n    },\n    \"config\": {\n      \"name\": \"New zone 1\",\n      \"description\": \"This is a new Zone reusing an existing Place!\",\n      \"floorNumber\": 3,\n      \"category\": \"New\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    }\n  },\n  {\n    \"place\": {\n      \"name\": \"New place\",\n      \"description\": \"This is a new Place!\",\n      \"geoFence\": {\n        \"latitude\": 1.2345678901234567,\n        \"longitude\": 7.6543210987654321,\n        \"radius\": 100,\n        \"geoTag\": null\n      }\n    },\n    \"config\": {\n      \"name\": \"New zone 2\",\n      \"description\": \"This is a new Zone created in a new Place!\",\n      \"floorNumber\": 3,\n      \"category\": \"New\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    }\n  },\n  {\n    \"place\": {\n      \"name\": \"New place\"\n    },\n    \"config\": {\n      \"name\": \"Invalid Zone\",\n      \"description\": \"This is an invalid Zone!\",\n      \"floorNumber\": 1,\n      \"category\": \"Invalid\",\n      \"type\": \"Invalid\",\n      \"provider\": \"MOCA\"\n    }\n  }\n]","name":"File: JSON"},{"code":"placeId,place.name,place.description,place.geoFence.latitude,place.longitude,place.radius,config.name,config.description,config.floorNumber,config.category,config.type,config.provider\nrzwbxsgXSRSxqdjSe7xZTQ,,,,,,Office,Innoquant HQ Office,3,Office,BeaconGroup,MOCA\n,Innoquant HQ,,,,,New zone 1,This is a new Zone reusing an existing Place!,3,New,BeaconGroup,MOCA\n,New place,This is a new Place!,1.2345678901234567,7.6543210987654321,100,New zone 2,This is a new Zone created in a new Place!,3,New,BeaconGroup,MOCA\n,New place,,,,,Invalid Zone,This is an invalid Zone!,1,Invalid,Invalid,MOCA","language":"text","name":"File: CSV"}]},"method":"post","params":[{"name":"accountId","ref":"","required":true,"type":"string","_id":"58ee4b75e90d881b0052c7b5","default":"","desc":"Id of the Account where the Zones and Places will be created.","in":"query"},{"_id":"58ee4b75e90d881b0052c7b4","default":"","desc":"File with Zone and Place data.","in":"body","name":"file","ref":"","required":true,"type":"file"},{"_id":"58ee51f204a99a3700eafd2c","default":"true","desc":"If true, existing Zone/Place data will be replaced if the Zone/Place name is an exact match. If false, new Zones/Places are always created.","in":"query","name":"upsert","ref":"","required":false,"type":"string"},{"_id":"58ee54d5edb2282f00937903","ref":"","in":"query","required":false,"desc":"File format. Valid values: CSV, JSON","default":"JSON","type":"string","name":"format"}],"results":{"codes":[{"language":"json","code":"{\n  \"resources\": {\n    \"places\": [{\n      \"createdAt\": 1491816253022,\n      \"updatedAt\": 1491816253022,\n      \"placeId\": \"edIuSRWyWz4Ut5WakhQDBg\",\n      \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n      \"config\": {\n        \"name\": \"New place\",\n        \"description\": \"This is a new Place!\",\n        \"geoFence\": {\n          \"latitude\": 1.2345678901234567,\n          \"longitude\": 7.6543210987654321,\n          \"radius\": 100,\n          \"geoTag\": null\n        }\n      }\n    }],\n    \"zones\": [{\n      \"createdAt\": 1491816253020,\n      \"updatedAt\": 1491816253020,\n      \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n      \"config\": {\n        \"name\": \"HQ Entrance\",\n        \"description\": \"Building entrance\",\n        \"floorNumber\": 0,\n        \"category\": \"Entrance\",\n        \"type\": \"BeaconGroup\",\n        \"provider\": \"MOCA\"\n      }\n    },\n    {\n      \"createdAt\": 1491816253021,\n      \"updatedAt\": 1491816253021,\n      \"zoneId\": \"9VmSl2xFwVxNuB3ct9fqJQ\",\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n      \"config\": {\n        \"name\": \"New zone 1\",\n        \"description\": \"This is a new Zone reusing an existing Place!\",\n        \"floorNumber\": 3,\n        \"category\": \"New\",\n        \"type\": \"BeaconGroup\",\n        \"provider\": \"MOCA\"\n      }\n    },\n    {\n      \"createdAt\": 1491816253021,\n      \"updatedAt\": 1491816253021,\n      \"zoneId\": \"Sf2diA8h_q-SPvGU1RWuLA\",\n      \"placeId\": \"edIuSRWyWz4Ut5WakhQDBg\",\n      \"config\": {\n        \"name\": \"New zone 2\",\n        \"description\": \"This is a new Zone created in a new Place!\",\n        \"floorNumber\": 3,\n        \"category\": \"New\",\n        \"type\": \"BeaconGroup\",\n        \"provider\": \"MOCA\"\n      }\n    }]\n  },\n  \"errors\": [{\n    \"source\": {\n      \"place\": { \n        \"name\": \"New place\"\n      },\n      \"config\": {\n        \"name\": \"Invalid Zone\",\n        \"description\": \"This is an invalid Zone!\",\n        \"floorNumber\": 1,\n        \"category\": \"Invalid\",\n        \"type\": \"Invalid\",\n        \"provider\": \"MOCA\"\n      }\n    },\n    \"error\": \"Bad Request\",\n    \"error_description\": \"Invalid format for field type: Can not deserialize value of type com.iq.moca.services.model.resources.Zone$Type from String \\\"Invalid\\\": value not one of declared Enum instance names: [BeaconGroup, IndoorGeofence]\"\n  }]\n}","name":"","status":200},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'accountId' is not present\"\n}","name":""},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]},"settings":"","url":"/zones/batch?accountId=:accountId&upsert=:upsert&format=:format"},"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"BETA Feature\",\n  \"body\": \"This feature is in Beta. If you have any issues, please contact us!\"\n}\n[/block]","githubsync":"","link_url":"","slug":"moca-api-batch-zone","sync_unique":"","createdAt":"2017-04-13T10:30:55.292Z","excerpt":"Creates multiple Zones and Places from a file. \n\nCan also be used to update already existing places by name.","isReference":true,"order":5,"type":"post","user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

postBatch zone upload

Creates multiple Zones and Places from a file. Can also be used to update already existing places by name.

Query Params

accountId:
required
string
Id of the Account where the Zones and Places will be created.
upsert:
stringtrue
If true, existing Zone/Place data will be replaced if the Zone/Place name is an exact match. If false, new Zones/Places are always created.
format:
stringJSON
File format. Valid values: CSV, JSON

Body Params

file:
required
file
File with Zone and Place data.
[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]
{"_id":"58ef525c303ea40f00c2eeed","hidden":false,"isReference":true,"order":6,"user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655da","createdAt":"2017-04-13T10:26:36.844Z","excerpt":"Updates an already existing Zone.","slug":"moca-api-update-zone","type":"put","githubsync":"","next":{"pages":[],"description":""},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","title":"Update zone","updates":[],"version":"58e76f2a654e3839008655c8","__v":1,"body":"","sync_unique":"","api":{"auth":"required","examples":{"codes":[{"code":"{\n  \"name\": \"Office\",\n  \"description\": \"Innoquant HQ Office\",\n  \"floorNumber\": 3,\n  \"category\": \"Office\",\n  \"type\": \"BeaconGroup\",\n  \"provider\": \"MOCA\",\n  \"options\": {}\n}","language":"json"}]},"method":"put","params":[{"_id":"58ef4c3e2c4ffc390008ae7a","ref":"","in":"path","required":true,"desc":"Id of the Zone to be updated.","default":"","type":"string","name":"zoneId"},{"_id":"58ef4dd3f8c3b00f00011cc8","ref":"","in":"body","required":true,"desc":"Name of the Zone.","default":"","type":"string","name":"name"},{"_id":"58ef4dd3f8c3b00f00011cc7","ref":"","in":"body","required":false,"desc":"Zone description.","default":"","type":"string","name":"description"},{"_id":"58ef4dd3f8c3b00f00011cc6","ref":"","in":"body","required":false,"desc":"Number of the floor the Zone is located at.","default":"0","type":"int","name":"floorNumber"},{"_id":"58ef4dd3f8c3b00f00011cc5","ref":"","in":"body","required":false,"desc":"Zone category.","default":"","type":"string","name":"category"},{"_id":"58ef4dd3f8c3b00f00011cc4","ref":"","in":"body","required":false,"desc":"Zone type.","default":"BeaconGroup","type":"string","name":"type"},{"_id":"58ef4dd3f8c3b00f00011cc3","ref":"","in":"body","required":false,"desc":"Zone provider.","default":"MOCA","type":"string","name":"provider"}],"results":{"codes":[{"code":"{\n  \"createdAt\": 1491816253021,\n  \"updatedAt\": 1492010611380,\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"config\": {\n    \"name\": \"HQ Entrance\",\n    \"description\": \"Building entrance\",\n    \"floorNumber\": 0,\n    \"category\": \"Entrance\",\n    \"type\": \"BeaconGroup\",\n    \"provider\": \"MOCA\"\n  }\n}","language":"json","status":200,"name":""},{"status":400,"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"update.config.name\": \"cannot be null\"\n  }\n}","language":"json"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/zones/:zoneId"},"link_external":false,"link_url":"","childrenPages":[]}

putUpdate zone

Updates an already existing Zone.

Path Params

zoneId:
required
string
Id of the Zone to be updated.

Body Params

name:
required
string
Name of the Zone.
description:
string
Zone description.
floorNumber:
integer0
Number of the floor the Zone is located at.
category:
string
Zone category.
type:
stringBeaconGroup
Zone type.
provider:
stringMOCA
Zone provider.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef534d8646742f0099ff3b","order":7,"sync_unique":"","user":"55a54dde9c32760d00ca78a8","isReference":true,"slug":"moca-api-delete-zone","title":"Delete zone","__v":0,"api":{"url":"/zones/:zoneId","settings":"","results":{"codes":[{"language":"json","code":"","name":"","status":204},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"method":"delete","examples":{"codes":[]},"auth":"required","params":[{"in":"path","required":true,"desc":"Id of the Zone to be deleted.","default":"","type":"string","name":"zoneId","_id":"55ae0ec0f302af23000ac07f","ref":""}]},"body":"","createdAt":"2017-04-13T10:30:37.456Z","excerpt":"Deletes a Zone.","type":"delete","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655da","githubsync":"","hidden":false,"parentDoc":null,"updates":[],"link_external":false,"link_url":"","next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","childrenPages":[]}

deleteDelete zone

Deletes a Zone.

Path Params

zoneId:
required
string
Id of the Zone to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"58f5c765616bbb1b00d54a76","__v":0,"api":{"settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"auth":"required","params":[],"url":""},"category":"58e76f2a654e3839008655db","link_external":false,"order":0,"excerpt":"Represents a physical beacon device.","githubsync":"","next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","user":"55a54dde9c32760d00ca78a8","updates":[],"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Beacon object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"createdAt\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Mandatory?\",\n    \"h-3\": \"Description\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"3-0\": \"accountId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"Account id.\",\n    \"9-0\": \"config.uuid\",\n    \"9-1\": \"string\",\n    \"9-2\": \"Yes\",\n    \"9-3\": \"Universally Unique ID of the Beacon.\",\n    \"11-0\": \"config.minor\",\n    \"11-1\": \"integer\",\n    \"11-2\": \"Yes\",\n    \"11-3\": \"Minor number of the Beacon.\",\n    \"2-0\": \"beaconId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Beacon identifier.\",\n    \"10-0\": \"config.major\",\n    \"10-1\": \"integer\",\n    \"10-2\": \"Yes\",\n    \"10-3\": \"Major number of the Beacon.\",\n    \"4-0\": \"zoneId\",\n    \"4-1\": \"string\",\n    \"4-2\": \"No\",\n    \"4-3\": \"Id of the Zone this Beacon belongs to.\",\n    \"1-0\": \"updatedAt\",\n    \"1-3\": \"Last update time (timestamp UTC).\",\n    \"1-2\": \"Autogenerated\",\n    \"1-1\": \"long\",\n    \"5-0\": \"config.name\",\n    \"5-1\": \"string\",\n    \"5-2\": \"Yes\",\n    \"5-3\": \"Name of the Beacon.\",\n    \"6-0\": \"config.description\",\n    \"6-1\": \"string\",\n    \"6-2\": \"No\",\n    \"6-3\": \"Description of the Beacon.\",\n    \"7-0\": \"config.provider\",\n    \"7-1\": \"string\",\n    \"7-2\": \"No\",\n    \"7-3\": \"Provider of the Beacon.\",\n    \"8-0\": \"config.code\",\n    \"8-1\": \"string\",\n    \"8-2\": \"No\",\n    \"8-3\": \"4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor.\"\n  },\n  \"cols\": 4,\n  \"rows\": 12\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1492088716569,\\n  \\\"updatedAt\\\": 1492091163757,\\n  \\\"beaconId\\\": \\\"iqfruxiURO2HE4_OhxJ6kg\\\",\\n  \\\"accountId\\\": \\\"TAPFXFowToO4dFsktFzz9Q\\\",\\n  \\\"zoneId\\\": null,\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"HQ Gate\\\",\\n    \\\"description\\\": \\\"Beacon at HQ building gate\\\",\\n    \\\"provider\\\": \\\"MOCA\\\",\\n    \\\"code\\\": \\\"sHSK\\\",\\n    \\\"uuid\\\": \\\"f7826da6-4fa2-4e98-8024-bc5b71e0893e\\\",\\n    \\\"major\\\": 11236,\\n    \\\"minor\\\": 5795\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Beacon object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","createdAt":"2017-04-18T07:59:33.534Z","link_url":"","slug":"moca-api-beacons","sync_unique":"","title":"Overview","hidden":false,"isReference":true,"parentDoc":null,"type":"basic","version":"58e76f2a654e3839008655c8","childrenPages":[]}

Overview

Represents a physical beacon device.

[block:api-header] { "type": "basic", "title": "The Beacon object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "3-0": "accountId", "3-1": "string", "3-2": "Yes", "3-3": "Account id.", "9-0": "config.uuid", "9-1": "string", "9-2": "Yes", "9-3": "Universally Unique ID of the Beacon.", "11-0": "config.minor", "11-1": "integer", "11-2": "Yes", "11-3": "Minor number of the Beacon.", "2-0": "beaconId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Beacon identifier.", "10-0": "config.major", "10-1": "integer", "10-2": "Yes", "10-3": "Major number of the Beacon.", "4-0": "zoneId", "4-1": "string", "4-2": "No", "4-3": "Id of the Zone this Beacon belongs to.", "1-0": "updatedAt", "1-3": "Last update time (timestamp UTC).", "1-2": "Autogenerated", "1-1": "long", "5-0": "config.name", "5-1": "string", "5-2": "Yes", "5-3": "Name of the Beacon.", "6-0": "config.description", "6-1": "string", "6-2": "No", "6-3": "Description of the Beacon.", "7-0": "config.provider", "7-1": "string", "7-2": "No", "7-3": "Provider of the Beacon.", "8-0": "config.code", "8-1": "string", "8-2": "No", "8-3": "4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor." }, "cols": 4, "rows": 12 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1492088716569,\n \"updatedAt\": 1492091163757,\n \"beaconId\": \"iqfruxiURO2HE4_OhxJ6kg\",\n \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n \"zoneId\": null,\n \"config\": {\n \"name\": \"HQ Gate\",\n \"description\": \"Beacon at HQ building gate\",\n \"provider\": \"MOCA\",\n \"code\": \"sHSK\",\n \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n \"major\": 11236,\n \"minor\": 5795\n }\n}", "language": "json", "name": "Sample Beacon object" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "The Beacon object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "3-0": "accountId", "3-1": "string", "3-2": "Yes", "3-3": "Account id.", "9-0": "config.uuid", "9-1": "string", "9-2": "Yes", "9-3": "Universally Unique ID of the Beacon.", "11-0": "config.minor", "11-1": "integer", "11-2": "Yes", "11-3": "Minor number of the Beacon.", "2-0": "beaconId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Beacon identifier.", "10-0": "config.major", "10-1": "integer", "10-2": "Yes", "10-3": "Major number of the Beacon.", "4-0": "zoneId", "4-1": "string", "4-2": "No", "4-3": "Id of the Zone this Beacon belongs to.", "1-0": "updatedAt", "1-3": "Last update time (timestamp UTC).", "1-2": "Autogenerated", "1-1": "long", "5-0": "config.name", "5-1": "string", "5-2": "Yes", "5-3": "Name of the Beacon.", "6-0": "config.description", "6-1": "string", "6-2": "No", "6-3": "Description of the Beacon.", "7-0": "config.provider", "7-1": "string", "7-2": "No", "7-3": "Provider of the Beacon.", "8-0": "config.code", "8-1": "string", "8-2": "No", "8-3": "4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor." }, "cols": 4, "rows": 12 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1492088716569,\n \"updatedAt\": 1492091163757,\n \"beaconId\": \"iqfruxiURO2HE4_OhxJ6kg\",\n \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n \"zoneId\": null,\n \"config\": {\n \"name\": \"HQ Gate\",\n \"description\": \"Beacon at HQ building gate\",\n \"provider\": \"MOCA\",\n \"code\": \"sHSK\",\n \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n \"major\": 11236,\n \"minor\": 5795\n }\n}", "language": "json", "name": "Sample Beacon object" } ], "sidebar": true } [/block]
{"_id":"58f60b3935e05b2d00d654fc","__v":1,"api":{"params":[{"type":"int","name":"offset","_id":"55a8fbd327a17d21005251f5","ref":"","in":"query","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0"},{"name":"limit","ref":"","required":false,"type":"int","_id":"55a8fbd327a17d21005251f4","default":"1000","desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","in":"query"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1493031098073,\n    \"updatedAt\": 1493045790232,\n    \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n    \"config\": {\n      \"name\": \"HQ Gate\",\n      \"description\": \"Beacon at HQ building gate\",\n      \"provider\": \"Moca\",\n      \"code\": \"sHSK\",\n      \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n      \"major\": 11236,\n      \"minor\": 5795\n    },\n    \"geoCoordinate\": {\n      \"latitude\": 63.1835937,\n      \"longitude\": 20.0012363,\n      \"floor\": 2,\n      \"heightOverFloor\": 3.5\n    }\n  },\n  {\n    \"createdAt\": 1492519866039,\n    \"updatedAt\": 1492519866041,\n    \"beaconId\": \"ZLpqSrT4Tw658x0p6jYsAw\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"zoneId\": null,\n    \"config\": {\n      \"name\": \"HQ Office\",\n      \"description\": \"Beacon at Office\",\n      \"provider\": \"Moca\",\n      \"code\": \"yd8i\",\n      \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n      \"major\": 5133,\n      \"minor\": 6208\n    }\n  }\n]","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","name":""}]},"settings":"","url":"/beacons/?offset=:offset&limit=:limit","auth":"required","examples":{"codes":[]},"method":"get"},"githubsync":"","link_url":"","title":"Get all beacons","type":"get","body":"","createdAt":"2017-04-18T12:48:57.683Z","excerpt":"Returns a list of all Beacons across user's memberships, including Beacons both owned and from other accounts this user was invited to. The Beacons are returned in sorted order, with the most recent Beacon appearing last.\n\nSupports paging.","link_external":false,"parentDoc":null,"slug":"moca-api-get-beacons","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655db","hidden":false,"order":1,"project":"559a61d2dbcfd20d00710b39","sync_unique":"","updates":[],"user":"55a54dde9c32760d00ca78a8","isReference":true,"next":{"pages":[],"description":""},"childrenPages":[]}

getGet all beacons

Returns a list of all Beacons across user's memberships, including Beacons both owned and from other accounts this user was invited to. The Beacons are returned in sorted order, with the most recent Beacon appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58f60c2e017a6f2d0045c655","githubsync":"","order":2,"version":"58e76f2a654e3839008655c8","type":"get","updates":[],"hidden":false,"link_external":false,"title":"Get single beacon","excerpt":"Retrieves the details of an existing Beacon.","link_url":"","parentDoc":null,"project":"559a61d2dbcfd20d00710b39","__v":1,"body":"","category":"58e76f2a654e3839008655db","createdAt":"2017-04-18T12:53:02.961Z","user":"55a54dde9c32760d00ca78a8","sync_unique":"","api":{"examples":{"codes":[]},"method":"get","params":[{"desc":"Requested Beacon id.","default":"","type":"string","name":"beaconId","_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path","required":true}],"results":{"codes":[{"code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493045790232,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"Moca\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  },\n  \"geoCoordinate\": {\n    \"latitude\": 63.1835937,\n    \"longitude\": 20.0012363,\n    \"floor\": 2,\n    \"heightOverFloor\": 3.5\n  }\n}","language":"json","status":200,"name":""},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"},{"code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Beacon not found\"\n}","language":"json","status":404}]},"settings":"","url":"/beacons/:beaconId","auth":"required"},"isReference":true,"next":{"description":"","pages":[]},"slug":"moca-api-get-beacon","childrenPages":[]}

getGet single beacon

Retrieves the details of an existing Beacon.

Path Params

beaconId:
required
string
Requested Beacon id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58f60cff4c413f19007a2b2a","project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","body":"","link_external":false,"next":{"description":"","pages":[]},"order":3,"sync_unique":"","type":"post","updates":[],"api":{"settings":"","url":"/beacons/search","auth":"required","examples":{"codes":[{"name":"","language":"json","code":"{\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"name\": \"%Gate%\",\n  \"uuid\": \"f782%\",\n  \"major\": 11236,\n  \"minor\": 5795,\n  \"code\": \"sHSK\",\n  \"provider\": \"Moca\",\n  \"includeDeleted\": false,\n  \"offset\": 0,\n  \"limit\": 10\n}"}]},"method":"post","params":[{"required":false,"desc":"Account Id where Beacons will be searched.","default":"","type":"string","name":"accountId","_id":"58f6114f017a6f2d0045c6a6","ref":"","in":"body"},{"ref":"","in":"body","required":false,"desc":"Place Id where Beacons will be searched.","default":"","type":"string","name":"placeId","_id":"58f6114f017a6f2d0045c6a5"},{"default":"","type":"string","name":"zoneId","_id":"58f6114f017a6f2d0045c6a4","ref":"","in":"body","required":false,"desc":"Zone Id where Beacons will be searched."},{"default":"","type":"string","name":"name","_id":"58f6114f017a6f2d0045c6a3","ref":"","in":"body","required":false,"desc":"Beacon name to be searched, use % as wildcard."},{"in":"body","required":false,"desc":"Beacon provider to be searched, use % as wildcard.","default":"","type":"string","name":"provider","_id":"58f6119d009c281b00ab2e5f","ref":""},{"required":false,"desc":"Beacon Universally Unique ID to be searched, use % as wildcard.","default":"","type":"string","name":"uuid","_id":"58f6114f017a6f2d0045c6a2","ref":"","in":"body"},{"type":"int","name":"major","_id":"58f6114f017a6f2d0045c6a1","ref":"","in":"body","required":false,"desc":"Beacon major to be searched.","default":""},{"desc":"Beacon minor to be searched.","default":"","type":"int","name":"minor","_id":"58f6114f017a6f2d0045c6a0","ref":"","in":"body","required":false},{"name":"code","_id":"58f6114f017a6f2d0045c69f","ref":"","in":"body","required":false,"desc":"Beacon code to be searched.","default":"","type":"string"},{"ref":"","in":"body","required":false,"desc":"Include already deleted Beacons in the search.","default":"false","type":"boolean","name":"includeDeleted","_id":"58f6114f017a6f2d0045c69e"},{"in":"body","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset","_id":"58f611734c413f19007a2b56","ref":""},{"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","default":"1000","type":"int","name":"limit","_id":"58f611734c413f19007a2b55","ref":"","in":"body","required":false}],"results":{"codes":[{"name":"","code":"[\n  {\n    \"createdAt\": 1493031098073,\n    \"updatedAt\": 1493045790232,\n    \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n    \"config\": {\n      \"name\": \"HQ Gate\",\n      \"description\": \"Beacon at HQ building gate\",\n      \"provider\": \"Moca\",\n      \"code\": \"sHSK\",\n      \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n      \"major\": 11236,\n      \"minor\": 5795\n    },\n    \"geoCoordinate\": {\n      \"latitude\": 63.1835937,\n      \"longitude\": 20.0012363,\n      \"floor\": 2,\n      \"heightOverFloor\": 3.5\n    }\n  }\n]","language":"json","status":200},{"status":400,"name":"","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}","language":"json"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]}},"excerpt":"Returns a list of Beacons that matched the requested criteria across user's memberships, including Beacons both owned and from other accounts this user was invited to. The Beacons are returned in sorted order, with the most recent Beacon appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","githubsync":"","link_url":"","hidden":false,"isReference":true,"title":"Search beacons","slug":"moca-api-search-beacons","user":"55a54dde9c32760d00ca78a8","__v":4,"category":"58e76f2a654e3839008655db","createdAt":"2017-04-18T12:56:31.413Z","parentDoc":null,"childrenPages":[]}

postSearch beacons

Returns a list of Beacons that matched the requested criteria across user's memberships, including Beacons both owned and from other accounts this user was invited to. The Beacons are returned in sorted order, with the most recent Beacon appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Beacons will be searched.
placeId:
string
Place Id where Beacons will be searched.
zoneId:
string
Zone Id where Beacons will be searched.
name:
string
Beacon name to be searched, use % as wildcard.
provider:
string
Beacon provider to be searched, use % as wildcard.
uuid:
string
Beacon Universally Unique ID to be searched, use % as wildcard.
major:
integer
Beacon major to be searched.
minor:
integer
Beacon minor to be searched.
code:
string
Beacon code to be searched.
includeDeleted:
booleanfalse
Include already deleted Beacons in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58fe08757b09013700aa74e3","title":"Create new beacon","body":"","createdAt":"2017-04-24T14:15:17.590Z","link_external":false,"link_url":"","next":{"pages":[],"description":""},"order":4,"sync_unique":"","type":"post","__v":1,"api":{"auth":"required","examples":{"codes":[{"name":"","code":"{\n  \"name\": \"HQ Gate\",\n  \"description\": \"Beacon at HQ building gate\",\n  \"provider\": \"Moca\",\n  \"code\": \"sHSK\"\n}","language":"json"},{"code":"{\n  \"name\": \"HQ Gate\",\n  \"description\": \"Beacon at HQ building gate\",\n  \"provider\": \"Other\",\n  \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n  \"major\": 11236,\n  \"minor\": 5795\n}","language":"json"}]},"method":"post","params":[{"ref":"","in":"query","required":true,"desc":"Id of the Account where the Beacon will be created.","default":"","type":"string","name":"accountId","_id":"58f615dddf3d1137004d6220"},{"default":"","type":"string","name":"name","_id":"58fe0a62c1e51e1900412c83","ref":"","in":"body","required":true,"desc":"Name of the Beacon."},{"in":"body","required":false,"desc":"Description of the Beacon.","default":"","type":"string","name":"description","_id":"58fe0a62c1e51e1900412c82","ref":""},{"desc":"Beacon provider.","default":"","type":"string","name":"provider","_id":"58fe0a62c1e51e1900412c81","ref":"","in":"body","required":false},{"name":"code","_id":"58fe0a62c1e51e1900412c80","ref":"","in":"body","required":false,"desc":"4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor.","default":"","type":"string"},{"type":"string","name":"uuid","_id":"58fe0a62c1e51e1900412c7f","ref":"","in":"body","required":false,"desc":"Universally Unique ID of the Beacon.","default":""},{"in":"body","name":"major","ref":"","required":false,"type":"int","_id":"58fe0a62c1e51e1900412c7e","default":"","desc":"Major number of the Beacon."},{"required":false,"type":"int","_id":"58fe0a62c1e51e1900412c7d","default":"","desc":"Minor number of the Beacon.","in":"body","name":"minor","ref":""}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493032434406,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"Moca\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  }\n}","language":"json","status":201},{"status":400,"name":"","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'accountId' is not present\"\n}","language":"json"},{"language":"json","status":400,"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}"},{"status":400,"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Unknown MOCA beacon\"\n}","language":"json"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/beacons/?accountId:=accountId"},"excerpt":"Creates a new beacon.","githubsync":"","parentDoc":null,"slug":"moca-api-create-beacon","version":"58e76f2a654e3839008655c8","hidden":false,"updates":[],"user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655db","isReference":true,"project":"559a61d2dbcfd20d00710b39","childrenPages":[]}

postCreate new beacon

Creates a new beacon.

Query Params

accountId:
required
string
Id of the Account where the Beacon will be created.

Body Params

name:
required
string
Name of the Beacon.
description:
string
Description of the Beacon.
provider:
string
Beacon provider.
code:
string
4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor.
uuid:
string
Universally Unique ID of the Beacon.
major:
integer
Major number of the Beacon.
minor:
integer
Minor number of the Beacon.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58fe15e0f8fe310f00e85a39","createdAt":"2017-04-24T15:12:32.484Z","link_url":"","sync_unique":"","type":"post","updates":[],"excerpt":"Creates multiple Beacons, Zones and Places from a file. \n\nCan also be used to update already existing beacons by name.","hidden":false,"order":5,"parentDoc":null,"title":"Batch beacon upload","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","link_external":false,"next":{"pages":[],"description":""},"slug":"moca-api-batch-beacon","githubsync":"","isReference":true,"project":"559a61d2dbcfd20d00710b39","__v":1,"api":{"settings":"","url":"/beacons/batch?accountId=:accountId&upsert=:upsert&format=:format","auth":"required","examples":{"codes":[{"language":"json","code":"[\n  {\n    \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n    \"config\": {\n      \"name\": \"HQ Gate\",\n      \"description\": \"Beacon at HQ building gate\",\n      \"provider\": \"Moca\",\n      \"code\": \"sHSK\"\n    }\n  },\n  {\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"zone\": {\n      \"name\": \"New zone 1\",\n      \"description\": \"This is a new Zone created in an already existing Place!\",\n      \"floorNumber\": 1,\n      \"category\": \"New\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    },\n    \"config\": {\n      \"name\": \"New beacon 1\",\n      \"description\": \"This is a new Beacon created in a new Zone!\",\n      \"provider\": \"Other\",\n      \"uuid\": \"fedcba98-fedc-ba98-fedcba987654\",\n      \"major\": 12345,\n      \"minor\": 4321\n    }\n  },\n  {\n    \"place\": {\n      \"name\": \"Innoquant HQ\"\n    },\n    \"zone\": {\n      \"name\": \"HQ Entrance\"\n    },\n    \"config\": {\n      \"name\": \"New beacon 2\",\n      \"description\": \"This is a new Beacon reusing both existing Place and Zone!\",\n      \"provider\": \"Other\",\n      \"uuid\": \"1235678-1234-5678-9abc-123456789abc\",\n      \"major\": 54321,\n      \"minor\": 4321\n    }\n  },\n  {\n    \"place\": {\n      \"name\": \"New place\",\n      \"description\": \"This is a new Place!\",\n      \"geoFence\": {\n        \"latitude\": 1.2345678901234567,\n        \"longitude\": 7.6543210987654321,\n        \"radius\": 100,\n        \"geoTag\": null\n      }\n    },\n    \"zone\": {\n      \"name\": \"New zone 2\",\n      \"description\": \"This is a new Zone created in a new Place!\",\n      \"floorNumber\": 2,\n      \"category\": \"New\",\n      \"type\": \"BeaconGroup\",\n      \"provider\": \"MOCA\"\n    },\n    \"config\": {\n      \"name\": \"New beacon 3\",\n      \"description\": \"This is a new Beacon created in a new Zone and a new Place!\",\n      \"provider\": \"Other\",\n      \"uuid\": \"18317f18-db71-9471-1bde-7be1913b10db\",\n      \"major\": 26557,\n      \"minor\": 8242\n    }\n  },\n  {\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n    \"zone\": {\n      \"name\": \"HQ Entrance\"\n    },\n    \"config\": {\n      \"name\": \"Invalid Beacon\",\n      \"description\": \"This is an invalid Beacon!\",\n      \"provider\": \"Moca\",\n      \"code\": null\n    }\n  }\n]","name":"File: JSON"},{"language":"text","name":"File: CSV","code":"placeId,place.name,place.description,place.geoFence.latitude,place.geoFence.longitude,place.geoFence.radius,zoneId,zone.name,zone.description,zone.floorNumber,zone.category,zone.type,zone.provider,config.name,config.description,config.provider,config.code,config.uuid,config.major,config.minor\n,,,,,,1udDPRkMQrKivHgU8vIyUg,,,,,,,HQ Gate,Beacon at HQ building gate,Moca,sHSK,,,\nrzwbxsgXSRSxqdjSe7xZTQ,,,,,,New zone 1,This is a new Zone created in an already existing Place!,1,New,BeaconGroup,MOCA,New beacon 1,This is a new Beacon created in a new Zone!,Other,,fedcba98-fedc-ba98-fedcba987654,12345,4321\n,Innoquant HQ,,,,,,HQ Entrance,,,,,,New beacon 2,This is a new Beacon reusing both existing Place and Zone!,Other,,1235678-1234-5678-9abc-123456789abc,54321,4321\n,New place,This is a new Place!,1.2345678901234567,7.6543210987654321,100,,New zone 2,This is a new Zone created in a new Place!,2,New,BeaconGroup,MOCA,New beacon 3,This is a new Beacon created in a new Zone and a new Place!,Other,18317f18-db71-9471-1bde-7be1913b10db,26557,8242\nrzwbxsgXSRSxqdjSe7xZTQ,,,,,,,HQ Entrance,,,,,,Invalid Beacon,This is an invalid Beacon!,Moca,,,,"}]},"method":"post","params":[{"_id":"58ee4b75e90d881b0052c7b5","ref":"","in":"query","required":true,"desc":"Id of the Account where the Beacons, Zones and Places will be created.","default":"","type":"string","name":"accountId"},{"_id":"58ee4b75e90d881b0052c7b4","ref":"","in":"body","required":true,"desc":"File with Beacon, Zone and Place data.","default":"","type":"file","name":"file"},{"_id":"58ee51f204a99a3700eafd2c","ref":"","in":"query","required":false,"desc":"If true, existing Beacon/Zone/Place data will be replaced if the Beacon/Zone/Place name is an exact match. If false, new Beacons/Zones/Places are always created.","default":"true","type":"string","name":"upsert"},{"_id":"58ee54d5edb2282f00937903","ref":"","in":"query","required":false,"desc":"File format. Valid values: CSV, JSON","default":"JSON","type":"string","name":"format"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"resources\": {\n    \"places\": [{\n      \"createdAt\": 1491816253022,\n      \"updatedAt\": 1491816253022,\n      \"placeId\": \"edIuSRWyWz4Ut5WakhQDBg\",\n      \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n      \"config\": {\n        \"name\": \"New place\",\n        \"description\": \"This is a new Place!\",\n        \"geoFence\": {\n          \"latitude\": 1.2345678901234567,\n          \"longitude\": 7.6543210987654321,\n          \"radius\": 100,\n          \"geoTag\": null\n        }\n      }\n    }],\n    \"zones\": [{\n      \"createdAt\": 1491816253020,\n      \"updatedAt\": 1491816253020,\n      \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n      \"config\": {\n        \"name\": \"New zone 1\",\n        \"description\": \"This is a new Zone created in an already existing Place!\",\n        \"floorNumber\": 1,\n        \"category\": \"New\",\n        \"type\": \"BeaconGroup\",\n        \"provider\": \"MOCA\"\n      }\n    },\n    {\n      \"createdAt\": 1491816253021,\n      \"updatedAt\": 1491816253021,\n      \"zoneId\": \"9VmSl2xFwVxNuB3ct9fqJQ\",\n      \"placeId\": \"edIuSRWyWz4Ut5WakhQDBg\",\n      \"config\": {\n        \"name\": \"New zone 2\",\n        \"description\": \"This is a new Zone created in a new Place!\",\n        \"floorNumber\": 2,\n        \"category\": \"New\",\n        \"type\": \"BeaconGroup\",\n        \"provider\": \"MOCA\"\n      }\n    }],\n    \"beacons\": [{\n      \"createdAt\": 1493031098073,\n      \"updatedAt\": 1493045790232,\n      \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n      \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n      \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n      \"config\": {\n        \"name\": \"New beacon 1\",\n        \"description\": \"This is a new Beacon created in a new Zone!\",\n        \"provider\": \"Other\",\n        \"uuid\": \"fedcba98-fedc-ba98-fedcba987654\",\n        \"major\": 12345,\n        \"minor\": 4321\n      }\n    },\n    {\n      \"createdAt\": 1493031098073,\n      \"updatedAt\": 1493045790232,\n      \"beaconId\": \"exfiRpIoonqG9c6R6OCeUg\",\n      \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n      \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n      \"config\": {\n        \"name\": \"New beacon 2\",\n        \"description\": \"This is a new Beacon reusing both existing Place and Zone!\",\n        \"provider\": \"Other\",\n        \"uuid\": \"1235678-1234-5678-9abc-123456789abc\",\n        \"major\": 54321,\n        \"minor\": 4321\n      }\n    },\n    {\n      \"createdAt\": 1493031098073,\n      \"updatedAt\": 1493045790232,\n      \"beaconId\": \"cexf6Rg6iRpIooqG9nOCeU\",\n      \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n      \"zoneId\": \"9VmSl2xFwVxNuB3ct9fqJQ\",\n      \"config\": {\n        \"name\": \"New beacon 3\",\n        \"description\": \"This is a new Beacon created in a new Zone and a new Place!\",\n        \"provider\": \"Other\",\n        \"uuid\": \"18317f18-db71-9471-1bde-7be1913b10db\",\n        \"major\": 26557,\n        \"minor\": 8242\n      }\n    }]\n  },\n  \"errors\": [{\n    \"source\": {\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n      \"zone\": {\n        \"name\": \"HQ Entrance\"\n      },\n      \"config\": {\n        \"name\": \"Invalid Beacon\",\n        \"description\": \"This is an invalid Beacon!\",\n        \"provider\": \"Moca\",\n        \"code\": null\n      }\n    },\n    \"error\": \"Bad Request\",\n    \"error_description\": \"Unknown MOCA beacon\"\n  }]\n}","name":""},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'accountId' is not present\"\n}","name":"","status":400,"language":"json"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]}},"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"BETA Feature\",\n  \"body\": \"This feature is in Beta. If you have any issues, please contact us!\"\n}\n[/block]","category":"58e76f2a654e3839008655db","childrenPages":[]}

postBatch beacon upload

Creates multiple Beacons, Zones and Places from a file. Can also be used to update already existing beacons by name.

Query Params

accountId:
required
string
Id of the Account where the Beacons, Zones and Places will be created.
upsert:
stringtrue
If true, existing Beacon/Zone/Place data will be replaced if the Beacon/Zone/Place name is an exact match. If false, new Beacons/Zones/Places are always created.
format:
stringJSON
File format. Valid values: CSV, JSON

Body Params

file:
required
file
File with Beacon, Zone and Place data.
[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]
{"_id":"58fe0d6460fd71190052dec8","githubsync":"","order":6,"parentDoc":null,"slug":"moca-api-update-beacon","user":"55a54dde9c32760d00ca78a8","body":"","project":"559a61d2dbcfd20d00710b39","type":"put","category":"58e76f2a654e3839008655db","createdAt":"2017-04-24T14:36:20.139Z","link_external":false,"title":"Update beacon","updates":[],"__v":1,"api":{"examples":{"codes":[{"language":"json","code":"{\n  \"name\": \"HQ Gate\",\n  \"description\": \"Beacon at HQ building gate\",\n  \"provider\": \"Moca\",\n  \"code\": \"sHSK\"\n}","name":"JSON - Code"},{"name":"JSON - UUID","language":"json","code":"{\n  \"name\": \"HQ Gate\",\n  \"description\": \"Beacon at HQ building gate\",\n  \"provider\": \"Other\",\n  \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n  \"major\": 11236,\n  \"minor\": 5795\n}"}]},"method":"put","params":[{"name":"name","_id":"55accca96b4ff90d00784b6a","ref":"","in":"body","required":true,"desc":"Name of the Beacon.","default":"","type":"string"},{"ref":"","in":"path","required":true,"desc":"Id of the Beacon to be updated.","default":"","type":"string","name":"beaconId","_id":"55aca9796b4ff90d00784a8e"},{"in":"body","required":false,"desc":"Description of the Beacon.","default":"","type":"string","name":"description","_id":"58fe0ec679c6e825005ed96b","ref":""},{"desc":"Beacon provider.","default":"","type":"string","name":"provider","_id":"58fe0ec679c6e825005ed96a","ref":"","in":"body","required":false},{"name":"code","_id":"58fe0ec679c6e825005ed969","ref":"","in":"body","required":false,"desc":"4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor.","default":"","type":"string"},{"ref":"","in":"body","required":false,"desc":"Universally Unique ID of the Beacon.","default":"","type":"string","name":"uuid","_id":"58fe0ec679c6e825005ed968"},{"in":"body","required":false,"desc":"Major number of the Beacon.","default":"","type":"int","name":"major","_id":"58fe0ec679c6e825005ed967","ref":""},{"desc":"Minor number of the Beacon.","default":"","type":"int","name":"minor","_id":"58fe0ec679c6e825005ed966","ref":"","in":"body","required":false}],"results":{"codes":[{"code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493045790232,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"Moca\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  },\n  \"geoCoordinate\": {\n    \"latitude\": 63.1835937,\n    \"longitude\": 20.0012363,\n    \"floor\": 2,\n    \"heightOverFloor\": 3.5\n  },\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"zoneName\": \"HQ Entrance\",\n  \"placeName\": \"Innoquant HQ\"\n}","language":"json","status":200,"name":""},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"update.config.name\": \"cannot be null\"\n  }\n}","language":"json","status":400},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]},"settings":"","url":"/beacons/:beaconId","auth":"required"},"excerpt":"Updates an existing beacon.","hidden":false,"isReference":true,"link_url":"","next":{"pages":[],"description":""},"sync_unique":"","version":"58e76f2a654e3839008655c8","childrenPages":[]}

putUpdate beacon

Updates an existing beacon.

Path Params

beaconId:
required
string
Id of the Beacon to be updated.

Body Params

name:
required
string
Name of the Beacon.
description:
string
Description of the Beacon.
provider:
string
Beacon provider.
code:
string
4-digit code used in MOCA/Kontakt.io beacons. Replaces UUID, major and minor.
uuid:
string
Universally Unique ID of the Beacon.
major:
integer
Major number of the Beacon.
minor:
integer
Minor number of the Beacon.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58fe1093180afa25006c78d0","api":{"auth":"required","examples":{"codes":[{"language":"json","code":"{\n  \"latitude\": 63.1835937,\n  \"longitude\": 20.0012363,\n  \"floor\": 2,\n  \"heightOverFloor\": 3.5\n}","name":""}]},"method":"put","params":[{"name":"beaconId","_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path","required":true,"desc":"Id of the Beacon to be updated.","default":"","type":"string"},{"ref":"","in":"body","required":false,"desc":"Latitude in degrees of the Beacon. Valid range: [-90, 90]","default":"","type":"double","name":"latitude","_id":"58fe1234eed0651b00f831b6"},{"in":"body","required":false,"desc":"Longitude in degrees of the Beacon. Valid range: [-180, 180]","default":"","type":"double","name":"longitude","_id":"58fe1234eed0651b00f831b5","ref":""},{"desc":"Number of the floor where the Beacon is.","default":"","type":"int","name":"floor","_id":"58fe1234eed0651b00f831b4","ref":"","in":"body","required":false},{"_id":"58fe1234eed0651b00f831b3","ref":"","in":"body","required":false,"desc":"Distance in meters of the position of the Beacon above the floor ground.","default":"","type":"double","name":"heightOverFloor"}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493045790232,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"MOCA\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  },\n  \"geoCoordinate\": {\n    \"latitude\": 63.1835937,\n    \"longitude\": 20.0012363,\n    \"floor\": 2,\n    \"heightOverFloor\": 3.5\n  }\n}","language":"json","status":200},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field latitude: Can not deserialize value of type double from String \\\"not a number\\\": not a valid Double value\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/beacons/:beaconId/coordinates"},"category":"58e76f2a654e3839008655db","excerpt":"Updates the geo-coordinates of the specified Beacon.","user":"55a54dde9c32760d00ca78a8","body":"","title":"Update beacon coordinates","type":"put","updates":[],"link_url":"","version":"58e76f2a654e3839008655c8","__v":1,"githubsync":"","hidden":false,"link_external":false,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-update-beacon-coordinates","sync_unique":"","createdAt":"2017-04-24T14:49:55.662Z","isReference":true,"next":{"pages":[],"description":""},"order":7,"parentDoc":null,"childrenPages":[]}

putUpdate beacon coordinates

Updates the geo-coordinates of the specified Beacon.

Path Params

beaconId:
required
string
Id of the Beacon to be updated.

Body Params

latitude:
double
Latitude in degrees of the Beacon. Valid range: [-90, 90]
longitude:
double
Longitude in degrees of the Beacon. Valid range: [-180, 180]
floor:
integer
Number of the floor where the Beacon is.
heightOverFloor:
double
Distance in meters of the position of the Beacon above the floor ground.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"591569d627c5b92d000500b9","order":8,"title":"Delete beacon coordinates","user":"55a54dde9c32760d00ca78a8","__v":2,"isReference":true,"link_external":false,"next":{"pages":[],"description":""},"createdAt":"2017-05-12T07:52:54.760Z","slug":"moca-api-delete-beacon-coordinates","version":"58e76f2a654e3839008655c8","excerpt":"Updates the geo-coordinates of the specified Beacon.","link_url":"","parentDoc":null,"type":"delete","updates":[],"project":"559a61d2dbcfd20d00710b39","sync_unique":"","api":{"url":"/beacons/:beaconId/coordinates","auth":"required","examples":{"codes":[]},"method":"delete","params":[{"_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path","required":true,"desc":"Id of the Beacon to be updated.","default":"","type":"string","name":"beaconId"}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493045790232,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"MOCA\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  }\n}","language":"json","status":200},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field latitude: Can not deserialize value of type double from String \\\"not a number\\\": not a valid Double value\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":""},"body":"","category":"58e76f2a654e3839008655db","githubsync":"","hidden":false,"childrenPages":[]}

deleteDelete beacon coordinates

Updates the geo-coordinates of the specified Beacon.

Path Params

beaconId:
required
string
Id of the Beacon to be updated.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58fe143c8fbd2819000dbdbc","createdAt":"2017-04-24T15:05:32.072Z","excerpt":"Assigns a Beacon to the specified Zone.","githubsync":"","project":"559a61d2dbcfd20d00710b39","sync_unique":"","title":"Update beacon zone","__v":2,"link_external":false,"next":{"pages":[],"description":""},"updates":[],"user":"55a54dde9c32760d00ca78a8","body":"","hidden":false,"order":9,"type":"put","category":"58e76f2a654e3839008655db","isReference":true,"link_url":"","parentDoc":null,"slug":"moca-api-update-beacon-zone","version":"58e76f2a654e3839008655c8","api":{"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493045790232,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"MOCA\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  },\n  \"geoCoordinate\": {\n    \"latitude\": 63.1835937,\n    \"longitude\": 20.0012363,\n    \"floor\": 2,\n    \"heightOverFloor\": 3.5\n  }\n}","language":"json","status":200},{"language":"json","status":400,"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'zoneId' is not present\"\n}"},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]},"settings":"","url":"/beacons/:beaconId/zone?zoneId=:zoneId","auth":"required","examples":{"codes":[]},"method":"put","params":[{"_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path","required":true,"desc":"Id of the Beacon to be updated.","default":"","type":"string","name":"beaconId"},{"_id":"55acd03c6b4ff90d00784b73","ref":"","in":"query","required":true,"desc":"Id of the Zone where the Beacon will be assigned.","default":"","type":"string","name":"zoneId"}]},"childrenPages":[]}

putUpdate beacon zone

Assigns a Beacon to the specified Zone.

Path Params

beaconId:
required
string
Id of the Beacon to be updated.

Query Params

zoneId:
required
string
Id of the Zone where the Beacon will be assigned.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58fe153a79c6e825005ed9f5","api":{"auth":"required","examples":{"codes":[]},"method":"delete","params":[{"desc":"Id of the Beacon to be unassigned.","default":"","type":"string","name":"beaconId","_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path","required":true}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1493031098073,\n  \"updatedAt\": 1493045790232,\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"zoneId\": null,\n  \"config\": {\n    \"name\": \"HQ Gate\",\n    \"description\": \"Beacon at HQ building gate\",\n    \"provider\": \"MOCA\",\n    \"code\": \"sHSK\",\n    \"uuid\": \"f7826da6-4fa2-4e98-8024-bc5b71e0893e\",\n    \"major\": 11236,\n    \"minor\": 5795\n  },\n  \"geoCoordinate\": {\n    \"latitude\": 63.1835937,\n    \"longitude\": 20.0012363,\n    \"floor\": 2,\n    \"heightOverFloor\": 3.5\n  }\n}","name":""},{"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401}]},"settings":"","url":"/beacons/:beaconId/zone"},"body":"","createdAt":"2017-04-24T15:09:46.674Z","order":10,"parentDoc":null,"slug":"moca-api-delete-beacon-zone","type":"delete","__v":1,"user":"55a54dde9c32760d00ca78a8","updates":[],"excerpt":"Unassign a Beacon from its assigned Zone.","githubsync":"","hidden":false,"isReference":true,"project":"559a61d2dbcfd20d00710b39","title":"Delete beacon zone","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655db","link_external":false,"link_url":"","next":{"pages":[],"description":""},"sync_unique":"","childrenPages":[]}

deleteDelete beacon zone

Unassign a Beacon from its assigned Zone.

Path Params

beaconId:
required
string
Id of the Beacon to be unassigned.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58fe0f20ad9e5d2f00fb80e7","link_external":false,"next":{"description":"","pages":[]},"type":"delete","version":"58e76f2a654e3839008655c8","__v":1,"api":{"settings":"","url":"/beacons/:beaconId","auth":"required","examples":{"codes":[]},"method":"delete","params":[{"required":true,"desc":"Id of the Beacon to be deleted.","default":"","type":"string","name":"beaconId","_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path"}],"results":{"codes":[{"name":"","code":"","language":"json","status":204},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]}},"createdAt":"2017-04-24T14:43:44.881Z","isReference":true,"order":11,"parentDoc":null,"excerpt":"Deletes a Beacon.","hidden":false,"link_url":"","slug":"moca-api-delete-beacon","sync_unique":"","user":"55a54dde9c32760d00ca78a8","title":"Delete beacon","updates":[],"body":"","category":"58e76f2a654e3839008655db","githubsync":"","project":"559a61d2dbcfd20d00710b39","childrenPages":[]}

deleteDelete beacon

Deletes a Beacon.

Path Params

beaconId:
required
string
Id of the Beacon to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"58ef32068c752e2500b96c99","parentDoc":null,"type":"basic","updates":[],"user":"55a54dde9c32760d00ca78a8","__v":0,"hidden":false,"link_url":"","next":{"description":"","pages":[]},"version":"58e76f2a654e3839008655c8","slug":"moca-api-apps","sync_unique":"","title":"Overview","category":"58e76f2a654e3839008655d0","excerpt":"App objects represent mobile apps in MOCA platform.","githubsync":"","api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]}},"createdAt":"2017-04-13T08:08:38.073Z","link_external":false,"project":"559a61d2dbcfd20d00710b39","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The App object\"\n}\n[/block]\nAttributes:\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Obligatory?\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"createdAt\",\n    \"0-3\": \"Creation date (timestamp UTC)\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"4-0\": \"accountId\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Account ID this app belongs to.\",\n    \"7-0\": \"config.appUrl\",\n    \"7-1\": \"string\",\n    \"7-2\": \"No\",\n    \"7-3\": \"App website URL\",\n    \"9-0\": \"config.category\",\n    \"9-1\": \"string\",\n    \"9-2\": \"No\",\n    \"9-3\": \"App category name\",\n    \"10-0\": \"config.iconUrl\",\n    \"10-1\": \"string\",\n    \"10-2\": \"No\",\n    \"10-3\": \"App icon URL\",\n    \"11-0\": \"config.approxAppSize\",\n    \"11-1\": \"string\",\n    \"11-2\": \"No\",\n    \"11-3\": \"Estimated volume of users of this app\",\n    \"13-0\": \"targets\",\n    \"13-1\": \"array of objects\",\n    \"13-2\": \"No\",\n    \"13-3\": \"The list of Push certificates of this App.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last modified date (timestamp UTC)\",\n    \"2-0\": \"appId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"App ID\",\n    \"3-0\": \"appSecret\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Autogenerated\",\n    \"3-3\": \"Used to connect MOCA SDK to all services\",\n    \"5-0\": \"config.name\",\n    \"5-1\": \"string\",\n    \"5-2\": \"Yes\",\n    \"5-3\": \"App short name\",\n    \"6-0\": \"config.description\",\n    \"6-1\": \"string\",\n    \"6-2\": \"No\",\n    \"6-3\": \"App description\",\n    \"8-0\": \"config.version\",\n    \"8-1\": \"string\",\n    \"8-2\": \"No\",\n    \"8-3\": \"App version string\",\n    \"12-0\": \"config.production\",\n    \"12-1\": \"boolean\",\n    \"12-2\": \"Yes (default false)\",\n    \"12-3\": \"Whether the App is connected to a Test or Production environment\"\n  },\n  \"cols\": 4,\n  \"rows\": 14\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1491817192134,\\n  \\\"updatedAt\\\": 1491830647928,\\n  \\\"appId\\\": \\\"IXa7Bl9oRo6c7zQ5aQIzlg\\\",\\n  \\\"appSecret\\\": \\\"lJiLBbqHcVc3gyPoZujm6wqouGs=\\\",\\n  \\\"accountId\\\": \\\"TAPFXFowToO4dFsktFzz9Q\\\",\\n  \\\"config\\\": {\\n    \\\"appUrl\\\": \\\"https://mocaplatform.com\\\",\\n    \\\"category\\\": \\\"Utilities\\\",\\n    \\\"version\\\": \\\"1.0\\\",\\n    \\\"description\\\": \\\"This is a sample app\\\",\\n    \\\"iconUrl\\\": \\\"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\\\",\\n    \\\"name\\\": \\\"TestApp\\\",\\n    \\\"approxAppSize\\\": \\\"<2500\\\",\\n    \\\"production\\\": false\\n  },\\n  \\\"targets\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample App object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","isReference":true,"order":0,"childrenPages":[]}

Overview

App objects represent mobile apps in MOCA platform.

[block:api-header] { "type": "basic", "title": "The App object" } [/block] Attributes: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-3": "Creation date (timestamp UTC)", "0-1": "long", "0-2": "Autogenerated", "4-0": "accountId", "4-1": "string", "4-2": "Yes", "4-3": "Account ID this app belongs to.", "7-0": "config.appUrl", "7-1": "string", "7-2": "No", "7-3": "App website URL", "9-0": "config.category", "9-1": "string", "9-2": "No", "9-3": "App category name", "10-0": "config.iconUrl", "10-1": "string", "10-2": "No", "10-3": "App icon URL", "11-0": "config.approxAppSize", "11-1": "string", "11-2": "No", "11-3": "Estimated volume of users of this app", "13-0": "targets", "13-1": "array of objects", "13-2": "No", "13-3": "The list of Push certificates of this App.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last modified date (timestamp UTC)", "2-0": "appId", "2-1": "string", "2-2": "Autogenerated", "2-3": "App ID", "3-0": "appSecret", "3-1": "string", "3-2": "Autogenerated", "3-3": "Used to connect MOCA SDK to all services", "5-0": "config.name", "5-1": "string", "5-2": "Yes", "5-3": "App short name", "6-0": "config.description", "6-1": "string", "6-2": "No", "6-3": "App description", "8-0": "config.version", "8-1": "string", "8-2": "No", "8-3": "App version string", "12-0": "config.production", "12-1": "boolean", "12-2": "Yes (default false)", "12-3": "Whether the App is connected to a Test or Production environment" }, "cols": 4, "rows": 14 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1491817192134,\n \"updatedAt\": 1491830647928,\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n \"config\": {\n \"appUrl\": \"https://mocaplatform.com\",\n \"category\": \"Utilities\",\n \"version\": \"1.0\",\n \"description\": \"This is a sample app\",\n \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n \"name\": \"TestApp\",\n \"approxAppSize\": \"<2500\",\n \"production\": false\n },\n \"targets\": []\n}", "language": "json", "name": "Sample App object" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "The App object" } [/block] Attributes: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-3": "Creation date (timestamp UTC)", "0-1": "long", "0-2": "Autogenerated", "4-0": "accountId", "4-1": "string", "4-2": "Yes", "4-3": "Account ID this app belongs to.", "7-0": "config.appUrl", "7-1": "string", "7-2": "No", "7-3": "App website URL", "9-0": "config.category", "9-1": "string", "9-2": "No", "9-3": "App category name", "10-0": "config.iconUrl", "10-1": "string", "10-2": "No", "10-3": "App icon URL", "11-0": "config.approxAppSize", "11-1": "string", "11-2": "No", "11-3": "Estimated volume of users of this app", "13-0": "targets", "13-1": "array of objects", "13-2": "No", "13-3": "The list of Push certificates of this App.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last modified date (timestamp UTC)", "2-0": "appId", "2-1": "string", "2-2": "Autogenerated", "2-3": "App ID", "3-0": "appSecret", "3-1": "string", "3-2": "Autogenerated", "3-3": "Used to connect MOCA SDK to all services", "5-0": "config.name", "5-1": "string", "5-2": "Yes", "5-3": "App short name", "6-0": "config.description", "6-1": "string", "6-2": "No", "6-3": "App description", "8-0": "config.version", "8-1": "string", "8-2": "No", "8-3": "App version string", "12-0": "config.production", "12-1": "boolean", "12-2": "Yes (default false)", "12-3": "Whether the App is connected to a Test or Production environment" }, "cols": 4, "rows": 14 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1491817192134,\n \"updatedAt\": 1491830647928,\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n \"config\": {\n \"appUrl\": \"https://mocaplatform.com\",\n \"category\": \"Utilities\",\n \"version\": \"1.0\",\n \"description\": \"This is a sample app\",\n \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n \"name\": \"TestApp\",\n \"approxAppSize\": \"<2500\",\n \"production\": false\n },\n \"targets\": []\n}", "language": "json", "name": "Sample App object" } ], "sidebar": true } [/block]
{"_id":"58ef30cd8c752e2500b96c78","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d0","excerpt":"Returns a list of all Apps across user's memberships, including Apps both owned and from other accounts this user was invited to. The Apps are returned in sorted order, with the most recent App appearing last.\n\nSupports paging.","hidden":false,"isReference":true,"order":1,"type":"get","createdAt":"2017-04-13T08:03:25.403Z","link_external":false,"next":{"pages":[],"description":""},"__v":0,"githubsync":"","link_url":"","project":"559a61d2dbcfd20d00710b39","sync_unique":"","updates":[],"user":"55a54dde9c32760d00ca78a8","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"in":"query","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned","default":"0","type":"int","name":"offset","_id":"58eb92062dd737230023dd4c","ref":""},{"required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved","default":"1000","type":"int","name":"limit","_id":"58eb92062dd737230023dd4b","ref":"","in":"query"}],"results":{"codes":[{"status":200,"name":"","code":"[\n  {\n    \"createdAt\": 1491817192134,\n    \"updatedAt\": 1491830647928,\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"config\": {\n      \"appUrl\": \"https://mocaplatform.com\",\n      \"category\": \"Utilities\",\n      \"version\": \"1.0\",\n      \"description\": \"This is a sample app\",\n      \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n      \"name\": \"TestApp\",\n      \"approxAppSize\": \"<2500\",\n      \"production\": false\n    },\n    \"targets\": []\n  },\n  {\n    \"createdAt\": 1491817210059,\n    \"updatedAt\": 1491817210059,\n    \"appId\": \"QlcgoBU_RvW1XIaNck9y8w\",\n    \"appSecret\": \"Lua+oPONxFBrcJMPR0u6hHbhS/k=\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"config\": {\n      \"appUrl\": \"\",\n      \"category\": \"Games\",\n      \"version\": \"2.0\",\n      \"description\": \"Tic Tac Toe Game\",\n      \"iconUrl\": \"\",\n      \"name\": \"TicTacToe\",\n      \"approxAppSize\": \"<2500\",\n      \"production\": true\n    },\n    \"targets\": []\n  }\n]","language":"json"},{"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401}]},"settings":"","url":"/apps/?offset=:offset&limit=:limit"},"body":"","parentDoc":null,"slug":"moca-api-get-apps","title":"Get all apps","childrenPages":[]}

getGet all apps

Returns a list of all Apps across user's memberships, including Apps both owned and from other accounts this user was invited to. The Apps are returned in sorted order, with the most recent App appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef30eb58fcb42d007383ff","project":"559a61d2dbcfd20d00710b39","slug":"moca-api-get-app","type":"get","body":"","hidden":false,"isReference":true,"link_url":"","link_external":false,"order":2,"parentDoc":null,"title":"Get single app","api":{"results":{"codes":[{"code":"{\n  \"createdAt\": 1491817192134,\n  \"updatedAt\": 1491830647928,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"config\": {\n    \"appUrl\": \"https://mocaplatform.com\",\n    \"category\": \"Utilities\",\n    \"version\": \"1.0\",\n    \"description\": \"This is a sample app\",\n    \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n    \"name\": \"TestApp\",\n    \"approxAppSize\": \"<2500\",\n    \"production\": false\n  },\n  \"targets\": []\n}","language":"json","status":200,"name":""},{"name":"","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401},{"code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"App not found\"\n}","status":404,"language":"json"}]},"settings":"","url":"/apps/:appId","auth":"required","examples":{"codes":[]},"method":"get","params":[{"default":"","desc":"Requested app id.","in":"path","name":"appId","ref":"","required":true,"type":"string","_id":"55a8283172e7120d004ae67f"}]},"excerpt":"Retrieves the details of an existing App.","next":{"pages":[],"description":""},"sync_unique":"","updates":[],"user":"55a54dde9c32760d00ca78a8","__v":0,"category":"58e76f2a654e3839008655d0","createdAt":"2017-04-13T08:03:55.511Z","githubsync":"","version":"58e76f2a654e3839008655c8","childrenPages":[]}

getGet single app

Retrieves the details of an existing App.

Path Params

appId:
required
string
Requested app id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef31089ddc511b00a4fe16","githubsync":"","api":{"auth":"required","examples":{"codes":[{"language":"json","code":"{\n  \"accountIds\": [ \"TAPFXFowToO4dFsktFzz9Q\" ],\n  \"name\": \"%Test%\",\n  \"inProduction\": false,\n  \"hasIcon\": false,\n  \"includeDeleted\": true,\n  \"offset\": 0,\n  \"limit\": 10\n}"}]},"method":"post","params":[{"desc":"List of Accounts where Apps will be searched in.","in":"body","name":"accountIds","ref":"","required":false,"type":"array_string","_id":"58eb6b98bea9c5230084b6da","default":""},{"desc":"App name to be searched, use % as wildcard.","default":"","type":"string","name":"name","_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":false},{"_id":"58eb6b98bea9c5230084b6d8","default":"","desc":"Whether searched Apps are in production or dev mode.","in":"body","name":"inProduction","ref":"","required":false,"type":"boolean"},{"_id":"58eb6b98bea9c5230084b6d7","default":"","desc":"Whether searched Apps have defined an icon or not.","in":"body","name":"hasIcon","ref":"","required":false,"type":"boolean"},{"type":"boolean","_id":"58eb6b98bea9c5230084b6d6","default":"false","desc":"Include already deleted Apps in the search.","in":"body","name":"includeDeleted","ref":"","required":false},{"default":"0","desc":"Paging offset. Used to indicate the index of the first object to be returned.","in":"body","name":"offset","ref":"","required":false,"type":"int","_id":"58eb92157d463619003e294b"},{"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","in":"body","name":"limit","ref":"","required":false,"type":"int","_id":"58eb922e7d463619003e294c","default":"1000"}],"results":{"codes":[{"language":"json","code":"[\n  {\n    \"createdAt\": 1491817192134,\n    \"updatedAt\": 1491830647928,\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n    \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n    \"config\": {\n      \"appUrl\": \"https://mocaplatform.com\",\n      \"category\": \"Utilities\",\n      \"version\": \"1.0\",\n      \"description\": \"This is a sample app\",\n      \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n      \"name\": \"TestApp\",\n      \"approxAppSize\": \"<2500\",\n      \"production\": false\n    },\n    \"targets\": []\n  }\n]","name":"","status":200},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\"\n}"},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field inProduction: Can not deserialize value of type java.lang.Boolean from String \\\"asd\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}","status":400,"language":"json"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/apps/search"},"isReference":true,"sync_unique":"","updates":[],"version":"58e76f2a654e3839008655c8","__v":0,"createdAt":"2017-04-13T08:04:24.634Z","excerpt":"Returns a list of Apps that matched the requested criteria across user's memberships, including Apps both owned and from other accounts this user was invited to. The Apps are returned in sorted order, with the most recent App appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","hidden":false,"link_url":"","order":3,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-search-apps","body":"","type":"post","title":"Search apps","link_external":false,"next":{"pages":[],"description":""},"parentDoc":null,"user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d0","childrenPages":[]}

postSearch apps

Returns a list of Apps that matched the requested criteria across user's memberships, including Apps both owned and from other accounts this user was invited to. The Apps are returned in sorted order, with the most recent App appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountIds:
array of strings
List of Accounts where Apps will be searched in.
name:
string
App name to be searched, use % as wildcard.
inProduction:
boolean
Whether searched Apps are in production or dev mode.
hasIcon:
boolean
Whether searched Apps have defined an icon or not.
includeDeleted:
booleanfalse
Include already deleted Apps in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef3130cbe8fb3b00902b13","isReference":true,"link_external":false,"link_url":"","order":4,"type":"post","updates":[],"version":"58e76f2a654e3839008655c8","__v":0,"category":"58e76f2a654e3839008655d0","next":{"pages":[],"description":""},"title":"Create new app","user":"55a54dde9c32760d00ca78a8","api":{"params":[{"required":true,"type":"string","_id":"58e79d7514f5af3900a094aa","default":"","desc":"Id of the Account where the App will be created.","in":"query","name":"accountId","ref":""},{"in":"body","name":"name","ref":"","required":true,"type":"string","_id":"58eb852d7d463619003e248c","default":"","desc":"Name of the App."},{"default":"","desc":"App description.","in":"body","name":"description","ref":"","required":false,"type":"string","_id":"58eb852d7d463619003e248b"},{"ref":"","required":false,"type":"string","_id":"58eb852d7d463619003e248a","default":"","desc":"App URL.","in":"body","name":"appUrl"},{"ref":"","required":false,"type":"string","_id":"58eb90115ce06e19008a9658","default":"","desc":"App version.","in":"body","name":"version"},{"in":"body","required":false,"desc":"Category of the app, e.g. Sports, Travel...","default":"","type":"string","name":"category","_id":"58eb852d7d463619003e2489","ref":""},{"required":false,"desc":"App icon URL, used in Apps list in console.mocaplatform.com","default":"","type":"string","name":"iconUrl","_id":"58eb852d7d463619003e2488","ref":"","in":"body"},{"ref":"","in":"body","required":false,"desc":"Approximate number of users predicted. Values: \"<2500\", \"2500-10K\", \"10K-25K\", \"25K-100K\", \"100K-250K\", \">250K\"","default":"","type":"string","name":"approxAppSize","_id":"58eb852d7d463619003e2487"},{"in":"body","required":false,"desc":"Whether the App will be used for Testing or for Production","default":"false","type":"boolean","name":"production","_id":"58eb852d7d463619003e2486","ref":""}],"results":{"codes":[{"language":"json","code":"{\n  \"createdAt\": 1491817192134,\n  \"updatedAt\": 1491830647928,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"config\": {\n    \"appUrl\": \"https://mocaplatform.com\",\n    \"category\": \"Utilities\",\n    \"version\": \"1.0\",\n    \"description\": \"This is a sample app\",\n    \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n    \"name\": \"TestApp\",\n    \"approxAppSize\": \"<2500\",\n    \"production\": false\n  },\n  \"targets\": []\n}","name":"","status":201},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'accountId' is not present\"\n}"},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]},"settings":"","url":"/apps/?accountId=:accountId","auth":"required","examples":{"codes":[{"code":"{\n  \"name\": \"TestApp\",\n  \"description\": \"This is a sample app\",\n  \"appUrl\": \"https://mocaplatform.com\",\n  \"category\": \"Utilities\",\n  \"version\": \"1.0\",\n  \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n  \"approxAppSize\": \"<2500\",\n  \"production\": false\n}","language":"json"}]},"method":"post"},"body":"","githubsync":"","hidden":false,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","createdAt":"2017-04-13T08:05:04.750Z","excerpt":"Creates a new App.","slug":"moca-api-create-app","sync_unique":"","childrenPages":[]}

postCreate new app

Creates a new App.

Query Params

accountId:
required
string
Id of the Account where the App will be created.

Body Params

name:
required
string
Name of the App.
description:
string
App description.
appUrl:
string
App URL.
version:
string
App version.
category:
string
Category of the app, e.g. Sports, Travel...
iconUrl:
string
App icon URL, used in Apps list in console.mocaplatform.com
approxAppSize:
string
Approximate number of users predicted. Values: "<2500", "2500-10K", "10K-25K", "25K-100K", "100K-250K", ">250K"
production:
booleanfalse
Whether the App will be used for Testing or for Production

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef316258fcb42d00738421","project":"559a61d2dbcfd20d00710b39","sync_unique":"","title":"Update app","user":"55a54dde9c32760d00ca78a8","body":"","category":"58e76f2a654e3839008655d0","hidden":false,"version":"58e76f2a654e3839008655c8","excerpt":"Updates an already existing App.","link_external":false,"updates":[],"parentDoc":null,"slug":"moca-api-update-app","type":"put","githubsync":"","next":{"pages":[],"description":""},"order":5,"createdAt":"2017-04-13T08:05:54.493Z","isReference":true,"link_url":"","__v":1,"api":{"examples":{"codes":[{"language":"json","code":"{\n  \"name\": \"TestApp\",\n  \"description\": \"This is a sample app\",\n  \"appUrl\": \"https://mocaplatform.com\",\n  \"category\": \"Utilities\",\n  \"version\": \"1.0\",\n  \"iconUrl\": \"\",\n  \"approxAppSize\": \"<2500\",\n  \"production\": false\n}"}]},"method":"put","params":[{"_id":"58eb886f9db7532f000854e3","ref":"","in":"path","required":true,"desc":"Id of the App to be updated.","default":"","type":"string","name":"appId"},{"_id":"58eb852d7d463619003e248c","ref":"","in":"body","required":true,"desc":"Name of the app","default":"","type":"string","name":"name"},{"_id":"58eb852d7d463619003e248b","ref":"","in":"body","required":false,"desc":"App description","default":"","type":"string","name":"description"},{"_id":"58eb852d7d463619003e248a","ref":"","in":"body","required":false,"desc":"App URL","default":"","type":"string","name":"appUrl"},{"_id":"58eb90889db7532f00085859","ref":"","in":"body","required":false,"desc":"App version","default":"","type":"string","name":"version"},{"_id":"58eb852d7d463619003e2489","ref":"","in":"body","required":false,"desc":"Category of the app, e.g. Sports, Travel...","default":"","type":"string","name":"category"},{"_id":"58eb852d7d463619003e2488","ref":"","in":"body","required":false,"desc":"App icon URL, used in Apps list in console.mocaplatform.com","default":"","type":"string","name":"iconUrl"},{"_id":"58eb852d7d463619003e2487","ref":"","in":"body","required":false,"desc":"Approximate number of users predicted. Values: \"<2500\", \"2500-10K\", \"10K-25K\", \"25K-100K\", \"100K-250K\", \">250K\"","default":"","type":"string","name":"approxAppSize"},{"_id":"58eb852d7d463619003e2486","ref":"","in":"body","required":false,"desc":"Whether the App will be used for Testing or for Production","default":"false","type":"boolean","name":"production"}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n  \"createdAt\": 1491817192134,\n  \"updatedAt\": 1491830647928,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"config\": {\n    \"appUrl\": \"https://mocaplatform.com\",\n    \"category\": \"Utilities\",\n    \"version\": \"1.0\",\n    \"description\": \"This is a sample app\",\n    \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n    \"name\": \"TestApp\",\n    \"approxAppSize\": \"<2500\",\n    \"production\": false\n  },\n  \"targets\": []\n}"},{"language":"json","status":400,"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"update.config.name\": \"cannot be null\"\n  }\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/apps/:appId","auth":"required"},"childrenPages":[]}

putUpdate app

Updates an already existing App.

Path Params

appId:
required
string
Id of the App to be updated.

Body Params

name:
required
string
Name of the app
description:
string
App description
appUrl:
string
App URL
version:
string
App version
category:
string
Category of the app, e.g. Sports, Travel...
iconUrl:
string
App icon URL, used in Apps list in console.mocaplatform.com
approxAppSize:
string
Approximate number of users predicted. Values: "<2500", "2500-10K", "10K-25K", "25K-100K", "100K-250K", ">250K"
production:
booleanfalse
Whether the App will be used for Testing or for Production

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58ef31859ddc511b00a4fe17","link_external":false,"link_url":"","project":"559a61d2dbcfd20d00710b39","__v":1,"api":{"method":"put","examples":{"codes":[]},"auth":"required","params":[{"_id":"55a8283172e7120d004ae67f","ref":"","in":"path","required":true,"desc":"Id of the App whose icon will be updated","default":"","type":"string","name":"appId"},{"_id":"55acc11b6b4ff90d00784b45","ref":"","in":"body","required":true,"desc":"New app icon file","default":"","type":"file","name":"image"}],"url":"/apps/:appId/icon","settings":"","results":{"codes":[{"code":"{\n  \"createdAt\": 1491817192134,\n  \"updatedAt\": 1491830647928,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"appSecret\": \"lJiLBbqHcVc3gyPoZujm6wqouGs=\",\n  \"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n  \"config\": {\n    \"appUrl\": \"https://mocaplatform.com\",\n    \"category\": \"Utilities\",\n    \"version\": \"1.0\",\n    \"description\": \"This is a sample app\",\n    \"iconUrl\": \"https://console.mocaplatform.com/images/moca-logo-standalone-72x72.png\",\n    \"name\": \"TestApp\",\n    \"approxAppSize\": \"<2500\",\n    \"production\": false\n  },\n  \"targets\": []\n}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Empty image\"\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]}},"category":"58e76f2a654e3839008655d0","createdAt":"2017-04-13T08:06:29.541Z","excerpt":"Sets the icon of a specific App.","version":"58e76f2a654e3839008655c8","githubsync":"","hidden":false,"parentDoc":null,"type":"put","updates":[],"user":"55a54dde9c32760d00ca78a8","next":{"pages":[],"description":""},"order":6,"slug":"moca-api-update-app-icon","title":"Update app icon","body":"","isReference":true,"sync_unique":"","childrenPages":[]}

putUpdate app icon

Sets the icon of a specific App.

Path Params

appId:
required
string
Id of the App whose icon will be updated

Body Params

image:
required
file
New app icon file

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"58ef319e58fcb42d00738422","excerpt":"Deletes an App.","next":{"pages":[],"description":""},"title":"Delete app","createdAt":"2017-04-13T08:06:54.484Z","githubsync":"","link_external":false,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","sync_unique":"","type":"delete","category":"58e76f2a654e3839008655d0","isReference":true,"link_url":"","order":7,"user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","__v":0,"body":"","hidden":false,"slug":"moca-api-delete-app","updates":[],"api":{"url":"/apps/:appId","auth":"required","examples":{"codes":[]},"method":"delete","params":[{"type":"string","name":"appId","_id":"58eb8d5ec731be2300b8b91e","ref":"","in":"path","required":true,"desc":"Id of the App to be deleted","default":""}],"results":{"codes":[{"name":"","code":"","language":"json","status":204},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":""},"childrenPages":[]}

deleteDelete app

Deletes an App.

Path Params

appId:
required
string
Id of the App to be deleted

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"5912d355c0935b270003a8ce","category":"58e76f2a654e3839008655d5","hidden":false,"__v":0,"api":{"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"code":"{}","language":"json","status":400,"name":""}]},"auth":"required","params":[]},"createdAt":"2017-05-10T08:46:13.338Z","order":0,"parentDoc":null,"excerpt":"Segments are a subset of a mobile app audience that is selected by combining criteria that meet a specific objective.","link_external":false,"link_url":"","next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","title":"Overview","version":"58e76f2a654e3839008655c8","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Segment Object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"createdAt\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Obligatory?\",\n    \"h-3\": \"Description\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"2-0\": \"segmentId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Segment identifier.\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the segment.\",\n    \"5-0\": \"config.description\",\n    \"5-1\": \"string\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Description of the segment.\",\n    \"6-0\": \"config.query\",\n    \"6-1\": \"string\",\n    \"6-2\": \"Yes\",\n    \"6-3\": \"Criteria query.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last updated date (timestamp UTC).\",\n    \"3-0\": \"appId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Autogenerated\",\n    \"3-3\": \"Application key\"\n  },\n  \"cols\": 4,\n  \"rows\": 7\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1494407258613,\\n  \\\"updatedAt\\\": 1494407258614,\\n  \\\"segmentId\\\": \\\"fe9NBA8DRdCIDmmEhy3T2w\\\",\\n  \\\"appId\\\": \\\"IXa7Bl9oRo6c7zQ5aQIzlg\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"English Android users\\\",\\n    \\\"description\\\": \\\"Users with an English Android device\\\",\\n    \\\"query\\\": \\\"{ \\\\\\\"$all\\\\\\\": [ { \\\\\\\"lang\\\\\\\" : { \\\\\\\"$eq\\\\\\\" : \\\\\\\"es\\\\\\\" } }, { \\\\\\\"os\\\\\\\" : { \\\\\\\"$eq\\\\\\\" : \\\\\\\"Android\\\\\\\" } } ] }\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Segment object\"\n    }\n  ]\n}\n[/block]","githubsync":"","isReference":true,"slug":"moca-api-segments","sync_unique":"","type":"basic","updates":[],"user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

Overview

Segments are a subset of a mobile app audience that is selected by combining criteria that meet a specific objective.

[block:api-header] { "type": "basic", "title": "The Segment Object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "segmentId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Segment identifier.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the segment.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the segment.", "6-0": "config.query", "6-1": "string", "6-2": "Yes", "6-3": "Criteria query.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated date (timestamp UTC).", "3-0": "appId", "3-1": "string", "3-2": "Autogenerated", "3-3": "Application key" }, "cols": 4, "rows": 7 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494407258613,\n \"updatedAt\": 1494407258614,\n \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"config\": {\n \"name\": \"English Android users\",\n \"description\": \"Users with an English Android device\",\n \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\" : { \\\"$eq\\\" : \\\"es\\\" } }, { \\\"os\\\" : { \\\"$eq\\\" : \\\"Android\\\" } } ] }\"\n }\n}", "language": "json", "name": "Sample Segment object" } ] } [/block]
[block:api-header] { "type": "basic", "title": "The Segment Object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "segmentId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Segment identifier.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the segment.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the segment.", "6-0": "config.query", "6-1": "string", "6-2": "Yes", "6-3": "Criteria query.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated date (timestamp UTC).", "3-0": "appId", "3-1": "string", "3-2": "Autogenerated", "3-3": "Application key" }, "cols": 4, "rows": 7 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494407258613,\n \"updatedAt\": 1494407258614,\n \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"config\": {\n \"name\": \"English Android users\",\n \"description\": \"Users with an English Android device\",\n \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\" : { \\\"$eq\\\" : \\\"es\\\" } }, { \\\"os\\\" : { \\\"$eq\\\" : \\\"Android\\\" } } ] }\"\n }\n}", "language": "json", "name": "Sample Segment object" } ] } [/block]
{"_id":"5912e77ef7be96250061432f","__v":0,"excerpt":"A Segment's Query defines a boolean expression that determines if a user/instance belongs to that given Segment.","link_external":false,"next":{"pages":[],"description":""},"type":"basic","updates":[],"user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d5","hidden":false,"isReference":true,"link_url":"","version":"58e76f2a654e3839008655c8","api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required"},"parentDoc":null,"slug":"moca-api-segment-query","sync_unique":"","body":"A basic query has the following format:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"$<group-operator>\\\": [\\n    { \\\"<field1>\\\": { \\\"$<operator>\\\": \\\"<value1>\\\" } },\\n    { \\\"<field2>\\\": { \\\"$<operator>\\\": \\\"<value2>\\\" } },\\n    ...\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Format\"\n    }\n  ]\n}\n[/block]\nWhere <group-operator> is the root expression, containing two nested expressions (<field1> and <field2>).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{ \\n  \\\"$all\\\": [\\n    { \\\"lang\\\" : { \\\"$eq\\\" : \\\"en\\\" } },\\n    { \\\"os\\\" : { \\\"$ne\\\" : \\\"Android\\\" } }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Example\"\n    }\n  ]\n}\n[/block]\nWill match all devices that have an English language setting AND their Operative System is NOT Android.\n\nAdditionally, group expressions can be nested:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{ \\n  \\\"$all\\\": [\\n    { \\\"os\\\" : { \\\"$ne\\\" : \\\"Android\\\" } },\\n    { \\\"$any\\\": [\\n      { \\\"lang\\\" : { \\\"$eq\\\" : \\\"en\\\" } },\\n      { \\\"lang\\\" : { \\\"$eq\\\" : \\\"es\\\" } }\\n    ] }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Example\"\n    }\n  ]\n}\n[/block]\nThis expression will match non-Android devices with either English or Spanish language.\n[block:api-header]\n{\n  \"title\": \"Operators\"\n}\n[/block]\nValid root operators are:\n- $all : All child expressions are required to accept the segment\n- $any : Only one child is required to accept the segment\n\nValid expression operators are:\n- $eq : The field's value is equal to the specified value\n- $ne : The field's value is not equal to the specified value\n- $lt : The field's value is less than the specified value.\n- $gt : The field's value is greater than the specified value.\n- $lte : The field's value is not greater than the specified value.\n- $gte : The field's value is not less than the specified value.\n- $in : The field's value is in a list of specified values.\n- $nin : The field's value is not in a list of specified values.\n- $like : SQL like expression, used to match values. e.g. \"%campaign%\"\n- $matches : Regex expression, used to match values. e.g. \"User\\s\\d+\"\n- $startsWith : The field's value starts with the specified value.\n- $endsWith : The field's value ends with the specified value.\n- $contains : The field's value contains the specified value.\n\nAdditionally, you may skip the operator for $eq expressions:\n- { \"field\" : { \"$eq\": \"value\" } } -> { \"field\" : \"value\" }\n\nAll operators work on a best effort basis: They will try to match data for every possible value type, and will work even if the field's value and the specified value are of different format. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"In the case that the evaluation is not possible, the expression is evaluated to false.\",\n  \"title\": \"Evaluation exception handling\"\n}\n[/block]\nAll the following expressions are accepted:\n- [1,2,3] $contains 2\n- \"Hello\" $contains \"lo\"\n- \"34\" $gt 10 (The string can be parsed as a number)\n- 1 $eq true (1 is a Truthy value)\n[block:api-header]\n{\n  \"title\": \"Fields\"\n}\n[/block]\nField expressions are JSON-like variables that can also be nested if the field is an object.\n\nExample:\nGiven \"address\" : { \"country\": \"Spain\", \"city\": \"Barcelona\" }\n\"address.country\" -> \"Spain\"\n\nSome of the available fields are the following:\n- lang : device language as configured by user\n- country : device country as configured by user\n- os : operating system name\n- os_version : os version\n- app_name : application name\n- app_version : app version extracted from app bundle\n- device_type : type of device (E.g. iPad)\n- device_model : manufacturer model of the device (E.g. iPhone 5)\n- geo_hash : latest known user geo-location (if enabled) expressed as a geo-hash code.\n- st : last updated at timestamp UTC\n- session _number : number of times the user has opened the app\n- tags : array of tag names the user has been tagged with\n- tags.XXX : current value of the tag XXX (numerical)\n- user.XXX : custom field added through MOCA SDK\n\nYou can get a complete list by accessing [Get all fields](doc:moca-api-get-fields)","createdAt":"2017-05-10T10:12:14.682Z","githubsync":"","order":1,"project":"559a61d2dbcfd20d00710b39","title":"Query expressions","childrenPages":[]}

Query expressions

A Segment's Query defines a boolean expression that determines if a user/instance belongs to that given Segment.

A basic query has the following format: [block:code] { "codes": [ { "code": "{\n \"$<group-operator>\": [\n { \"<field1>\": { \"$<operator>\": \"<value1>\" } },\n { \"<field2>\": { \"$<operator>\": \"<value2>\" } },\n ...\n ]\n}", "language": "json", "name": "Format" } ] } [/block] Where <group-operator> is the root expression, containing two nested expressions (<field1> and <field2>). [block:code] { "codes": [ { "code": "{ \n \"$all\": [\n { \"lang\" : { \"$eq\" : \"en\" } },\n { \"os\" : { \"$ne\" : \"Android\" } }\n ]\n}", "language": "json", "name": "Example" } ] } [/block] Will match all devices that have an English language setting AND their Operative System is NOT Android. Additionally, group expressions can be nested: [block:code] { "codes": [ { "code": "{ \n \"$all\": [\n { \"os\" : { \"$ne\" : \"Android\" } },\n { \"$any\": [\n { \"lang\" : { \"$eq\" : \"en\" } },\n { \"lang\" : { \"$eq\" : \"es\" } }\n ] }\n ]\n}", "language": "json", "name": "Example" } ] } [/block] This expression will match non-Android devices with either English or Spanish language. [block:api-header] { "title": "Operators" } [/block] Valid root operators are: - $all : All child expressions are required to accept the segment - $any : Only one child is required to accept the segment Valid expression operators are: - $eq : The field's value is equal to the specified value - $ne : The field's value is not equal to the specified value - $lt : The field's value is less than the specified value. - $gt : The field's value is greater than the specified value. - $lte : The field's value is not greater than the specified value. - $gte : The field's value is not less than the specified value. - $in : The field's value is in a list of specified values. - $nin : The field's value is not in a list of specified values. - $like : SQL like expression, used to match values. e.g. "%campaign%" - $matches : Regex expression, used to match values. e.g. "User\s\d+" - $startsWith : The field's value starts with the specified value. - $endsWith : The field's value ends with the specified value. - $contains : The field's value contains the specified value. Additionally, you may skip the operator for $eq expressions: - { "field" : { "$eq": "value" } } -> { "field" : "value" } All operators work on a best effort basis: They will try to match data for every possible value type, and will work even if the field's value and the specified value are of different format. [block:callout] { "type": "info", "body": "In the case that the evaluation is not possible, the expression is evaluated to false.", "title": "Evaluation exception handling" } [/block] All the following expressions are accepted: - [1,2,3] $contains 2 - "Hello" $contains "lo" - "34" $gt 10 (The string can be parsed as a number) - 1 $eq true (1 is a Truthy value) [block:api-header] { "title": "Fields" } [/block] Field expressions are JSON-like variables that can also be nested if the field is an object. Example: Given "address" : { "country": "Spain", "city": "Barcelona" } "address.country" -> "Spain" Some of the available fields are the following: - lang : device language as configured by user - country : device country as configured by user - os : operating system name - os_version : os version - app_name : application name - app_version : app version extracted from app bundle - device_type : type of device (E.g. iPad) - device_model : manufacturer model of the device (E.g. iPhone 5) - geo_hash : latest known user geo-location (if enabled) expressed as a geo-hash code. - st : last updated at timestamp UTC - session _number : number of times the user has opened the app - tags : array of tag names the user has been tagged with - tags.XXX : current value of the tag XXX (numerical) - user.XXX : custom field added through MOCA SDK You can get a complete list by accessing [Get all fields](doc:moca-api-get-fields)
A basic query has the following format: [block:code] { "codes": [ { "code": "{\n \"$<group-operator>\": [\n { \"<field1>\": { \"$<operator>\": \"<value1>\" } },\n { \"<field2>\": { \"$<operator>\": \"<value2>\" } },\n ...\n ]\n}", "language": "json", "name": "Format" } ] } [/block] Where <group-operator> is the root expression, containing two nested expressions (<field1> and <field2>). [block:code] { "codes": [ { "code": "{ \n \"$all\": [\n { \"lang\" : { \"$eq\" : \"en\" } },\n { \"os\" : { \"$ne\" : \"Android\" } }\n ]\n}", "language": "json", "name": "Example" } ] } [/block] Will match all devices that have an English language setting AND their Operative System is NOT Android. Additionally, group expressions can be nested: [block:code] { "codes": [ { "code": "{ \n \"$all\": [\n { \"os\" : { \"$ne\" : \"Android\" } },\n { \"$any\": [\n { \"lang\" : { \"$eq\" : \"en\" } },\n { \"lang\" : { \"$eq\" : \"es\" } }\n ] }\n ]\n}", "language": "json", "name": "Example" } ] } [/block] This expression will match non-Android devices with either English or Spanish language. [block:api-header] { "title": "Operators" } [/block] Valid root operators are: - $all : All child expressions are required to accept the segment - $any : Only one child is required to accept the segment Valid expression operators are: - $eq : The field's value is equal to the specified value - $ne : The field's value is not equal to the specified value - $lt : The field's value is less than the specified value. - $gt : The field's value is greater than the specified value. - $lte : The field's value is not greater than the specified value. - $gte : The field's value is not less than the specified value. - $in : The field's value is in a list of specified values. - $nin : The field's value is not in a list of specified values. - $like : SQL like expression, used to match values. e.g. "%campaign%" - $matches : Regex expression, used to match values. e.g. "User\s\d+" - $startsWith : The field's value starts with the specified value. - $endsWith : The field's value ends with the specified value. - $contains : The field's value contains the specified value. Additionally, you may skip the operator for $eq expressions: - { "field" : { "$eq": "value" } } -> { "field" : "value" } All operators work on a best effort basis: They will try to match data for every possible value type, and will work even if the field's value and the specified value are of different format. [block:callout] { "type": "info", "body": "In the case that the evaluation is not possible, the expression is evaluated to false.", "title": "Evaluation exception handling" } [/block] All the following expressions are accepted: - [1,2,3] $contains 2 - "Hello" $contains "lo" - "34" $gt 10 (The string can be parsed as a number) - 1 $eq true (1 is a Truthy value) [block:api-header] { "title": "Fields" } [/block] Field expressions are JSON-like variables that can also be nested if the field is an object. Example: Given "address" : { "country": "Spain", "city": "Barcelona" } "address.country" -> "Spain" Some of the available fields are the following: - lang : device language as configured by user - country : device country as configured by user - os : operating system name - os_version : os version - app_name : application name - app_version : app version extracted from app bundle - device_type : type of device (E.g. iPad) - device_model : manufacturer model of the device (E.g. iPhone 5) - geo_hash : latest known user geo-location (if enabled) expressed as a geo-hash code. - st : last updated at timestamp UTC - session _number : number of times the user has opened the app - tags : array of tag names the user has been tagged with - tags.XXX : current value of the tag XXX (numerical) - user.XXX : custom field added through MOCA SDK You can get a complete list by accessing [Get all fields](doc:moca-api-get-fields)
{"_id":"5912fe92c0935b270003aaf7","next":{"pages":[],"description":""},"parentDoc":null,"user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d5","order":2,"slug":"moca-api-get-segments","sync_unique":"","type":"get","updates":[],"__v":1,"excerpt":"Returns a list of all Segments across user's memberships, including Segments both owned and from other accounts this user was invited to. The Segments are returned in sorted order, with the most recent Segment appearing last.\n\nSupports paging.","isReference":true,"link_external":false,"link_url":"","title":"Get all segments","version":"58e76f2a654e3839008655c8","api":{"method":"get","params":[{"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset","_id":"55ae2019f302af23000ac0b8","ref":"","in":"query","required":false},{"_id":"5912ff3569e10c2500eef2cf","ref":"","in":"query","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","default":"1000","type":"int","name":"limit"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1494407258613,\n    \"updatedAt\": 1494422311061,\n    \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"config\": {\n      \"name\": \"English non-Android users\",\n      \"description\": \"Users with a non-Android English device\",\n      \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"en\\\" } }, { \\\"os\\\": { \\\"$ne\\\": \\\"Android\\\" } } ] }\"\n    }\n  }\n]","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/segments/?offset=:offset&limit=:limit","auth":"required","examples":{"codes":[]}},"body":"","createdAt":"2017-05-10T11:50:42.234Z","githubsync":"","hidden":false,"project":"559a61d2dbcfd20d00710b39","childrenPages":[]}

getGet all segments

Returns a list of all Segments across user's memberships, including Segments both owned and from other accounts this user was invited to. The Segments are returned in sorted order, with the most recent Segment appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"59130126f7be962500614471","title":"Get single segment","api":{"url":"/segments/:segmentId","auth":"required","examples":{"codes":[]},"method":"get","params":[{"type":"string","name":"segmentId","_id":"55ae2f1f2723e51900898fae","ref":"","in":"path","required":true,"desc":"Requested segment Id.","default":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1494407258613,\n  \"updatedAt\": 1494422311061,\n  \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"English non-Android users\",\n    \"description\": \"Users with a non-Android English device\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"en\\\" } }, { \\\"os\\\": { \\\"$ne\\\": \\\"Android\\\" } } ] }\"\n  }\n}","name":""},{"name":"","status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"},{"language":"json","code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Segment not found\"\n}","status":404}]},"settings":""},"category":"58e76f2a654e3839008655d5","excerpt":"Retrieves the details of an existing Segment.","link_external":false,"project":"559a61d2dbcfd20d00710b39","sync_unique":"","link_url":"","parentDoc":null,"type":"get","updates":[],"version":"58e76f2a654e3839008655c8","body":"","createdAt":"2017-05-10T12:01:42.286Z","githubsync":"","hidden":false,"next":{"pages":[],"description":""},"slug":"moca-api-get-segment","__v":1,"isReference":true,"order":3,"user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

getGet single segment

Retrieves the details of an existing Segment.

Path Params

segmentId:
required
string
Requested segment Id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"591301fec0935b270003aafb","title":"Search segments","body":"","createdAt":"2017-05-10T12:05:18.817Z","excerpt":"Returns a list of Segments that matched the requested criteria across user's memberships, including Segments both owned and from other accounts this user was invited to. The Segments are returned in sorted order, with the most recent Segment appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","parentDoc":null,"project":"559a61d2dbcfd20d00710b39","__v":1,"api":{"method":"post","params":[{"desc":"Account Id where Segments will be searched.","default":"","type":"string","name":"accountId","_id":"58eb6b98bea9c5230084b6d7","ref":"","in":"body","required":false},{"_id":"58eb6b98bea9c5230084b6da","ref":"","in":"body","required":false,"desc":"App Id where Segments will be searched.","default":"","type":"string","name":"appId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":false,"desc":"Segment name to be searched, use % as wildcard.","default":"","type":"string","name":"name"},{"name":"query","_id":"5913035b58a5463700d3d8e2","ref":"","in":"body","required":false,"desc":"Segment query expression to be searched, use % as wildcard.","default":"","type":"string"},{"default":"false","desc":"Include already deleted Segments in the search.","in":"body","name":"includeDeleted","ref":"","required":false,"type":"boolean","_id":"58eb6b98bea9c5230084b6d6"},{"default":"0","type":"int","name":"offset","_id":"58eb92157d463619003e294b","ref":"","in":"body","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned."},{"default":"1000","type":"int","name":"limit","_id":"58eb922e7d463619003e294c","ref":"","in":"body","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved."}],"results":{"codes":[{"status":200,"name":"","code":"[\n  {\n    \"createdAt\": 1494407258613,\n    \"updatedAt\": 1494416742215,\n    \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"config\": {\n      \"name\": \"English non-Android users\",\n      \"description\": \"Users with a non-Android English device\",\n      \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\" : { \\\"$eq\\\" : \\\"es\\\" } }, { \\\"os\\\" : { \\\"$ne\\\" : \\\"Android\\\" } } ] }\"\n    }\n  }\n]","language":"json"},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/segments/search","auth":"required","examples":{"codes":[{"code":"{\n\t\"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n\t\"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n\t\"name\": \"%English%\",\n\t\"query\": \"%lang%\",\n\t\"includeDeleted\": true,\n\t\"offset\": 0,\n\t\"limit\": 10\n}","language":"json"}]}},"slug":"moca-api-search-segments","version":"58e76f2a654e3839008655c8","sync_unique":"","type":"post","isReference":true,"link_external":false,"link_url":"","order":4,"user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d5","githubsync":"","hidden":false,"next":{"pages":[],"description":""},"updates":[],"childrenPages":[]}

postSearch segments

Returns a list of Segments that matched the requested criteria across user's memberships, including Segments both owned and from other accounts this user was invited to. The Segments are returned in sorted order, with the most recent Segment appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Segments will be searched.
appId:
string
App Id where Segments will be searched.
name:
string
Segment name to be searched, use % as wildcard.
query:
string
Segment query expression to be searched, use % as wildcard.
includeDeleted:
booleanfalse
Include already deleted Segments in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5912fd0065888319004e6d95","hidden":false,"isReference":true,"link_url":"","order":5,"project":"559a61d2dbcfd20d00710b39","api":{"settings":"","url":"/segments/?appId=:appId","auth":"required","examples":{"codes":[{"name":"Body","language":"json","code":"{\n\t\"name\": \"English non-Android users\",\n\t\"description\": \"Users with a non-Android English device\",\n\t\"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"es\\\" } }, { \\\"os\\\": { \\\"$ne\\\": \\\"Android\\\" } } ] }\"\n}"}]},"method":"post","params":[{"type":"string","name":"appId","_id":"5912fdc6f7be96250061442d","ref":"","in":"query","required":true,"desc":"Id of the App where the Segment will be created.","default":""},{"required":true,"desc":"Name of the Segment.","default":"","type":"string","name":"name","_id":"5912fdc6f7be96250061442c","ref":"","in":"body"},{"ref":"","in":"body","required":false,"desc":"Segment description.","default":"","type":"string","name":"description","_id":"5912fdc6f7be96250061442b"},{"ref":"","required":true,"type":"string","_id":"5912fdc6f7be96250061442a","default":"","desc":"*Escaped* query expression string.","in":"body","name":"query"}],"results":{"codes":[{"name":"","status":201,"language":"json","code":"{\n  \"createdAt\": 1494407258613,\n  \"updatedAt\": 1494407258613,\n  \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"English non-Android users\",\n    \"description\": \"Users with a non-Android English device\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"en\\\" } }, { \\\"os\\\": { \\\"$ne\\\": \\\"Android\\\" } } ] }\"\n  }\n}"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'appId' is not present\"\n}","name":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.query\": \"cannot be null\"\n  }\n}"},{"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Can not deserialize instance of java.lang.String out of START_OBJECT token\"\n}","status":400},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]}},"createdAt":"2017-05-10T11:44:00.053Z","sync_unique":"","updates":[],"githubsync":"","link_external":false,"title":"Create new segment","next":{"pages":[],"description":""},"parentDoc":null,"slug":"moca-api-create-segment","type":"post","user":"55a54dde9c32760d00ca78a8","__v":1,"body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Bad Request: Could not parse JSON\",\n  \"body\": \"If you are receiving this error message, please make sure to escape the Query JSON to a String instead of passing the Query JSON directly.\\n\\nFor example:\\n\\n{ \\\"lang\\\" : { \\\"$eq\\\" : \\\"en\\\" } }\\n\\nbecomes\\n\\n\\\"{ \\\\\\\"lang\\\\\\\" : { \\\\\\\"$eq\\\\\\\" : \\\\\\\"en\\\\\\\" } }\\\"\"\n}\n[/block]","excerpt":"Creates a new Segment.","category":"58e76f2a654e3839008655d5","version":"58e76f2a654e3839008655c8","childrenPages":[]}

postCreate new segment

Creates a new Segment.

Query Params

appId:
required
string
Id of the App where the Segment will be created.

Body Params

name:
required
string
Name of the Segment.
description:
string
Segment description.
query:
required
string
*Escaped* query expression string.
[block:callout] { "type": "danger", "title": "Bad Request: Could not parse JSON", "body": "If you are receiving this error message, please make sure to escape the Query JSON to a String instead of passing the Query JSON directly.\n\nFor example:\n\n{ \"lang\" : { \"$eq\" : \"en\" } }\n\nbecomes\n\n\"{ \\\"lang\\\" : { \\\"$eq\\\" : \\\"en\\\" } }\"" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "danger", "title": "Bad Request: Could not parse JSON", "body": "If you are receiving this error message, please make sure to escape the Query JSON to a String instead of passing the Query JSON directly.\n\nFor example:\n\n{ \"lang\" : { \"$eq\" : \"en\" } }\n\nbecomes\n\n\"{ \\\"lang\\\" : { \\\"$eq\\\" : \\\"en\\\" } }\"" } [/block]
{"_id":"5913110269e10c2500eef3d1","__v":2,"body":"","createdAt":"2017-05-10T13:09:22.439Z","parentDoc":null,"title":"Update segment","order":6,"slug":"moca-api-update-segment","api":{"auth":"required","examples":{"codes":[{"name":"Body","language":"json","code":"{\n  \"name\": \"English non-Android users\",\n  \"description\": \"Users with a non-Android English device\",\n  \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"en\\\" } }, { \\\"os\\\": { \\\"$ne\\\": \\\"Android\\\" } } ] }\"\n}"}]},"method":"put","params":[{"_id":"5912fdc6f7be96250061442d","ref":"","in":"path","required":true,"desc":"Id of the Segment to be updated.","default":"","type":"string","name":"segmentId"},{"_id":"5912fdc6f7be96250061442c","ref":"","in":"body","required":true,"desc":"Name of the Segment.","default":"","type":"string","name":"name"},{"_id":"5912fdc6f7be96250061442b","ref":"","in":"body","required":false,"desc":"Segment description.","default":"","type":"string","name":"description"},{"_id":"5912fdc6f7be96250061442a","ref":"","in":"body","required":true,"desc":"*Escaped* query expression string.","default":"","type":"string","name":"query"}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1494407258613,\n  \"updatedAt\": 1494422311061,\n  \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"English non-Android users\",\n    \"description\": \"Users with a non-Android English device\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"en\\\" } }, { \\\"os\\\": { \\\"$ne\\\": \\\"Android\\\" } } ] }\"\n  }\n}","language":"json","status":200},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.query\": \"cannot be null\"\n  }\n}","language":"json","status":400},{"language":"json","status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/segments/:segmentId"},"category":"58e76f2a654e3839008655d5","excerpt":"Updates an already existing Segment.","link_external":false,"link_url":"","sync_unique":"","hidden":false,"project":"559a61d2dbcfd20d00710b39","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","githubsync":"","isReference":true,"next":{"pages":[],"description":""},"type":"put","updates":[],"childrenPages":[]}

putUpdate segment

Updates an already existing Segment.

Path Params

segmentId:
required
string
Id of the Segment to be updated.

Body Params

name:
required
string
Name of the Segment.
description:
string
Segment description.
query:
required
string
*Escaped* query expression string.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59131186c0935b270003ac32","type":"delete","user":"55a54dde9c32760d00ca78a8","api":{"params":[{"required":true,"type":"string","_id":"55ae2f602723e51900898fb0","default":"","desc":"Id of the Segment to be deleted.","in":"path","name":"segmentId","ref":""}],"results":{"codes":[{"status":204,"language":"json","code":"","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/segments/:segmentId","auth":"required","examples":{"codes":[]},"method":"delete"},"githubsync":"","hidden":false,"isReference":true,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d5","next":{"pages":[],"description":""},"slug":"moca-api-delete-segment","body":"","link_external":false,"order":7,"updates":[],"__v":1,"createdAt":"2017-05-10T13:11:34.172Z","excerpt":"Deletes a Segment.","link_url":"","sync_unique":"","title":"Delete segment","childrenPages":[]}

deleteDelete segment

Deletes a Segment.

Path Params

segmentId:
required
string
Id of the Segment to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"59131943b012b10f002bce5b","createdAt":"2017-05-10T13:44:35.417Z","excerpt":"Events and entities contains attributes represented as key-value pairs. The value can be a single (scalar) value (eg a string, integer, date), or a nested structure like an array or an object.\n\nWhen queried, attributes become fields. A field is similar to a column in a table in a relational database. The mapping for each field has a field type (not to be confused with event or entity type) which indicates the type of data that can be stored in that field, eg integer, string, object.","__v":0,"order":0,"parentDoc":null,"version":"58e76f2a654e3839008655c8","link_external":false,"category":"58e76f2a654e3839008655d7","githubsync":"","isReference":true,"link_url":"","next":{"description":"","pages":[]},"project":"559a61d2dbcfd20d00710b39","sync_unique":"","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Field Object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"name\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Obligatory?\",\n    \"h-3\": \"Description\",\n    \"0-1\": \"string\",\n    \"0-2\": \"Yes\",\n    \"0-3\": \"Name of the field.\",\n    \"1-0\": \"type.name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"Yes\",\n    \"1-3\": \"Type of the field.\",\n    \"2-0\": \"type.operators.op\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Yes\",\n    \"2-3\": \"Name of the operation.\",\n    \"3-0\": \"type.operators.displayName\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"Displayed name of the operation.\",\n    \"4-0\": \"hidden\",\n    \"4-1\": \"boolean\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Whether the field is visible or not in MOCA Console.\",\n    \"5-0\": \"displayName\",\n    \"5-1\": \"string\",\n    \"5-2\": \"Yes\",\n    \"5-3\": \"Displayed name of the field.\",\n    \"6-0\": \"index\",\n    \"6-1\": \"integer\",\n    \"6-2\": \"Yes\",\n    \"6-3\": \"Index of the fueld, used for sorting.\",\n    \"7-0\": \"category\",\n    \"7-1\": \"string\",\n    \"7-2\": \"Yes\",\n    \"7-3\": \"Category of the field.\",\n    \"8-0\": \"allowFreeInput\",\n    \"8-1\": \"boolean\",\n    \"8-2\": \"Yes\",\n    \"8-3\": \"Whether free input values are allowed for this field.\",\n    \"9-0\": \"custom\",\n    \"9-1\": \"boolean\",\n    \"9-2\": \"Yes\",\n    \"9-3\": \"Whether this field is custom.\"\n  },\n  \"cols\": 4,\n  \"rows\": 10\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"name\\\": \\\"lang\\\",\\n  \\\"type\\\": {\\n    \\\"name\\\": \\\"string\\\",\\n    \\\"operators\\\": [\\n      {\\n        \\\"op\\\": \\\"eq\\\",\\n        \\\"displayName\\\": \\\"is equal to\\\"\\n      },\\n      {\\n        \\\"op\\\": \\\"ne\\\",\\n        \\\"displayName\\\": \\\"is not equal to\\\"\\n      },\\n      {...}\\n    ]\\n  },\\n  \\\"hidden\\\": false,\\n  \\\"displayName\\\": \\\"Language\\\",\\n  \\\"index\\\": 0,\\n  \\\"category\\\": \\\"user\\\",\\n  \\\"allowFreeInput\\\": false,\\n  \\\"custom\\\": false\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Field object\"\n    }\n  ]\n}\n[/block]","type":"basic","title":"Overview","hidden":false,"slug":"moca-api-fields","updates":[],"user":"55a54dde9c32760d00ca78a8","api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]}},"childrenPages":[]}

Overview

Events and entities contains attributes represented as key-value pairs. The value can be a single (scalar) value (eg a string, integer, date), or a nested structure like an array or an object. When queried, attributes become fields. A field is similar to a column in a table in a relational database. The mapping for each field has a field type (not to be confused with event or entity type) which indicates the type of data that can be stored in that field, eg integer, string, object.

[block:api-header] { "type": "basic", "title": "The Field Object" } [/block] [block:parameters] { "data": { "0-0": "name", "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-1": "string", "0-2": "Yes", "0-3": "Name of the field.", "1-0": "type.name", "1-1": "string", "1-2": "Yes", "1-3": "Type of the field.", "2-0": "type.operators.op", "2-1": "string", "2-2": "Yes", "2-3": "Name of the operation.", "3-0": "type.operators.displayName", "3-1": "string", "3-2": "Yes", "3-3": "Displayed name of the operation.", "4-0": "hidden", "4-1": "boolean", "4-2": "Yes", "4-3": "Whether the field is visible or not in MOCA Console.", "5-0": "displayName", "5-1": "string", "5-2": "Yes", "5-3": "Displayed name of the field.", "6-0": "index", "6-1": "integer", "6-2": "Yes", "6-3": "Index of the fueld, used for sorting.", "7-0": "category", "7-1": "string", "7-2": "Yes", "7-3": "Category of the field.", "8-0": "allowFreeInput", "8-1": "boolean", "8-2": "Yes", "8-3": "Whether free input values are allowed for this field.", "9-0": "custom", "9-1": "boolean", "9-2": "Yes", "9-3": "Whether this field is custom." }, "cols": 4, "rows": 10 } [/block] [block:code] { "codes": [ { "code": "{\n \"name\": \"lang\",\n \"type\": {\n \"name\": \"string\",\n \"operators\": [\n {\n \"op\": \"eq\",\n \"displayName\": \"is equal to\"\n },\n {\n \"op\": \"ne\",\n \"displayName\": \"is not equal to\"\n },\n {...}\n ]\n },\n \"hidden\": false,\n \"displayName\": \"Language\",\n \"index\": 0,\n \"category\": \"user\",\n \"allowFreeInput\": false,\n \"custom\": false\n}", "language": "json", "name": "Sample Field object" } ] } [/block]
[block:api-header] { "type": "basic", "title": "The Field Object" } [/block] [block:parameters] { "data": { "0-0": "name", "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-1": "string", "0-2": "Yes", "0-3": "Name of the field.", "1-0": "type.name", "1-1": "string", "1-2": "Yes", "1-3": "Type of the field.", "2-0": "type.operators.op", "2-1": "string", "2-2": "Yes", "2-3": "Name of the operation.", "3-0": "type.operators.displayName", "3-1": "string", "3-2": "Yes", "3-3": "Displayed name of the operation.", "4-0": "hidden", "4-1": "boolean", "4-2": "Yes", "4-3": "Whether the field is visible or not in MOCA Console.", "5-0": "displayName", "5-1": "string", "5-2": "Yes", "5-3": "Displayed name of the field.", "6-0": "index", "6-1": "integer", "6-2": "Yes", "6-3": "Index of the fueld, used for sorting.", "7-0": "category", "7-1": "string", "7-2": "Yes", "7-3": "Category of the field.", "8-0": "allowFreeInput", "8-1": "boolean", "8-2": "Yes", "8-3": "Whether free input values are allowed for this field.", "9-0": "custom", "9-1": "boolean", "9-2": "Yes", "9-3": "Whether this field is custom." }, "cols": 4, "rows": 10 } [/block] [block:code] { "codes": [ { "code": "{\n \"name\": \"lang\",\n \"type\": {\n \"name\": \"string\",\n \"operators\": [\n {\n \"op\": \"eq\",\n \"displayName\": \"is equal to\"\n },\n {\n \"op\": \"ne\",\n \"displayName\": \"is not equal to\"\n },\n {...}\n ]\n },\n \"hidden\": false,\n \"displayName\": \"Language\",\n \"index\": 0,\n \"category\": \"user\",\n \"allowFreeInput\": false,\n \"custom\": false\n}", "language": "json", "name": "Sample Field object" } ] } [/block]
{"_id":"5913147d86abb61b00ee5f3a","githubsync":"","parentDoc":null,"next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","title":"Get all fields","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","body":"","hidden":false,"link_external":false,"createdAt":"2017-05-10T13:24:13.106Z","excerpt":"Retrieves the list of all fields available.","order":1,"slug":"moca-api-get-fields","type":"get","__v":1,"category":"58e76f2a654e3839008655d7","sync_unique":"","updates":[],"api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"ref":"","in":"query","required":true,"desc":"The Id of the App where fields will be searched.","default":"","type":"string","name":"appId","_id":"55ae2019f302af23000ac0b8"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"name\": \"lang\",\n    \"type\": {\n      \"name\": \"string\",\n      \"operators\": [\n        {\n          \"op\": \"$eq\",\n          \"displayName\": \"is equal to\"\n        },\n        {\n          \"op\": \"$ne\",\n          \"displayName\": \"is not equal to\"\n        },\n        {...}\n      ]\n    },\n    \"displayName\": \"Language\",\n    \"category\": \"user\",\n    \"custom\": false,\n    \"hidden\": false,\n    \"allowFreeInput\": false,\n    \"index\": 0\n  },\n  {\n    \"name\": \"locationStatus\",\n    \"type\": {\n      \"name\": \"int\",\n      \"operators\": [{...}]\n    },\n    \"displayName\": \"Location permission\",\n    \"category\": \"user\",\n    \"custom\": false,\n    \"hidden\": false,\n    \"allowFreeInput\": false,\n    \"index\": 1\n  },\n  {...}\n]","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/fields/?appId=:appId"},"isReference":true,"link_url":"","childrenPages":[]}

getGet all fields

Retrieves the list of all fields available.

Query Params

appId:
required
string
The Id of the App where fields will be searched.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"5913154ec188f10f005032a5","api":{"method":"get","params":[{"desc":"Name of the field.","default":"","type":"string","name":"name","_id":"55b5e433c2e909190073eb02","ref":"","in":"path","required":true},{"_id":"5913169fb012b10f002bce34","ref":"","in":"query","required":true,"desc":"The Id of the App where fields will be searched.","default":"","type":"string","name":"appId"}],"results":{"codes":[{"name":"","code":"{\n  \"field\": {\n    \"name\": \"lang\",\n    \"type\": {\n      \"operators\": [\n        {\n          \"op\": \"$eq\",\n          \"displayName\": \"is equal to\"\n        },\n        {\n          \"op\": \"$ne\",\n          \"displayName\": \"is not equal to\"\n        },\n        {...}\n      ],\n      \"name\": \"string\"\n    },\n    \"displayName\": \"Language\",\n    \"category\": \"user\",\n    \"custom\": false,\n    \"hidden\": false,\n    \"allowFreeInput\": false,\n    \"index\": 0\n  },\n  \"values\": [\n    {\n      \"value\": \"af\",\n      \"label\": \"Afrikanns\",\n      \"index\": 0,\n      \"frequency\": 1\n    },\n    {\n      \"value\": \"ar\",\n      \"label\": \"Arabic\",\n      \"index\": 2,\n      \"frequency\": 3\n    },\n    {...}\n  ]\n}","language":"json","status":200},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401},{"code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Field not found\"\n}","language":"json","status":404}]},"settings":"","url":"/fields/:name?appId=:appId","auth":"required","examples":{"codes":[]}},"category":"58e76f2a654e3839008655d7","link_url":"","project":"559a61d2dbcfd20d00710b39","slug":"moca-api-get-field","updates":[],"user":"55a54dde9c32760d00ca78a8","body":"","githubsync":"","hidden":false,"link_external":false,"next":{"pages":[],"description":""},"order":2,"parentDoc":null,"sync_unique":"","__v":2,"createdAt":"2017-05-10T13:27:42.445Z","excerpt":"Retrieves the details of an existing Field, as well as the number of users that match each possible value.","title":"Get single field","version":"58e76f2a654e3839008655c8","isReference":true,"type":"get","childrenPages":[]}

getGet single field

Retrieves the details of an existing Field, as well as the number of users that match each possible value.

Path Params

name:
required
string
Name of the field.

Query Params

appId:
required
string
The Id of the App where fields will be searched.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"59131847f7be9625006146c8","category":"58e76f2a654e3839008655d7","createdAt":"2017-05-10T13:40:23.915Z","link_external":false,"order":3,"updates":[],"version":"58e76f2a654e3839008655c8","body":"","hidden":false,"isReference":true,"parentDoc":null,"type":"get","user":"55a54dde9c32760d00ca78a8","excerpt":"Retrieves the list of available field types.","githubsync":"","next":{"description":"","pages":[]},"project":"559a61d2dbcfd20d00710b39","title":"Get field types","__v":1,"api":{"method":"get","params":[],"results":{"codes":[{"language":"json","code":"[\n  {\n    \"name\": \"string\",\n    \"operators\": [\n      {\n        \"op\": \"$eq\",\n        \"displayName\": \"is equal to\"\n      },\n      {\n        \"op\": \"$ne\",\n        \"displayName\": \"is not equal to\"\n      },\n      {\n        \"op\": \"$in\",\n        \"displayName\": \"in\"\n      },\n      {\n        \"op\": \"$nin\",\n        \"displayName\": \"not in\"\n      },\n      {\n        \"op\": \"$like\",\n        \"displayName\": \"is like\"\n      },\n      {\n        \"op\": \"$matches\",\n        \"displayName\": \"matches\"\n      },\n      {\n        \"op\": \"$startsWith\",\n        \"displayName\": \"starts with\"\n      },\n      {\n        \"op\": \"$endsWith\",\n        \"displayName\": \"ends with\"\n      },\n      {\n        \"op\": \"$contains\",\n        \"displayName\": \"contains\"\n      }\n    ]\n  },\n  {\n    \"name\": \"int\",\n    \"operators\": [{...}]\n  },\n  {\n    \"name\": \"long\",\n    \"operators\": [{...}]\n  },\n  {...}\n]","name":"","status":200},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]},"settings":"","url":"/fields/types","auth":"required","examples":{"codes":[]}},"link_url":"","slug":"moca-api-get-field-types","sync_unique":"","childrenPages":[]}

getGet field types

Retrieves the list of available field types.


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"59131a1665888319004e6fcd","__v":0,"link_external":false,"link_url":"","hidden":false,"isReference":true,"order":0,"version":"58e76f2a654e3839008655c8","api":{"results":{"codes":[{"status":200,"name":"","code":"{}","language":"json"},{"code":"{}","language":"json","status":400,"name":""}]},"settings":"","auth":"required","params":[],"url":""},"createdAt":"2017-05-10T13:48:06.895Z","excerpt":"Tags represent an object to label things and persons.","slug":"moca-api-tags","sync_unique":"","title":"Overview","user":"55a54dde9c32760d00ca78a8","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Tag Object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"createdAt\",\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Mandatory?\",\n    \"h-3\": \"Description\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"2-0\": \"tagId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Tag identifier.\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the Tag.\",\n    \"5-0\": \"config.color\",\n    \"5-1\": \"string\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Color of the Tag.\",\n    \"6-0\": \"config.displayName\",\n    \"6-1\": \"string\",\n    \"6-2\": \"No\",\n    \"6-3\": \"Name that will be shown on MOCA Console analytics. If not defined, name will be used.\",\n    \"7-0\": \"config.hidden\",\n    \"7-1\": \"boolean\",\n    \"7-2\": \"No\",\n    \"7-3\": \"Whether the Tag will be shown on MOCA Console analytics.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last updated date (timestamp UTC).\",\n    \"3-0\": \"appId\",\n    \"3-2\": \"Autogenerated\",\n    \"3-1\": \"string\",\n    \"3-3\": \"Application key.\"\n  },\n  \"cols\": 4,\n  \"rows\": 8\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1494424180258,\\n  \\\"updatedAt\\\": 1494495034341,\\n  \\\"tagId\\\": \\\"zmwv_S-uR4K43rVg8kOC0A\\\",\\n  \\\"appId\\\": \\\"IXa7Bl9oRo6c7zQ5aQIzlg\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"mocahq:visitor\\\",\\n    \\\"color\\\": \\\"#ff0bdca8\\\",\\n    \\\"displayName\\\": \\\"Moca HQ Visitor\\\",\\n    \\\"hidden\\\": false\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Tag object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","githubsync":"","parentDoc":null,"project":"559a61d2dbcfd20d00710b39","category":"58e76f2a654e3839008655d8","next":{"pages":[],"description":""},"type":"basic","updates":[],"childrenPages":[]}

Overview

Tags represent an object to label things and persons.

[block:api-header] { "type": "basic", "title": "The Tag Object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "tagId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Tag identifier.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Tag.", "5-0": "config.color", "5-1": "string", "5-2": "No", "5-3": "Color of the Tag.", "6-0": "config.displayName", "6-1": "string", "6-2": "No", "6-3": "Name that will be shown on MOCA Console analytics. If not defined, name will be used.", "7-0": "config.hidden", "7-1": "boolean", "7-2": "No", "7-3": "Whether the Tag will be shown on MOCA Console analytics.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated date (timestamp UTC).", "3-0": "appId", "3-2": "Autogenerated", "3-1": "string", "3-3": "Application key." }, "cols": 4, "rows": 8 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494424180258,\n \"updatedAt\": 1494495034341,\n \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"config\": {\n \"name\": \"mocahq:visitor\",\n \"color\": \"#ff0bdca8\",\n \"displayName\": \"Moca HQ Visitor\",\n \"hidden\": false\n }\n}", "language": "json", "name": "Sample Tag object" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "The Tag Object" } [/block] [block:parameters] { "data": { "0-0": "createdAt", "h-0": "Name", "h-1": "Type", "h-2": "Mandatory?", "h-3": "Description", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "tagId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Tag identifier.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Tag.", "5-0": "config.color", "5-1": "string", "5-2": "No", "5-3": "Color of the Tag.", "6-0": "config.displayName", "6-1": "string", "6-2": "No", "6-3": "Name that will be shown on MOCA Console analytics. If not defined, name will be used.", "7-0": "config.hidden", "7-1": "boolean", "7-2": "No", "7-3": "Whether the Tag will be shown on MOCA Console analytics.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated date (timestamp UTC).", "3-0": "appId", "3-2": "Autogenerated", "3-1": "string", "3-3": "Application key." }, "cols": 4, "rows": 8 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494424180258,\n \"updatedAt\": 1494495034341,\n \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"config\": {\n \"name\": \"mocahq:visitor\",\n \"color\": \"#ff0bdca8\",\n \"displayName\": \"Moca HQ Visitor\",\n \"hidden\": false\n }\n}", "language": "json", "name": "Sample Tag object" } ], "sidebar": true } [/block]
{"_id":"591437adf865370f000b3a73","category":"58e76f2a654e3839008655d8","githubsync":"","isReference":true,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","excerpt":"Returns a list of all Tags across user's memberships, including Tags both owned and from other accounts this user was invited to. The Tags are returned in sorted order, with the most recent Tag appearing last.\n\nSupports paging.","hidden":false,"link_url":"","sync_unique":"","updates":[],"version":"58e76f2a654e3839008655c8","__v":0,"link_external":false,"order":1,"user":"55a54dde9c32760d00ca78a8","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"_id":"55ae2019f302af23000ac0b8","ref":"","in":"query","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset"},{"_id":"5912ff3569e10c2500eef2cf","ref":"","in":"query","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","default":"1000","type":"int","name":"limit"}],"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1494424180258,\n    \"updatedAt\": 1494495034341,\n    \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"config\": {\n      \"name\": \"mocahq:visitor\",\n      \"color\": \"#ff0bdca8\",\n      \"displayName\": \"Moca HQ Visitor\",\n      \"hidden\": false\n    }\n  }\n]","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/tags/?offset=:offset&limit=:limit"},"createdAt":"2017-05-11T10:06:37.642Z","next":{"pages":[],"description":""},"slug":"moca-api-get-tags","title":"Get all tags","type":"get","body":"","childrenPages":[]}

getGet all tags

Returns a list of all Tags across user's memberships, including Tags both owned and from other accounts this user was invited to. The Tags are returned in sorted order, with the most recent Tag appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"59143856964707190092f453","api":{"examples":{"codes":[]},"method":"get","params":[{"name":"tagId","ref":"","required":true,"type":"string","_id":"55ae2f1f2723e51900898fae","default":"","desc":"Requested tag Id.","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1494424180258,\n  \"updatedAt\": 1494495034341,\n  \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"mocahq:visitor\",\n    \"color\": \"#ff0bdca8\",\n    \"displayName\": \"Moca HQ Visitor\",\n    \"hidden\": false\n  }\n}","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","name":""},{"status":404,"language":"json","code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Tag not found\"\n}"}]},"settings":"","url":"/tags/:tagId","auth":"required"},"parentDoc":null,"title":"Get single tag","version":"58e76f2a654e3839008655c8","link_url":"","sync_unique":"","updates":[],"__v":0,"category":"58e76f2a654e3839008655d8","createdAt":"2017-05-11T10:09:26.211Z","excerpt":"Retrieves the details of an existing Tag.","isReference":true,"hidden":false,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-get-tag","type":"get","user":"55a54dde9c32760d00ca78a8","body":"","githubsync":"","link_external":false,"next":{"pages":[],"description":""},"order":2,"childrenPages":[]}

getGet single tag

Retrieves the details of an existing Tag.

Path Params

tagId:
required
string
Requested tag Id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"591438aa54e1f21b00f0f2b4","link_url":"","next":{"pages":[],"description":""},"order":3,"sync_unique":"","__v":0,"category":"58e76f2a654e3839008655d8","createdAt":"2017-05-11T10:10:50.106Z","isReference":true,"updates":[],"api":{"url":"/tags/search","auth":"required","examples":{"codes":[{"language":"json","code":"{\n\t\"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n\t\"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n\t\"name\": \"%mocahq%\",\n\t\"hidden\": false,\n\t\"includeDeleted\": true,\n\t\"offset\": 0,\n\t\"limit\": 10\n}"}]},"method":"post","params":[{"ref":"","required":false,"type":"string","_id":"58eb6b98bea9c5230084b6d7","default":"","desc":"Account Id where Tags will be searched.","in":"body","name":"accountId"},{"desc":"App Id where Tags will be searched.","in":"body","name":"appId","ref":"","required":false,"type":"string","_id":"58eb6b98bea9c5230084b6da","default":""},{"name":"name","ref":"","required":false,"type":"string","_id":"58eb6b98bea9c5230084b6d9","default":"","desc":"Tag name to be searched, use % as wildcard.","in":"body"},{"type":"string","_id":"5913035b58a5463700d3d8e2","default":"","desc":"Whether the returned tags are shown or hidden in MOCA Console analytics.","in":"body","name":"hidden","ref":"","required":false},{"default":"false","desc":"Include already deleted Tags in the search.","in":"body","name":"includeDeleted","ref":"","required":false,"type":"boolean","_id":"58eb6b98bea9c5230084b6d6"},{"in":"body","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset","_id":"58eb92157d463619003e294b","ref":""},{"required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","default":"1000","type":"int","name":"limit","_id":"58eb922e7d463619003e294c","ref":"","in":"body"}],"results":{"codes":[{"language":"json","status":200,"name":"","code":"[\n  {\n    \"createdAt\": 1494424180258,\n    \"updatedAt\": 1494495034341,\n    \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"config\": {\n      \"name\": \"mocahq:visitor\",\n      \"color\": \"#ff0bdca8\",\n      \"displayName\": \"Moca HQ Visitor\",\n      \"hidden\": false\n    }\n  }\n]"},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":""},"githubsync":"","slug":"moca-api-search-tags","type":"post","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","body":"","hidden":false,"link_external":false,"project":"559a61d2dbcfd20d00710b39","excerpt":"Returns a list of Tags that matched the requested criteria across user's memberships, including Tags both owned and from other accounts this user was invited to. The Tags are returned in sorted order, with the most recent Tag appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","parentDoc":null,"title":"Search tags","childrenPages":[]}

postSearch tags

Returns a list of Tags that matched the requested criteria across user's memberships, including Tags both owned and from other accounts this user was invited to. The Tags are returned in sorted order, with the most recent Tag appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Tags will be searched.
appId:
string
App Id where Tags will be searched.
name:
string
Tag name to be searched, use % as wildcard.
hidden:
string
Whether the returned tags are shown or hidden in MOCA Console analytics.
includeDeleted:
booleanfalse
Include already deleted Tags in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5914394b9f92950f0058038c","hidden":false,"link_url":"","parentDoc":null,"title":"Create new tag","type":"post","excerpt":"Creates a new Tag.","githubsync":"","version":"58e76f2a654e3839008655c8","__v":1,"project":"559a61d2dbcfd20d00710b39","updates":[],"next":{"pages":[],"description":""},"order":4,"sync_unique":"","body":"","createdAt":"2017-05-11T10:13:31.910Z","link_external":false,"slug":"moca-api-create-tag","user":"55a54dde9c32760d00ca78a8","api":{"auth":"required","examples":{"codes":[{"name":"Body","language":"json","code":"{\n\t\"name\": \"mocahq:visitor\",\n  \"displayName\": \"Moca HQ Visitor\",\n  \"color\": \"#ff0bdca8\",\n  \"hidden\": false\n}"}]},"method":"post","params":[{"_id":"5912fdc6f7be96250061442d","ref":"","in":"query","required":true,"desc":"Id of the App where the Tag will be created.","default":"","type":"string","name":"appId"},{"_id":"5912fdc6f7be96250061442c","ref":"","in":"body","required":true,"desc":"Name of the Tag.","default":"","type":"string","name":"name"},{"name":"color","_id":"5912fdc6f7be96250061442b","ref":"","in":"body","required":false,"desc":"Color of the Tag.","default":"","type":"string"},{"ref":"","in":"body","required":false,"desc":"Name that will be shown on MOCA Console analytics. If not defined, name will be used.","default":"","type":"string","name":"displayName","_id":"5912fdc6f7be96250061442a"},{"in":"body","required":false,"desc":"Whether the tag will be shown on MOCA Console analytics.","default":"false","type":"boolean","name":"hidden","_id":"591439fdbb92601b00a4fa33","ref":""}],"results":{"codes":[{"language":"json","code":"{\n  \"createdAt\": 1494424180258,\n  \"updatedAt\": 1494424180258,\n  \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"mocahq:visitor\",\n    \"color\": \"#ff0bdca8\",\n    \"displayName\": \"Moca HQ Visitor\",\n    \"hidden\": false\n  }\n}","name":"","status":201},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'appId' is not present\"\n}","name":""},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}","status":400,"language":"json"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/tags/?appId=:appId"},"category":"58e76f2a654e3839008655d8","isReference":true,"childrenPages":[]}

postCreate new tag

Creates a new Tag.

Query Params

appId:
required
string
Id of the App where the Tag will be created.

Body Params

name:
required
string
Name of the Tag.
color:
string
Color of the Tag.
displayName:
string
Name that will be shown on MOCA Console analytics. If not defined, name will be used.
hidden:
booleanfalse
Whether the tag will be shown on MOCA Console analytics.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59143a59534c341b00473090","githubsync":"","isReference":true,"link_url":"","next":{"pages":[],"description":""},"parentDoc":null,"category":"58e76f2a654e3839008655d8","updates":[],"project":"559a61d2dbcfd20d00710b39","title":"Update tag","user":"55a54dde9c32760d00ca78a8","__v":1,"createdAt":"2017-05-11T10:18:01.981Z","excerpt":"Updates an already existing Tag.","hidden":false,"link_external":false,"type":"put","version":"58e76f2a654e3839008655c8","api":{"examples":{"codes":[{"name":"Body","language":"json","code":"{\n\t\"name\": \"mocahq:visitor\",\n  \"displayName\": \"Moca HQ Visitor\",\n  \"color\": \"#ff0bdca8\",\n  \"hidden\": false\n}"}]},"method":"put","results":{"codes":[{"code":"{\n  \"createdAt\": 1494424180258,\n  \"updatedAt\": 1494424180258,\n  \"tagId\": \"zmwv_S-uR4K43rVg8kOC0A\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"mocahq:visitor\",\n    \"color\": \"#ff0bdca8\",\n    \"displayName\": \"Moca HQ Visitor\",\n    \"hidden\": false\n  }\n}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","auth":"required","params":[{"_id":"5912fdc6f7be96250061442d","ref":"","in":"path","required":true,"desc":"Id of the Tag to be updated.","default":"","type":"string","name":"tagId"},{"_id":"5912fdc6f7be96250061442c","ref":"","in":"body","required":true,"desc":"Name of the Tag.","default":"","type":"string","name":"name"},{"_id":"5912fdc6f7be96250061442b","ref":"","in":"body","required":false,"desc":"Color of the Tag.","default":"","type":"string","name":"color"},{"_id":"5912fdc6f7be96250061442a","ref":"","in":"body","required":false,"desc":"Name that will be shown on MOCA Console analytics. If not defined, name will be used.","default":"","type":"string","name":"displayName"},{"_id":"591439fdbb92601b00a4fa33","ref":"","in":"body","required":false,"desc":"Whether the tag will be shown on MOCA Console analytics.","default":"false","type":"boolean","name":"hidden"}],"url":"/tags/:tagId"},"body":"","order":5,"slug":"moca-api-update-tag","sync_unique":"","childrenPages":[]}

putUpdate tag

Updates an already existing Tag.

Path Params

tagId:
required
string
Id of the Tag to be updated.

Body Params

name:
required
string
Name of the Tag.
color:
string
Color of the Tag.
displayName:
string
Name that will be shown on MOCA Console analytics. If not defined, name will be used.
hidden:
booleanfalse
Whether the tag will be shown on MOCA Console analytics.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59143a93534c341b00473091","githubsync":"","link_url":"","slug":"moca-api-delete-tag","sync_unique":"","updates":[],"next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","__v":1,"body":"","createdAt":"2017-05-11T10:18:59.121Z","excerpt":"Deletes a Tag.","isReference":true,"type":"delete","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","parentDoc":null,"title":"Delete tag","api":{"results":{"codes":[{"status":204,"language":"json","code":"","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","name":""}]},"settings":"","url":"/tags/:tagId","auth":"required","examples":{"codes":[]},"method":"delete","params":[{"_id":"55ae2f1f2723e51900898fae","ref":"","in":"path","required":true,"desc":"Id of the Tag to be deleted.","default":"","type":"string","name":"tagId"}]},"category":"58e76f2a654e3839008655d8","hidden":false,"link_external":false,"order":6,"childrenPages":[]}

deleteDelete tag

Deletes a Tag.

Path Params

tagId:
required
string
Id of the Tag to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"59089cb426d4a839009e3322","version":"58e76f2a654e3839008655c8","createdAt":"2017-05-02T14:50:28.101Z","isReference":true,"next":{"description":"","pages":[]},"sync_unique":"","type":"basic","updates":[],"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Campaign Object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Obligatory?\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"createdAt\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"2-0\": \"campaignId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Campaign Identifier\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the Campaign.\",\n    \"5-0\": \"config.description\",\n    \"5-1\": \"string\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Description of the Campaign.\",\n    \"7-0\": \"config.startAt\",\n    \"7-1\": \"long\",\n    \"7-2\": \"Yes\",\n    \"7-3\": \"Campaign start date (timestamp UTC).\",\n    \"8-0\": \"config.endAt\",\n    \"8-1\": \"long\",\n    \"8-2\": \"Yes (For Proximity campaigns)\",\n    \"8-3\": \"Campaign end date (timestamp UTC).\",\n    \"9-0\": \"config.segmentId\",\n    \"9-1\": \"string\",\n    \"9-2\": \"No\",\n    \"9-3\": \"Id of the target segment.\",\n    \"15-0\": \"status\",\n    \"15-1\": \"string\",\n    \"15-2\": \"Autogenerated\",\n    \"15-3\": \"Current status of the campaign.\",\n    \"16-0\": \"statusAt\",\n    \"16-1\": \"long\",\n    \"16-2\": \"Autogenerated\",\n    \"16-3\": \"Last status update date (timestamp UTC).\",\n    \"11-0\": \"config.displayCap*\",\n    \"11-1\": \"integer\",\n    \"11-2\": \"No\",\n    \"11-3\": \"Maximum number of experiences that will be triggered within the Campaign.\",\n    \"12-0\": \"config.displayWaitMs*\",\n    \"12-1\": \"integer\",\n    \"12-2\": \"No\",\n    \"12-3\": \"Minimum delay between experiences triggered within the Campaign.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last modification date (timestamp UTC).\",\n    \"3-0\": \"appId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"Application id.\",\n    \"6-0\": \"config.type\",\n    \"6-1\": \"enum\",\n    \"6-2\": \"Yes\",\n    \"6-3\": \"Type of the Campaign. Valid values: Proximity, Push.\",\n    \"10-0\": \"config.groupId*\",\n    \"10-1\": \"string\",\n    \"10-2\": \"No\",\n    \"10-3\": \"Id of the Group this Campaign belongs to.\",\n    \"13-0\": \"config.recurrence.hoursOfDay\",\n    \"13-1\": \"array\",\n    \"13-2\": \"No\",\n    \"13-3\": \"Array of hours when the Campaign can be triggered. E.g. [1, 2] will cause the Campaign to trigger only if the time is between 01:00 and 02:59, or 01:XX or 02:XX.\",\n    \"14-0\": \"config.recurrence.daysOfWeek\",\n    \"14-1\": \"array\",\n    \"14-2\": \"No\",\n    \"14-3\": \"Array of days when the Campaign can be triggered. Sunday=1, Monday=2, up to Saturday=7\"\n  },\n  \"cols\": 4,\n  \"rows\": 17\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Advanced settings\",\n  \"body\": \"Fields marked with * will not be displayed in the response payload if not set.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1494402647390,\\n  \\\"updatedAt\\\": 1494498973170,\\n  \\\"appId\\\": \\\"IXa7Bl9oRo6c7zQ5aQIzlg\\\",\\n  \\\"campaignId\\\": \\\"dexNkpsVRPKdgkh6d6uDgg\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"HQ Office Welcome\\\",\\n    \\\"description\\\": \\\"Welcome experiences in our Office\\\",\\n    \\\"type\\\": \\\"Proximity\\\",\\n    \\\"startAt\\\": 1494403200000,\\n    \\\"endAt\\\": 1525939200000,\\n    \\\"segmentId\\\": \\\"fe9NBA8DRdCIDmmEhy3T2w\\\",\\n    \\\"displayCap\\\": 3,\\n    \\\"displayWaitMs\\\": 1800000\\n  },\\n  \\\"status\\\": \\\"New\\\",\\n  \\\"statusAt\\\": 1494498473833\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Campaign object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","hidden":false,"order":0,"parentDoc":null,"title":"Overview","__v":0,"githubsync":"","link_external":false,"link_url":"","project":"559a61d2dbcfd20d00710b39","user":"55a54dde9c32760d00ca78a8","api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]}},"category":"58e76f2a654e3839008655d1","excerpt":"Campaigns represent marketing campaigns within an app that take place in a period of time and usually target a segment of the users.","slug":"moca-api-campaigns","childrenPages":[]}

Overview

Campaigns represent marketing campaigns within an app that take place in a period of time and usually target a segment of the users.

[block:api-header] { "type": "basic", "title": "The Campaign Object" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-3": "Creation date (timestamp UTC).", "0-1": "long", "0-2": "Autogenerated", "2-0": "campaignId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Campaign Identifier", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Campaign.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the Campaign.", "7-0": "config.startAt", "7-1": "long", "7-2": "Yes", "7-3": "Campaign start date (timestamp UTC).", "8-0": "config.endAt", "8-1": "long", "8-2": "Yes (For Proximity campaigns)", "8-3": "Campaign end date (timestamp UTC).", "9-0": "config.segmentId", "9-1": "string", "9-2": "No", "9-3": "Id of the target segment.", "15-0": "status", "15-1": "string", "15-2": "Autogenerated", "15-3": "Current status of the campaign.", "16-0": "statusAt", "16-1": "long", "16-2": "Autogenerated", "16-3": "Last status update date (timestamp UTC).", "11-0": "config.displayCap*", "11-1": "integer", "11-2": "No", "11-3": "Maximum number of experiences that will be triggered within the Campaign.", "12-0": "config.displayWaitMs*", "12-1": "integer", "12-2": "No", "12-3": "Minimum delay between experiences triggered within the Campaign.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last modification date (timestamp UTC).", "3-0": "appId", "3-1": "string", "3-2": "Yes", "3-3": "Application id.", "6-0": "config.type", "6-1": "enum", "6-2": "Yes", "6-3": "Type of the Campaign. Valid values: Proximity, Push.", "10-0": "config.groupId*", "10-1": "string", "10-2": "No", "10-3": "Id of the Group this Campaign belongs to.", "13-0": "config.recurrence.hoursOfDay", "13-1": "array", "13-2": "No", "13-3": "Array of hours when the Campaign can be triggered. E.g. [1, 2] will cause the Campaign to trigger only if the time is between 01:00 and 02:59, or 01:XX or 02:XX.", "14-0": "config.recurrence.daysOfWeek", "14-1": "array", "14-2": "No", "14-3": "Array of days when the Campaign can be triggered. Sunday=1, Monday=2, up to Saturday=7" }, "cols": 4, "rows": 17 } [/block] [block:callout] { "type": "info", "title": "Advanced settings", "body": "Fields marked with * will not be displayed in the response payload if not set." } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494402647390,\n \"updatedAt\": 1494498973170,\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n \"config\": {\n \"name\": \"HQ Office Welcome\",\n \"description\": \"Welcome experiences in our Office\",\n \"type\": \"Proximity\",\n \"startAt\": 1494403200000,\n \"endAt\": 1525939200000,\n \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n \"displayCap\": 3,\n \"displayWaitMs\": 1800000\n },\n \"status\": \"New\",\n \"statusAt\": 1494498473833\n}", "language": "json", "name": "Sample Campaign object" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "The Campaign Object" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-3": "Creation date (timestamp UTC).", "0-1": "long", "0-2": "Autogenerated", "2-0": "campaignId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Campaign Identifier", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Campaign.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the Campaign.", "7-0": "config.startAt", "7-1": "long", "7-2": "Yes", "7-3": "Campaign start date (timestamp UTC).", "8-0": "config.endAt", "8-1": "long", "8-2": "Yes (For Proximity campaigns)", "8-3": "Campaign end date (timestamp UTC).", "9-0": "config.segmentId", "9-1": "string", "9-2": "No", "9-3": "Id of the target segment.", "15-0": "status", "15-1": "string", "15-2": "Autogenerated", "15-3": "Current status of the campaign.", "16-0": "statusAt", "16-1": "long", "16-2": "Autogenerated", "16-3": "Last status update date (timestamp UTC).", "11-0": "config.displayCap*", "11-1": "integer", "11-2": "No", "11-3": "Maximum number of experiences that will be triggered within the Campaign.", "12-0": "config.displayWaitMs*", "12-1": "integer", "12-2": "No", "12-3": "Minimum delay between experiences triggered within the Campaign.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last modification date (timestamp UTC).", "3-0": "appId", "3-1": "string", "3-2": "Yes", "3-3": "Application id.", "6-0": "config.type", "6-1": "enum", "6-2": "Yes", "6-3": "Type of the Campaign. Valid values: Proximity, Push.", "10-0": "config.groupId*", "10-1": "string", "10-2": "No", "10-3": "Id of the Group this Campaign belongs to.", "13-0": "config.recurrence.hoursOfDay", "13-1": "array", "13-2": "No", "13-3": "Array of hours when the Campaign can be triggered. E.g. [1, 2] will cause the Campaign to trigger only if the time is between 01:00 and 02:59, or 01:XX or 02:XX.", "14-0": "config.recurrence.daysOfWeek", "14-1": "array", "14-2": "No", "14-3": "Array of days when the Campaign can be triggered. Sunday=1, Monday=2, up to Saturday=7" }, "cols": 4, "rows": 17 } [/block] [block:callout] { "type": "info", "title": "Advanced settings", "body": "Fields marked with * will not be displayed in the response payload if not set." } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494402647390,\n \"updatedAt\": 1494498973170,\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n \"config\": {\n \"name\": \"HQ Office Welcome\",\n \"description\": \"Welcome experiences in our Office\",\n \"type\": \"Proximity\",\n \"startAt\": 1494403200000,\n \"endAt\": 1525939200000,\n \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n \"displayCap\": 3,\n \"displayWaitMs\": 1800000\n },\n \"status\": \"New\",\n \"statusAt\": 1494498473833\n}", "language": "json", "name": "Sample Campaign object" } ], "sidebar": true } [/block]
{"_id":"5914669448bffb1b00d42730","createdAt":"2017-05-11T13:26:44.966Z","isReference":true,"link_url":"","order":1,"parentDoc":null,"user":"55a54dde9c32760d00ca78a8","githubsync":"","slug":"moca-api-get-campaigns","sync_unique":"","title":"Get all campaigns","body":"","excerpt":"Returns a list of all Campaigns across user's memberships, including Campaigns both owned and from other accounts this user was invited to. The Campaigns are returned in sorted order, with the most recent Campaign appearing last.\n\nSupports paging.","link_external":false,"updates":[],"__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1494402647390,\n    \"updatedAt\": 1494498973170,\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n    \"config\": {\n      \"name\": \"HQ Office Welcome\",\n      \"description\": \"Welcome experiences in our Office\",\n      \"type\": \"Proximity\",\n      \"startAt\": 1494403200000,\n      \"endAt\": 1525939200000,\n      \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n      \"displayCap\": 3,\n      \"displayWaitMs\": 1800000\n    },\n    \"status\": \"New\",\n    \"statusAt\": 1494498473833\n  }\n]","name":""},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/campaigns/?offset=:offset&limit=:limit","auth":"required","examples":{"codes":[]},"method":"get","params":[{"_id":"58eb92062dd737230023dd4c","ref":"","in":"query","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned","default":"0","type":"int","name":"offset"},{"_id":"58eb92062dd737230023dd4b","ref":"","in":"query","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved","default":"1000","type":"int","name":"limit"}]},"category":"58e76f2a654e3839008655d1","hidden":false,"next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","type":"get","version":"58e76f2a654e3839008655c8","childrenPages":[]}

getGet all campaigns

Returns a list of all Campaigns across user's memberships, including Campaigns both owned and from other accounts this user was invited to. The Campaigns are returned in sorted order, with the most recent Campaign appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"5914659054e1f21b00f0f644","api":{"params":[{"default":"","desc":"Requested Campaign id.","in":"path","name":"campaignId","ref":"","required":true,"type":"string","_id":"55a8283172e7120d004ae67f"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1494402647390,\n  \"updatedAt\": 1494498973170,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"HQ Office Welcome\",\n    \"description\": \"Welcome experiences in our Office\",\n    \"type\": \"Proximity\",\n    \"startAt\": 1494403200000,\n    \"endAt\": 1525939200000,\n    \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n    \"displayCap\": 3,\n    \"displayWaitMs\": 1800000\n  },\n  \"status\": \"New\",\n  \"statusAt\": 1494498473833\n}","name":""},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","name":""},{"code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Campaign not found\"\n}","language":"json","status":404}]},"settings":"","url":"/campaigns/:campaignId","auth":"required","examples":{"codes":[]},"method":"get"},"next":{"pages":[],"description":""},"order":2,"type":"get","updates":[],"__v":0,"hidden":false,"isReference":true,"parentDoc":null,"title":"Get single campaign","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","excerpt":"Retrieves the details of an existing Campaign.","link_external":false,"link_url":"","project":"559a61d2dbcfd20d00710b39","sync_unique":"","body":"","category":"58e76f2a654e3839008655d1","createdAt":"2017-05-11T13:22:24.117Z","githubsync":"","slug":"moca-api-get-campaign","childrenPages":[]}

getGet single campaign

Retrieves the details of an existing Campaign.

Path Params

campaignId:
required
string
Requested Campaign id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"59146707964707190092f79c","order":3,"project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","createdAt":"2017-05-11T13:28:39.981Z","hidden":false,"isReference":true,"link_external":false,"next":{"pages":[],"description":""},"parentDoc":null,"updates":[],"__v":2,"api":{"examples":{"codes":[{"language":"json","code":"{\n\t\"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n\t\"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n\t\"name\": \"HQ Office Welcome\",\n\t\"description\": \"Welcome experiences in our Office\",\n\t\"type\": \"Proximity\",\n\t\"startAt\": 1494403200000,\n\t\"endAt\": 1525939200000,\n\t\"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n\t\"displayCap\": 3,\n\t\"displayWaitMs\": 1800000,\n\t\"status\": \"New\",\n\t\"includeDeleted\": true,\n\t\"offset\": 0,\n\t\"limit\": 10\n}"}]},"method":"post","params":[{"default":"","type":"string","name":"accountId","_id":"58eb6b98bea9c5230084b6d7","ref":"","in":"body","required":false,"desc":"Account Id where Campaigns will be searched."},{"default":"","type":"string","name":"appId","_id":"58eb6b98bea9c5230084b6da","ref":"","in":"body","required":false,"desc":"App Id where Campaigns will be searched."},{"in":"body","required":false,"desc":"Campaigns name to be searched, use % as wildcard.","default":"","type":"string","name":"name","_id":"58eb6b98bea9c5230084b6d9","ref":""},{"required":false,"desc":"Campaign description to be searched, use % as wildcard.","default":"","type":"string","name":"description","_id":"5913035b58a5463700d3d8e2","ref":"","in":"body"},{"ref":"","in":"body","required":false,"desc":"Type of the Campaign. Valid values: Proximity, Push.","default":"","type":"string","name":"type","_id":"59146aef48bffb1b00d4274f"},{"default":"","type":"long","name":"startAt","_id":"59146aef48bffb1b00d4274e","ref":"","in":"body","required":false,"desc":"Campaign start date (timestamp UTC)."},{"default":"","type":"long","name":"endAt","_id":"59146aef48bffb1b00d4274d","ref":"","in":"body","required":false,"desc":"Campaign end date (timestamp UTC)."},{"in":"body","required":false,"desc":"Id of the target segment.","default":"","type":"string","name":"segmentId","_id":"59146aef48bffb1b00d4274c","ref":""},{"desc":"Maximum number of experiences that will be triggered within the Campaign.","default":"","type":"int","name":"displayCap","_id":"59146aef48bffb1b00d4274b","ref":"","in":"body","required":false},{"name":"displayWaitMs","_id":"59146aef48bffb1b00d4274a","ref":"","in":"body","required":false,"desc":"Minimum delay between experiences triggered within the Campaign.","default":"","type":"long"},{"type":"string","name":"status","_id":"59146aef48bffb1b00d42749","ref":"","in":"body","required":false,"desc":"Current status of the Campaign.","default":""},{"in":"body","name":"includeDeleted","ref":"","required":false,"type":"boolean","_id":"58eb6b98bea9c5230084b6d6","default":"false","desc":"Include already deleted Campaigns in the search."},{"ref":"","in":"body","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset","_id":"58eb92157d463619003e294b"},{"default":"1000","type":"int","name":"limit","_id":"58eb922e7d463619003e294c","ref":"","in":"body","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved."}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"[\n  {\n    \"createdAt\": 1494402647390,\n    \"updatedAt\": 1494498973170,\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n    \"config\": {\n      \"name\": \"HQ Office Welcome\",\n      \"description\": \"Welcome experiences in our Office\",\n      \"type\": \"Proximity\",\n      \"startAt\": 1494403200000,\n      \"endAt\": 1525939200000,\n      \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n      \"displayCap\": 3,\n      \"displayWaitMs\": 1800000\n    },\n    \"status\": \"New\",\n    \"statusAt\": 1494498473833\n  }\n]"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/campaigns/search","auth":"required"},"body":"","excerpt":"Returns a list of Campaigns that matched the requested criteria across user's memberships, including Campaigns both owned and from other accounts this user was invited to. The Campaigns are returned in sorted order, with the most recent Campaign appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","link_url":"","category":"58e76f2a654e3839008655d1","githubsync":"","slug":"moca-api-search-campaigns","sync_unique":"","title":"Search campaigns","type":"post","user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

postSearch campaigns

Returns a list of Campaigns that matched the requested criteria across user's memberships, including Campaigns both owned and from other accounts this user was invited to. The Campaigns are returned in sorted order, with the most recent Campaign appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Campaigns will be searched.
appId:
string
App Id where Campaigns will be searched.
name:
string
Campaigns name to be searched, use % as wildcard.
description:
string
Campaign description to be searched, use % as wildcard.
type:
string
Type of the Campaign. Valid values: Proximity, Push.
startAt:
long
Campaign start date (timestamp UTC).
endAt:
long
Campaign end date (timestamp UTC).
segmentId:
string
Id of the target segment.
displayCap:
integer
Maximum number of experiences that will be triggered within the Campaign.
displayWaitMs:
long
Minimum delay between experiences triggered within the Campaign.
status:
string
Current status of the Campaign.
includeDeleted:
booleanfalse
Include already deleted Campaigns in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59146bdd964707190092f805","user":"55a54dde9c32760d00ca78a8","body":"","createdAt":"2017-05-11T13:49:17.808Z","hidden":false,"link_url":"","order":4,"slug":"moca-api-create-campaign","updates":[],"excerpt":"Creates a new Campaign.","isReference":true,"link_external":false,"title":"Create new campaign","version":"58e76f2a654e3839008655c8","githubsync":"","next":{"description":"","pages":[]},"project":"559a61d2dbcfd20d00710b39","sync_unique":"","type":"post","__v":7,"api":{"method":"post","params":[{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"Name of the Campaign.","default":"","type":"string","name":"name"},{"_id":"5913035b58a5463700d3d8e2","ref":"","in":"body","required":false,"desc":"Description of the Campaign.","default":"","type":"string","name":"description"},{"_id":"59146aef48bffb1b00d4274f","ref":"","in":"body","required":true,"desc":"Type of the Campaign. Valid values: Proximity, Push.","default":"","type":"string","name":"type"},{"_id":"59146aef48bffb1b00d4274e","ref":"","in":"body","required":true,"desc":"Campaign start date (timestamp UTC).","default":"","type":"long","name":"startAt"},{"_id":"59146aef48bffb1b00d4274d","ref":"","in":"body","required":false,"desc":"Campaign end date (timestamp UTC).","default":"","type":"long","name":"endAt"},{"_id":"59146aef48bffb1b00d4274c","ref":"","in":"body","required":false,"desc":"Id of the target segment.","default":"","type":"string","name":"segmentId"},{"_id":"59146aef48bffb1b00d4274b","ref":"","in":"body","required":false,"desc":"Maximum number of experiences that will be triggered within the Campaign.","default":"","type":"int","name":"displayCap"},{"_id":"59146aef48bffb1b00d4274a","ref":"","in":"body","required":false,"desc":"Minimum delay between experiences triggered within the Campaign.","default":"","type":"long","name":"displayWaitMs"},{"_id":"59146c8ea8a9e43100cf9017","ref":"","in":"query","required":true,"desc":"Id of the App where the Campaign will be created.","default":"","type":"string","name":"appId"},{"_id":"59d7317e24dfd7001c25a8f1","ref":"","in":"body","required":false,"desc":"Defines the hours of day and days of week when the campaign can be triggered.","default":"","type":"object","name":"recurrence"}],"results":{"codes":[{"status":201,"language":"json","code":"{\n  \"createdAt\": 1494402647390,\n  \"updatedAt\": 1494498973170,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"HQ Office Welcome\",\n\t  \"description\": \"Welcome experiences from Monday to Friday, 9-13h\",\n    \"type\": \"Proximity\",\n    \"startAt\": 1494403200000,\n    \"endAt\": 1525939200000,\n    \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n    \"displayCap\": 3,\n    \"displayWaitMs\": 1800000,\n    \"recurrence\": {\n      \"hoursOfDay\": [9, 10, 11, 12],\n      \"daysOfWeek\": [2, 3, 4, 5, 6]\n    }\n  },\n  \"status\": \"New\",\n  \"statusAt\": 1494498473833\n}","name":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}"},{"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401}]},"settings":"","url":"/campaigns/?appId=:appId","auth":"required","examples":{"codes":[{"code":"{\n\t\"name\": \"HQ Office Welcome\",\n\t\"description\": \"Welcome experiences from Monday to Friday, 9-13h\",\n\t\"type\": \"Proximity\",\n\t\"startAt\": 1494403200000,\n\t\"endAt\": 1525939200000,\n\t\"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n\t\"displayCap\": 3,\n\t\"displayWaitMs\": 1800000,\n  \"recurrence\": {\n    \"hoursOfDay\": [9, 10, 11, 12],\n    \"daysOfWeek\": [2, 3, 4, 5, 6]\n  }\n}","language":"json"}]}},"category":"58e76f2a654e3839008655d1","parentDoc":null,"childrenPages":[]}

postCreate new campaign

Creates a new Campaign.

Query Params

appId:
required
string
Id of the App where the Campaign will be created.

Body Params

name:
required
string
Name of the Campaign.
description:
string
Description of the Campaign.
type:
required
string
Type of the Campaign. Valid values: Proximity, Push.
startAt:
required
long
Campaign start date (timestamp UTC).
endAt:
long
Campaign end date (timestamp UTC).
segmentId:
string
Id of the target segment.
displayCap:
integer
Maximum number of experiences that will be triggered within the Campaign.
displayWaitMs:
long
Minimum delay between experiences triggered within the Campaign.
recurrence:
object
Defines the hours of day and days of week when the campaign can be triggered.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59146d66cbd52839002a30de","project":"559a61d2dbcfd20d00710b39","sync_unique":"","updates":[],"user":"55a54dde9c32760d00ca78a8","createdAt":"2017-05-11T13:55:50.916Z","hidden":false,"next":{"pages":[],"description":""},"order":5,"title":"Update campaign","type":"put","version":"58e76f2a654e3839008655c8","__v":2,"isReference":true,"link_external":false,"parentDoc":null,"githubsync":"","link_url":"","slug":"moca-api-update-campaign","body":"","category":"58e76f2a654e3839008655d1","excerpt":"Updates an already existing Campaign.","api":{"method":"put","params":[{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":false,"desc":"Name of the Campaign.","default":"","type":"string","name":"name"},{"_id":"5913035b58a5463700d3d8e2","ref":"","in":"body","required":false,"desc":"Description of the Campaign.","default":"","type":"string","name":"description"},{"_id":"59146aef48bffb1b00d4274f","ref":"","in":"body","required":false,"desc":"Type of the Campaign. Valid values: Proximity, Push.","default":"","type":"string","name":"type"},{"_id":"59146aef48bffb1b00d4274e","ref":"","in":"body","required":false,"desc":"Campaign start date (timestamp UTC).","default":"","type":"long","name":"startAt"},{"_id":"59146aef48bffb1b00d4274d","ref":"","in":"body","required":false,"desc":"Campaign end date (timestamp UTC).","default":"","type":"long","name":"endAt"},{"_id":"59146aef48bffb1b00d4274c","ref":"","in":"body","required":false,"desc":"Id of the target segment.","default":"","type":"string","name":"segmentId"},{"_id":"59146aef48bffb1b00d4274b","ref":"","in":"body","required":false,"desc":"Maximum number of experiences that will be triggered within the Campaign.","default":"","type":"int","name":"displayCap"},{"_id":"59146aef48bffb1b00d4274a","ref":"","in":"body","required":false,"desc":"Minimum delay between experiences triggered within the Campaign.","default":"","type":"long","name":"displayWaitMs"},{"_id":"59d64978ce9ec20030e9b6b3","ref":"","in":"path","required":true,"desc":"Id of the Campaign to be updated.","default":"","type":"string","name":"campaignId"},{"_id":"59d73459971587001aa3db04","ref":"","in":"body","required":false,"desc":"Defines the hours of day and days of week when the campaign can be triggered.","default":"","type":"object","name":"recurrence"}],"results":{"codes":[{"language":"json","code":"{\n  \"createdAt\": 1494402647390,\n  \"updatedAt\": 1494498973170,\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"HQ Office Welcome\",\n    \"description\": \"Welcome experiences in our Office\",\n    \"type\": \"Proximity\",\n    \"startAt\": 1494403200000,\n    \"endAt\": 1525939200000,\n    \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n    \"displayCap\": 3,\n    \"displayWaitMs\": 1800000,\n    \"recurrence\": {\n      \"hoursOfDay\": [9, 10, 11, 12],\n      \"daysOfWeek\": [2, 3, 4, 5, 6]\n    }\n  },\n  \"status\": \"New\",\n  \"statusAt\": 1494498473833\n}","name":"","status":200},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.config.name\": \"cannot be null\"\n  }\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/campaigns/:campaignId","auth":"required","examples":{"codes":[{"language":"json","code":"{\n\t\"name\": \"HQ Office Welcome\",\n\t\"description\": \"Welcome experiences in our Office\",\n\t\"type\": \"Proximity\",\n\t\"startAt\": 1494403200000,\n\t\"endAt\": 1525939200000,\n\t\"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n\t\"displayCap\": 3,\n\t\"displayWaitMs\": 1800000,\n  \"recurrence\": {\n    \"hoursOfDay\": [9, 10, 11, 12],\n    \"daysOfWeek\": [2, 3, 4, 5, 6]\n  }\n}"}]}},"childrenPages":[]}

putUpdate campaign

Updates an already existing Campaign.

Path Params

campaignId:
required
string
Id of the Campaign to be updated.

Body Params

name:
string
Name of the Campaign.
description:
string
Description of the Campaign.
type:
string
Type of the Campaign. Valid values: Proximity, Push.
startAt:
long
Campaign start date (timestamp UTC).
endAt:
long
Campaign end date (timestamp UTC).
segmentId:
string
Id of the target segment.
displayCap:
integer
Maximum number of experiences that will be triggered within the Campaign.
displayWaitMs:
long
Minimum delay between experiences triggered within the Campaign.
recurrence:
object
Defines the hours of day and days of week when the campaign can be triggered.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59146f1dcbd52839002a3103","version":"58e76f2a654e3839008655c8","__v":0,"api":{"settings":"","results":{"codes":[{"language":"json","status":204,"name":"","code":""},{"status":400,"name":"","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]},"method":"put","examples":{"codes":[]},"auth":"required","params":[{"default":"","type":"string","name":"campaignId","_id":"55ad163efb7b3c1900373a74","ref":"","in":"path","required":true,"desc":"Id of the Campaign to be started."}],"url":"/campaigns/:campaignId/start"},"category":"58e76f2a654e3839008655d1","user":"55a54dde9c32760d00ca78a8","sync_unique":"","title":"Start campaign","excerpt":"Starts a campaign.","order":6,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-start-campaign","updates":[],"createdAt":"2017-05-11T14:03:09.407Z","hidden":false,"link_external":false,"link_url":"","parentDoc":null,"type":"put","body":"","githubsync":"","isReference":true,"next":{"pages":[],"description":""},"childrenPages":[]}

putStart campaign

Starts a campaign.

Path Params

campaignId:
required
string
Id of the Campaign to be started.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"59146f44964707190092f82b","category":"58e76f2a654e3839008655d1","createdAt":"2017-05-11T14:03:48.471Z","githubsync":"","hidden":false,"link_url":"","sync_unique":"","user":"55a54dde9c32760d00ca78a8","__v":0,"parentDoc":null,"title":"Stop campaign","updates":[],"excerpt":"Stops a Campaign.","body":"","isReference":true,"next":{"pages":[],"description":""},"order":7,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-stop-campaign","type":"put","link_external":false,"version":"58e76f2a654e3839008655c8","api":{"params":[{"in":"path","required":true,"desc":"Id of the Campaign to be stopped.","default":"","type":"string","name":"campaignId","_id":"55ad163efb7b3c1900373a74","ref":""}],"url":"/campaigns/:campaignId/stop","examples":{"codes":[]},"method":"put","results":{"codes":[{"name":"","code":"","language":"json","status":204},{"status":400,"name":"","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]},"settings":"","auth":"required"},"childrenPages":[]}

putStop campaign

Stops a Campaign.

Path Params

campaignId:
required
string
Id of the Campaign to be stopped.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"59146ddec022e40f004903be","__v":1,"body":"","parentDoc":null,"link_url":"","project":"559a61d2dbcfd20d00710b39","type":"delete","category":"58e76f2a654e3839008655d1","excerpt":"Deletes a Campaign.","hidden":false,"isReference":true,"link_external":false,"sync_unique":"","version":"58e76f2a654e3839008655c8","updates":[],"api":{"params":[{"_id":"55a8283172e7120d004ae67f","ref":"","in":"path","required":true,"desc":"Id of the Campaign to be deleted.","default":"","type":"string","name":"campaignId"}],"results":{"codes":[{"status":204,"name":"","code":"","language":"json"},{"name":"","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/campaigns/:campaignId","auth":"required","examples":{"codes":[]},"method":"delete"},"createdAt":"2017-05-11T13:57:50.467Z","githubsync":"","next":{"pages":[],"description":""},"order":8,"slug":"moca-api-delete-campaign","title":"Delete campaign","user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

deleteDelete campaign

Deletes a Campaign.

Path Params

campaignId:
required
string
Id of the Campaign to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"59147e4d964707190092f9e0","user":"55a54dde9c32760d00ca78a8","__v":0,"category":"58e76f2a654e3839008655d4","excerpt":"Represents an event triggered by segment, time and proximity (such as beacons) conditions.","githubsync":"","link_external":false,"link_url":"","slug":"moca-api-experiences","createdAt":"2017-05-11T15:07:57.336Z","hidden":false,"next":{"pages":[],"description":""},"project":"559a61d2dbcfd20d00710b39","type":"basic","updates":[],"version":"58e76f2a654e3839008655c8","api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"code":"{}","language":"json","status":400,"name":""}]}},"isReference":true,"order":0,"parentDoc":null,"title":"Overview","body":"An Experience is composed of two components: The [trigger](doc:moca-api-triggers) and the [action](doc:moca-api-actions). The trigger defines when the experience is executed, based on defined conditions. The action is what is executed when the experience is triggered.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Experience Object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Obligatory?\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"createdAt\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"2-0\": \"experienceId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Experience identifier.\",\n    \"3-0\": \"campaignId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"The campaign id this experience belongs to.\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the experience.\",\n    \"5-0\": \"config.description\",\n    \"5-1\": \"string\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Description of the experience.\",\n    \"6-0\": \"config.repeat\",\n    \"6-1\": \"string\",\n    \"6-2\": \"Yes\",\n    \"6-3\": \"Repeat interval. The experience cannot be triggered twice in this lapse of time.\",\n    \"7-0\": \"config.enabled\",\n    \"7-1\": \"boolean\",\n    \"7-2\": \"No\",\n    \"7-3\": \"Indicates whether the experience is active or not.\",\n    \"9-0\": \"action\",\n    \"9-1\": \"[Action](doc:moca-api-actions)\",\n    \"9-2\": \"Yes\",\n    \"9-3\": \"Action object that defines what happens when the experience is triggered.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last updated time (timestamp UTC).\",\n    \"8-0\": \"trigger\",\n    \"8-1\": \"[Trigger](doc:moca-api-triggers)\",\n    \"8-2\": \"Yes\",\n    \"8-3\": \"Trigger object that defines when the experience is triggered.\"\n  },\n  \"cols\": 4,\n  \"rows\": 10\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Repeat\",\n  \"body\": \"Accepted values for the `config.repeat` field:\\n`Immediately`, `Never`, `After1Min`, `After3Min`, `After5Min`, `After15Min`, `After30Min`, `After1Hour`, `After2Hours`, `After4Hours`, `After8Hours`, `After12Hours`, `After24Hours`, `NextDay`, `After2Days`, `After3Days`, `After5Days`, `NextWeek`, `After2Weeks`, `NextMonth`, `After2Months`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1494507646115,\\n  \\\"updatedAt\\\": 1494508789757,\\n  \\\"experienceId\\\": \\\"EwMu6GDwRRuXXYbkktx--Q\\\",\\n  \\\"campaignId\\\": \\\"dexNkpsVRPKdgkh6d6uDgg\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"Enter MOCA HQ\\\",\\n    \\\"description\\\": \\\"Welcome message on arrival\\\",\\n    \\\"repeat\\\": \\\"NextDay\\\",\\n    \\\"enabled\\\": true\\n  },\\n  \\\"trigger\\\": {\\n    \\\"@type\\\": \\\"EnterPlaceTrigger\\\",\\n    \\\"placeId\\\": \\\"rzwbxsgXSRSxqdjSe7xZTQ\\\"\\n  },\\n  \\\"action\\\": {\\n    \\\"@type\\\": \\\"OpenUrlAction\\\",\\n    \\\"contentType\\\": \\\"text/x-url\\\",\\n    \\\"content\\\": {\\n      \\\"default\\\": \\\"http://www.mocaplatform.com\\\"\\n    },\\n    \\\"bgAlert\\\": {\\n      \\\"default\\\": \\\"Welcome to MOCA office!\\\"\\n    }\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Experience object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","sync_unique":"","childrenPages":[]}

Overview

Represents an event triggered by segment, time and proximity (such as beacons) conditions.

An Experience is composed of two components: The [trigger](doc:moca-api-triggers) and the [action](doc:moca-api-actions). The trigger defines when the experience is executed, based on defined conditions. The action is what is executed when the experience is triggered. [block:api-header] { "type": "basic", "title": "The Experience Object" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "experienceId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Experience identifier.", "3-0": "campaignId", "3-1": "string", "3-2": "Yes", "3-3": "The campaign id this experience belongs to.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the experience.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the experience.", "6-0": "config.repeat", "6-1": "string", "6-2": "Yes", "6-3": "Repeat interval. The experience cannot be triggered twice in this lapse of time.", "7-0": "config.enabled", "7-1": "boolean", "7-2": "No", "7-3": "Indicates whether the experience is active or not.", "9-0": "action", "9-1": "[Action](doc:moca-api-actions)", "9-2": "Yes", "9-3": "Action object that defines what happens when the experience is triggered.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated time (timestamp UTC).", "8-0": "trigger", "8-1": "[Trigger](doc:moca-api-triggers)", "8-2": "Yes", "8-3": "Trigger object that defines when the experience is triggered." }, "cols": 4, "rows": 10 } [/block] [block:callout] { "type": "info", "title": "Repeat", "body": "Accepted values for the `config.repeat` field:\n`Immediately`, `Never`, `After1Min`, `After3Min`, `After5Min`, `After15Min`, `After30Min`, `After1Hour`, `After2Hours`, `After4Hours`, `After8Hours`, `After12Hours`, `After24Hours`, `NextDay`, `After2Days`, `After3Days`, `After5Days`, `NextWeek`, `After2Weeks`, `NextMonth`, `After2Months`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494507646115,\n \"updatedAt\": 1494508789757,\n \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n \"config\": {\n \"name\": \"Enter MOCA HQ\",\n \"description\": \"Welcome message on arrival\",\n \"repeat\": \"NextDay\",\n \"enabled\": true\n },\n \"trigger\": {\n \"@type\": \"EnterPlaceTrigger\",\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n },\n \"action\": {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Welcome to MOCA office!\"\n }\n }\n}", "language": "json", "name": "Sample Experience object" } ], "sidebar": true } [/block]
An Experience is composed of two components: The [trigger](doc:moca-api-triggers) and the [action](doc:moca-api-actions). The trigger defines when the experience is executed, based on defined conditions. The action is what is executed when the experience is triggered. [block:api-header] { "type": "basic", "title": "The Experience Object" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "experienceId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Experience identifier.", "3-0": "campaignId", "3-1": "string", "3-2": "Yes", "3-3": "The campaign id this experience belongs to.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the experience.", "5-0": "config.description", "5-1": "string", "5-2": "No", "5-3": "Description of the experience.", "6-0": "config.repeat", "6-1": "string", "6-2": "Yes", "6-3": "Repeat interval. The experience cannot be triggered twice in this lapse of time.", "7-0": "config.enabled", "7-1": "boolean", "7-2": "No", "7-3": "Indicates whether the experience is active or not.", "9-0": "action", "9-1": "[Action](doc:moca-api-actions)", "9-2": "Yes", "9-3": "Action object that defines what happens when the experience is triggered.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated time (timestamp UTC).", "8-0": "trigger", "8-1": "[Trigger](doc:moca-api-triggers)", "8-2": "Yes", "8-3": "Trigger object that defines when the experience is triggered." }, "cols": 4, "rows": 10 } [/block] [block:callout] { "type": "info", "title": "Repeat", "body": "Accepted values for the `config.repeat` field:\n`Immediately`, `Never`, `After1Min`, `After3Min`, `After5Min`, `After15Min`, `After30Min`, `After1Hour`, `After2Hours`, `After4Hours`, `After8Hours`, `After12Hours`, `After24Hours`, `NextDay`, `After2Days`, `After3Days`, `After5Days`, `NextWeek`, `After2Weeks`, `NextMonth`, `After2Months`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494507646115,\n \"updatedAt\": 1494508789757,\n \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n \"config\": {\n \"name\": \"Enter MOCA HQ\",\n \"description\": \"Welcome message on arrival\",\n \"repeat\": \"NextDay\",\n \"enabled\": true\n },\n \"trigger\": {\n \"@type\": \"EnterPlaceTrigger\",\n \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n },\n \"action\": {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Welcome to MOCA office!\"\n }\n }\n}", "language": "json", "name": "Sample Experience object" } ], "sidebar": true } [/block]
{"_id":"5914842cc022e40f0049069a","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"EnterPlaceTrigger\"\n}\n[/block]\nTriggered when a user has not previously entered the place, and the first beacon from any zone that compose the place is detected.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"EnterPlaceTrigger\\\",\\n  \\\"placeId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"PlaceProximityTrigger\"\n}\n[/block]\nTriggered when a user gets in range of any beacon that belongs to the place and its proximity value changes to the indicated `proximity` for the first time.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"PlaceProximityTrigger\\\",\\n  \\\"placeId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\",\\n  \\\"proximity\\\": \\\"Near\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Proximity\",\n  \"body\": \"Valid proximity values are `Far`, `Near` and `Inmediate`, in descending order of distance to the beacon.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ExitPlaceTrigger\"\n}\n[/block]\nTriggered when the user has entered a place and then left. The place is considered as left when all the beacons within it are out of reach.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ExitPlaceTrigger\\\",\\n  \\\"placeId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"EnterZoneTrigger\"\n}\n[/block]\nTriggered when a user has not previously entered the zone, and the first beacon that compose the zone is detected.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"EnterZoneTrigger\\\",\\n  \\\"zoneId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ZoneProximityTrigger\"\n}\n[/block]\nTriggered when a user gets in range of any beacon that belongs to the zone and its proximity value changes to the indicated ´proximity´ for the first time.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ZoneProximityTrigger\\\",\\n  \\\"zoneId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\",\\n  \\\"proximity\\\": \\\"Near\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ExitZoneTrigger\"\n}\n[/block]\nTriggered when the user has entered a zone and then left. The zone is considered as left when all the beacons within it are out of reach.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ExitZoneTrigger\\\",\\n  \\\"zoneId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"EnterBeaconTrigger\"\n}\n[/block]\nTriggered when a user has not previously entered the beacon range, and the beacon is detected.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"EnterBeaconTrigger\\\",\\n  \\\"beaconId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"BeaconProximityTrigger\"\n}\n[/block]\nTriggered when a user gets in range of a beacon and its proximity value changes to the indicated ´proximity´ for the first time.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"BeaconProximityTrigger\\\",\\n  \\\"zoneId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\",\\n  \\\"proximity\\\": \\\"Near\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ExitBeaconTrigger\"\n}\n[/block]\nTriggered when the user has entered a beacon's range and then left.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ExitBeaconTrigger\\\",\\n  \\\"beaconId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CustomTrigger\"\n}\n[/block]\nWhen checked, this trigger invokes an app-provided custom callback. The callback is invoked with a provided string attribute and returns a boolean value of whether the trigger has been activated or not.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"CustomTrigger\\\",\\n  \\\"customArgument\\\": \\\"CustomTriggerCallback\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CompositeTrigger\"\n}\n[/block]\nA collection of triggers, fired when ALL children triggers are active.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"CompositeTrigger\\\",\\n  \\\"list\\\": [\\n    {\\n      \\\"@type\\\": \\\"ZoneProximityTrigger\\\",\\n      \\\"zoneId\\\": \\\"8Q9mI6TyKhGXIMvlz1jr7g\\\",\\n      \\\"proximity\\\": \\\"Near\\\"\\n    },\\n    {\\n      \\\"@type\\\": \\\"CustomTrigger\\\",\\n      \\\"customArgument\\\": \\\"CustomTriggerCallback\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","createdAt":"2017-05-11T15:33:00.140Z","excerpt":"Defines when an experience is activated based on proximity.","isReference":true,"type":"basic","__v":0,"link_external":false,"category":"58e76f2a654e3839008655d4","hidden":false,"link_url":"","parentDoc":null,"slug":"moca-api-triggers","sync_unique":"","title":"Triggers","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","api":{"settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"code":"{}","language":"json","status":400,"name":""}]},"auth":"required","params":[],"url":""},"githubsync":"","next":{"pages":[],"description":""},"order":1,"project":"559a61d2dbcfd20d00710b39","updates":[],"childrenPages":[]}

Triggers

Defines when an experience is activated based on proximity.

[block:api-header] { "type": "basic", "title": "EnterPlaceTrigger" } [/block] Triggered when a user has not previously entered the place, and the first beacon from any zone that compose the place is detected. [block:code] { "codes": [ { "code": "{\n \"@type\": \"EnterPlaceTrigger\",\n \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "PlaceProximityTrigger" } [/block] Triggered when a user gets in range of any beacon that belongs to the place and its proximity value changes to the indicated `proximity` for the first time. [block:code] { "codes": [ { "code": "{\n \"@type\": \"PlaceProximityTrigger\",\n \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n}", "language": "json" } ] } [/block] [block:callout] { "type": "info", "title": "Proximity", "body": "Valid proximity values are `Far`, `Near` and `Inmediate`, in descending order of distance to the beacon." } [/block] [block:api-header] { "type": "basic", "title": "ExitPlaceTrigger" } [/block] Triggered when the user has entered a place and then left. The place is considered as left when all the beacons within it are out of reach. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ExitPlaceTrigger\",\n \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "EnterZoneTrigger" } [/block] Triggered when a user has not previously entered the zone, and the first beacon that compose the zone is detected. [block:code] { "codes": [ { "code": "{\n \"@type\": \"EnterZoneTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ZoneProximityTrigger" } [/block] Triggered when a user gets in range of any beacon that belongs to the zone and its proximity value changes to the indicated ´proximity´ for the first time. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ZoneProximityTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ExitZoneTrigger" } [/block] Triggered when the user has entered a zone and then left. The zone is considered as left when all the beacons within it are out of reach. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ExitZoneTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "EnterBeaconTrigger" } [/block] Triggered when a user has not previously entered the beacon range, and the beacon is detected. [block:code] { "codes": [ { "code": "{\n \"@type\": \"EnterBeaconTrigger\",\n \"beaconId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "BeaconProximityTrigger" } [/block] Triggered when a user gets in range of a beacon and its proximity value changes to the indicated ´proximity´ for the first time. [block:code] { "codes": [ { "code": "{\n \"@type\": \"BeaconProximityTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ExitBeaconTrigger" } [/block] Triggered when the user has entered a beacon's range and then left. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ExitBeaconTrigger\",\n \"beaconId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CustomTrigger" } [/block] When checked, this trigger invokes an app-provided custom callback. The callback is invoked with a provided string attribute and returns a boolean value of whether the trigger has been activated or not. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CustomTrigger\",\n \"customArgument\": \"CustomTriggerCallback\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CompositeTrigger" } [/block] A collection of triggers, fired when ALL children triggers are active. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CompositeTrigger\",\n \"list\": [\n {\n \"@type\": \"ZoneProximityTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n },\n {\n \"@type\": \"CustomTrigger\",\n \"customArgument\": \"CustomTriggerCallback\"\n }\n ]\n}", "language": "json" } ] } [/block]
[block:api-header] { "type": "basic", "title": "EnterPlaceTrigger" } [/block] Triggered when a user has not previously entered the place, and the first beacon from any zone that compose the place is detected. [block:code] { "codes": [ { "code": "{\n \"@type\": \"EnterPlaceTrigger\",\n \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "PlaceProximityTrigger" } [/block] Triggered when a user gets in range of any beacon that belongs to the place and its proximity value changes to the indicated `proximity` for the first time. [block:code] { "codes": [ { "code": "{\n \"@type\": \"PlaceProximityTrigger\",\n \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n}", "language": "json" } ] } [/block] [block:callout] { "type": "info", "title": "Proximity", "body": "Valid proximity values are `Far`, `Near` and `Inmediate`, in descending order of distance to the beacon." } [/block] [block:api-header] { "type": "basic", "title": "ExitPlaceTrigger" } [/block] Triggered when the user has entered a place and then left. The place is considered as left when all the beacons within it are out of reach. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ExitPlaceTrigger\",\n \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "EnterZoneTrigger" } [/block] Triggered when a user has not previously entered the zone, and the first beacon that compose the zone is detected. [block:code] { "codes": [ { "code": "{\n \"@type\": \"EnterZoneTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ZoneProximityTrigger" } [/block] Triggered when a user gets in range of any beacon that belongs to the zone and its proximity value changes to the indicated ´proximity´ for the first time. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ZoneProximityTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ExitZoneTrigger" } [/block] Triggered when the user has entered a zone and then left. The zone is considered as left when all the beacons within it are out of reach. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ExitZoneTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "EnterBeaconTrigger" } [/block] Triggered when a user has not previously entered the beacon range, and the beacon is detected. [block:code] { "codes": [ { "code": "{\n \"@type\": \"EnterBeaconTrigger\",\n \"beaconId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "BeaconProximityTrigger" } [/block] Triggered when a user gets in range of a beacon and its proximity value changes to the indicated ´proximity´ for the first time. [block:code] { "codes": [ { "code": "{\n \"@type\": \"BeaconProximityTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ExitBeaconTrigger" } [/block] Triggered when the user has entered a beacon's range and then left. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ExitBeaconTrigger\",\n \"beaconId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CustomTrigger" } [/block] When checked, this trigger invokes an app-provided custom callback. The callback is invoked with a provided string attribute and returns a boolean value of whether the trigger has been activated or not. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CustomTrigger\",\n \"customArgument\": \"CustomTriggerCallback\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CompositeTrigger" } [/block] A collection of triggers, fired when ALL children triggers are active. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CompositeTrigger\",\n \"list\": [\n {\n \"@type\": \"ZoneProximityTrigger\",\n \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n \"proximity\": \"Near\"\n },\n {\n \"@type\": \"CustomTrigger\",\n \"customArgument\": \"CustomTriggerCallback\"\n }\n ]\n}", "language": "json" } ] } [/block]
{"_id":"59148412bb92601b00a502ed","link_external":false,"link_url":"","title":"Actions","type":"basic","__v":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"SendLocalMessageAction\"\n}\n[/block]\nShows a local push message with plain text.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"SendLocalMessageAction\\\",\\n  \\\"contentType\\\": \\\"text/plain\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"Come in and check out our new products!\\\"\\n  },\\n  \\\"bgAlert\\\": {}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowHtmlAction\"\n}\n[/block]\nShows a local push message with HTML code.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowHtmlAction\\\",\\n  \\\"contentType\\\": \\\"text/html\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"<style>\\\\\\\\\\\\nbody {\\\\\\\\\\\\n\\\\\\\\tbackground-color: #dddddd;\\\\\\\\\\\\n\\\\\\\\ttext-align: center;\\\\\\\\\\\\n\\\\\\\\tfont-family: \\\\\\\"futura\\\\\\\";\\\\\\\\\\\\n\\\\\\\\tfont-size: 20px;\\\\\\\\\\\\n}\\\\\\\\\\\\n.logo {\\\\\\\\\\\\n\\\\\\\\twidth: 100%;\\\\\\\\\\\\n}\\\\\\\\\\\\n.title {\\\\\\\\\\\\n\\\\\\\\tfont-size: 1.25em;\\\\\\\\\\\\n\\\\\\\\tcolor: black;\\\\\\\\\\\\n}\\\\\\\\\\\\n.wrapper {\\\\\\\\\\\\n\\\\\\\\tmargin: 10% 5%;\\\\\\\\\\\\n}\\\\\\\\\\\\n.button {\\\\\\\\\\\\n\\\\\\\\tmargin: 0 2.5%;\\\\\\\\\\\\n\\\\\\\\tpadding: 10px 0;\\\\\\\\\\\\n\\\\\\\\twidth: 45%;\\\\\\\\\\\\n\\\\\\\\tbackground: #bf0d3f;\\\\\\\\\\\\n\\\\\\\\tborder-radius: 5px;\\\\\\\\\\\\n\\\\\\\\tfloat: left;\\\\\\\\\\\\n}\\\\\\\\\\\\na {\\\\\\\\\\\\n\\\\\\\\tcolor: white;\\\\\\\\\\\\n}\\\\\\\\\\\\n</style>\\\\\\\\\\\\n<div>\\\\\\\\\\\\n\\\\\\\\t<img class=\\\\\\\"logo\\\\\\\" src=\\\\\\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\\\\\"/>\\\\\\\\\\\\n</div>\\\\\\\\\\\\n<div class=\\\\\\\"title\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t<B>WELCOME TO MOCA PLATFORM</B>\\\\\\\\\\\\n</div>\\\\\\\\\\\\n<div class=\\\\\\\"wrapper\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t<a href=\\\\\\\"http://mocaplatform.com/\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t\\\\\\\\t<div class=\\\\\\\"button\\\\\\\">Go to web</div>\\\\\\\\\\\\n\\\\\\\\t</a>\\\\\\\\\\\\n\\\\\\\\t<a href=\\\\\\\"mocasdk://closeme\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t\\\\\\\\t<div class=\\\\\\\"button\\\\\\\">Dismiss</div>\\\\\\\\\\\\n\\\\\\\\t</a>\\\\\\\\\\\\n</div>\\\\\\\\\\\\n\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"Welcome to MOCA!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Background Alert\",\n  \"body\": \"If the App is not in foreground, the message in `bgAlert` will be shown as a notification. When the user opens it, the HTML message will be shown.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Content length\",\n  \"body\": \"The maximum allowed size for a message is 50kb\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowImageAction\"\n}\n[/block]\nShows a local push message with an image.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowImageAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"Image!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowVideoAction\"\n}\n[/block]\nShows a local push message with video.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowVideoAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"http://www.your-site.com/your-video-url\\\"\\n  },\\n  \\\"bgAlert\\\": {}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"PlaySoundAction\"\n}\n[/block]\nPlays a sound file from the application package.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"PlaySoundAction\\\",\\n  \\\"contentType\\\": \\\"text/plain\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"my-sound.wav\\\"\\n  },\\n  \\\"bgAlert\\\": {}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"OpenUrlAction\"\n}\n[/block]\nOpens a URL.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"OpenUrlAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"http://www.mocaplatform.com\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"Check our website!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowCardAction\"\n}\n[/block]\nThis action enables you to deliver loyalty cards, event tickets, discount coupons or custom cards to your users from Passbook, Google Wallet and similar.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowCardAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"http://www.your-site.com/your-passcard-url.pkpass\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"You have a new card available. Open it now?\\\"\\n  },\\n  \\\"cardProvider\\\": \\\"apple-passbook\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"TagAction\"\n}\n[/block]\nAdds a tag to the user. You can optionally add a value for the tag (Accepted values are numbers preceded by a plus sign, a minus sign, or none)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"TagAction\\\",\\n  \\\"tagName\\\": \\\"EntranceTag\\\",\\n  \\\"actionValue\\\": \\\"+2\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CustomAction\"\n}\n[/block]\nWhen fired, this action invokes an app-developer provided custom callback. The callback is invoked with a provided string attribute.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"CustomAction\\\",\\n  \\\"customArgument\\\": \\\"CustomActionCallback\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CompositeAction\"\n}\n[/block]\nA collection of actions. All children actions are executed when the experience is triggered.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"CompositeAction\\\",\\n  \\\"list\\\": [\\n    {\\n      \\\"@type\\\": \\\"OpenUrlAction\\\",\\n      \\\"contentType\\\": \\\"text/x-url\\\",\\n      \\\"content\\\": {\\n        \\\"default\\\": \\\"http://www.mocaplatform.com\\\"\\n      },\\n      \\\"bgAlert\\\": {\\n        \\\"default\\\": \\\"Check our website!\\\"\\n      }\\n    },\\n    {\\n      \\\"@type\\\": \\\"PlaySoundAction\\\",\\n      \\\"contentType\\\": \\\"text/plain\\\",\\n      \\\"content\\\": {\\n        \\\"default\\\": \\\"my-sound.wav\\\"\\n      },\\n      \\\"bgAlert\\\": {}\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"Defines what action is executed when an experience is triggered.","user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d4","githubsync":"","slug":"moca-api-actions","parentDoc":null,"project":"559a61d2dbcfd20d00710b39","updates":[],"version":"58e76f2a654e3839008655c8","createdAt":"2017-05-11T15:32:34.798Z","hidden":false,"isReference":true,"next":{"pages":[],"description":""},"api":{"settings":"","results":{"codes":[{"status":200,"name":"","code":"{}","language":"json"},{"name":"","code":"{}","language":"json","status":400}]},"auth":"required","params":[],"url":""},"order":2,"sync_unique":"","childrenPages":[]}

Actions

Defines what action is executed when an experience is triggered.

[block:api-header] { "type": "basic", "title": "SendLocalMessageAction" } [/block] Shows a local push message with plain text. [block:code] { "codes": [ { "code": "{\n \"@type\": \"SendLocalMessageAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"Come in and check out our new products!\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowHtmlAction" } [/block] Shows a local push message with HTML code. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowHtmlAction\",\n \"contentType\": \"text/html\",\n \"content\": {\n \"default\": \"<style>\\\\\\nbody {\\\\\\n\\\\tbackground-color: #dddddd;\\\\\\n\\\\ttext-align: center;\\\\\\n\\\\tfont-family: \\\"futura\\\";\\\\\\n\\\\tfont-size: 20px;\\\\\\n}\\\\\\n.logo {\\\\\\n\\\\twidth: 100%;\\\\\\n}\\\\\\n.title {\\\\\\n\\\\tfont-size: 1.25em;\\\\\\n\\\\tcolor: black;\\\\\\n}\\\\\\n.wrapper {\\\\\\n\\\\tmargin: 10% 5%;\\\\\\n}\\\\\\n.button {\\\\\\n\\\\tmargin: 0 2.5%;\\\\\\n\\\\tpadding: 10px 0;\\\\\\n\\\\twidth: 45%;\\\\\\n\\\\tbackground: #bf0d3f;\\\\\\n\\\\tborder-radius: 5px;\\\\\\n\\\\tfloat: left;\\\\\\n}\\\\\\na {\\\\\\n\\\\tcolor: white;\\\\\\n}\\\\\\n</style>\\\\\\n<div>\\\\\\n\\\\t<img class=\\\"logo\\\" src=\\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\"/>\\\\\\n</div>\\\\\\n<div class=\\\"title\\\">\\\\\\n\\\\t<B>WELCOME TO MOCA PLATFORM</B>\\\\\\n</div>\\\\\\n<div class=\\\"wrapper\\\">\\\\\\n\\\\t<a href=\\\"http://mocaplatform.com/\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Go to web</div>\\\\\\n\\\\t</a>\\\\\\n\\\\t<a href=\\\"mocasdk://closeme\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Dismiss</div>\\\\\\n\\\\t</a>\\\\\\n</div>\\\\\\n\"\n },\n \"bgAlert\": {\n \"default\": \"Welcome to MOCA!\"\n }\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Background Alert", "body": "If the App is not in foreground, the message in `bgAlert` will be shown as a notification. When the user opens it, the HTML message will be shown." } [/block] [block:callout] { "type": "danger", "title": "Content length", "body": "The maximum allowed size for a message is 50kb" } [/block] [block:api-header] { "type": "basic", "title": "ShowImageAction" } [/block] Shows a local push message with an image. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowImageAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\"\n },\n \"bgAlert\": {\n \"default\": \"Image!\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowVideoAction" } [/block] Shows a local push message with video. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowVideoAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.your-site.com/your-video-url\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "PlaySoundAction" } [/block] Plays a sound file from the application package. [block:code] { "codes": [ { "code": "{\n \"@type\": \"PlaySoundAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"my-sound.wav\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "OpenUrlAction" } [/block] Opens a URL. [block:code] { "codes": [ { "code": "{\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Check our website!\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowCardAction" } [/block] This action enables you to deliver loyalty cards, event tickets, discount coupons or custom cards to your users from Passbook, Google Wallet and similar. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowCardAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.your-site.com/your-passcard-url.pkpass\"\n },\n \"bgAlert\": {\n \"default\": \"You have a new card available. Open it now?\"\n },\n \"cardProvider\": \"apple-passbook\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "TagAction" } [/block] Adds a tag to the user. You can optionally add a value for the tag (Accepted values are numbers preceded by a plus sign, a minus sign, or none) [block:code] { "codes": [ { "code": "{\n \"@type\": \"TagAction\",\n \"tagName\": \"EntranceTag\",\n \"actionValue\": \"+2\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CustomAction" } [/block] When fired, this action invokes an app-developer provided custom callback. The callback is invoked with a provided string attribute. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CustomAction\",\n \"customArgument\": \"CustomActionCallback\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CompositeAction" } [/block] A collection of actions. All children actions are executed when the experience is triggered. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CompositeAction\",\n \"list\": [\n {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Check our website!\"\n }\n },\n {\n \"@type\": \"PlaySoundAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"my-sound.wav\"\n },\n \"bgAlert\": {}\n }\n ]\n}", "language": "json" } ] } [/block]
[block:api-header] { "type": "basic", "title": "SendLocalMessageAction" } [/block] Shows a local push message with plain text. [block:code] { "codes": [ { "code": "{\n \"@type\": \"SendLocalMessageAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"Come in and check out our new products!\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowHtmlAction" } [/block] Shows a local push message with HTML code. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowHtmlAction\",\n \"contentType\": \"text/html\",\n \"content\": {\n \"default\": \"<style>\\\\\\nbody {\\\\\\n\\\\tbackground-color: #dddddd;\\\\\\n\\\\ttext-align: center;\\\\\\n\\\\tfont-family: \\\"futura\\\";\\\\\\n\\\\tfont-size: 20px;\\\\\\n}\\\\\\n.logo {\\\\\\n\\\\twidth: 100%;\\\\\\n}\\\\\\n.title {\\\\\\n\\\\tfont-size: 1.25em;\\\\\\n\\\\tcolor: black;\\\\\\n}\\\\\\n.wrapper {\\\\\\n\\\\tmargin: 10% 5%;\\\\\\n}\\\\\\n.button {\\\\\\n\\\\tmargin: 0 2.5%;\\\\\\n\\\\tpadding: 10px 0;\\\\\\n\\\\twidth: 45%;\\\\\\n\\\\tbackground: #bf0d3f;\\\\\\n\\\\tborder-radius: 5px;\\\\\\n\\\\tfloat: left;\\\\\\n}\\\\\\na {\\\\\\n\\\\tcolor: white;\\\\\\n}\\\\\\n</style>\\\\\\n<div>\\\\\\n\\\\t<img class=\\\"logo\\\" src=\\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\"/>\\\\\\n</div>\\\\\\n<div class=\\\"title\\\">\\\\\\n\\\\t<B>WELCOME TO MOCA PLATFORM</B>\\\\\\n</div>\\\\\\n<div class=\\\"wrapper\\\">\\\\\\n\\\\t<a href=\\\"http://mocaplatform.com/\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Go to web</div>\\\\\\n\\\\t</a>\\\\\\n\\\\t<a href=\\\"mocasdk://closeme\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Dismiss</div>\\\\\\n\\\\t</a>\\\\\\n</div>\\\\\\n\"\n },\n \"bgAlert\": {\n \"default\": \"Welcome to MOCA!\"\n }\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Background Alert", "body": "If the App is not in foreground, the message in `bgAlert` will be shown as a notification. When the user opens it, the HTML message will be shown." } [/block] [block:callout] { "type": "danger", "title": "Content length", "body": "The maximum allowed size for a message is 50kb" } [/block] [block:api-header] { "type": "basic", "title": "ShowImageAction" } [/block] Shows a local push message with an image. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowImageAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\"\n },\n \"bgAlert\": {\n \"default\": \"Image!\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowVideoAction" } [/block] Shows a local push message with video. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowVideoAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.your-site.com/your-video-url\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "PlaySoundAction" } [/block] Plays a sound file from the application package. [block:code] { "codes": [ { "code": "{\n \"@type\": \"PlaySoundAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"my-sound.wav\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "OpenUrlAction" } [/block] Opens a URL. [block:code] { "codes": [ { "code": "{\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Check our website!\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowCardAction" } [/block] This action enables you to deliver loyalty cards, event tickets, discount coupons or custom cards to your users from Passbook, Google Wallet and similar. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowCardAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.your-site.com/your-passcard-url.pkpass\"\n },\n \"bgAlert\": {\n \"default\": \"You have a new card available. Open it now?\"\n },\n \"cardProvider\": \"apple-passbook\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "TagAction" } [/block] Adds a tag to the user. You can optionally add a value for the tag (Accepted values are numbers preceded by a plus sign, a minus sign, or none) [block:code] { "codes": [ { "code": "{\n \"@type\": \"TagAction\",\n \"tagName\": \"EntranceTag\",\n \"actionValue\": \"+2\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CustomAction" } [/block] When fired, this action invokes an app-developer provided custom callback. The callback is invoked with a provided string attribute. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CustomAction\",\n \"customArgument\": \"CustomActionCallback\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CompositeAction" } [/block] A collection of actions. All children actions are executed when the experience is triggered. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CompositeAction\",\n \"list\": [\n {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Check our website!\"\n }\n },\n {\n \"@type\": \"PlaySoundAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"my-sound.wav\"\n },\n \"bgAlert\": {}\n }\n ]\n}", "language": "json" } ] } [/block]
{"_id":"5914874ef865370f000b439c","githubsync":"","link_external":false,"link_url":"","updates":[],"excerpt":"Returns a list of all Experiences across user's memberships, including Experiences both owned and from other accounts this user was invited to. The Experiences are returned in sorted order, with the most recent Experience appearing last.\n\nSupports paging.","order":3,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-get-experiences","sync_unique":"","type":"get","title":"Get all experiences","__v":0,"api":{"examples":{"codes":[]},"method":"get","params":[{"required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned","default":"0","type":"int","name":"offset","_id":"58eb92062dd737230023dd4c","ref":"","in":"query"},{"type":"int","name":"limit","_id":"58eb92062dd737230023dd4b","ref":"","in":"query","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved","default":"1000"}],"results":{"codes":[{"name":"","code":"[\n  {\n    \"createdAt\": 1494507646115,\n    \"updatedAt\": 1494508789757,\n    \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n    \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n    \"config\": {\n      \"name\": \"Enter MOCA HQ\",\n      \"description\": \"Welcome message on arrival\",\n      \"repeat\": \"NextDay\",\n      \"enabled\": true\n    },\n    \"trigger\": {\n      \"@type\": \"EnterPlaceTrigger\",\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n    },\n    \"action\": {\n      \"@type\": \"OpenUrlAction\",\n      \"contentType\": \"text/x-url\",\n      \"content\": {\n        \"default\": \"http://www.mocaplatform.com\"\n      },\n      \"bgAlert\": {\n        \"default\": \"Welcome to MOCA office!\"\n      }\n    }\n  }\n]","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/experiences/?offset=:offset&limit=:limit","auth":"required"},"body":"","category":"58e76f2a654e3839008655d4","hidden":false,"isReference":true,"next":{"description":"","pages":[]},"user":"55a54dde9c32760d00ca78a8","createdAt":"2017-05-11T15:46:22.068Z","version":"58e76f2a654e3839008655c8","childrenPages":[]}

getGet all experiences

Returns a list of all Experiences across user's memberships, including Experiences both owned and from other accounts this user was invited to. The Experiences are returned in sorted order, with the most recent Experience appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"591489cc181ad40f008f22b7","createdAt":"2017-05-11T15:57:00.074Z","excerpt":"Retrieves the details of an existing Experience.","githubsync":"","hidden":false,"isReference":true,"project":"559a61d2dbcfd20d00710b39","title":"Get single experience","category":"58e76f2a654e3839008655d4","link_external":false,"order":4,"parentDoc":null,"version":"58e76f2a654e3839008655c8","api":{"method":"get","params":[{"desc":"Requested Experience id.","default":"","type":"string","name":"experienceId","_id":"55ae008c8576b92300291c26","ref":"","in":"path","required":true}],"results":{"codes":[{"code":"{\n  \"createdAt\": 1424351489581,\n  \"experienceId\": \"PT7Swn6QcTw0dY6-sMAgJQ\",\n  \"appKey\": \"AeZQ_Wm9iW2v7QgvdTtmx1\",\n  \"config\": {\n    \"category\": null,\n    \"description\": null,\n    \"name\": \"Enter Place Demo\",\n    \"repeat\": \"NextDay\",\n    \"updatedAt\": 1424351489582,\n    \"enabled\": true,\n    \"exactlyOnce\": false\n  },\n  \"campaignId\": \"klyRDN-RPe7wcaAsNJ5LLQ\",\n  \"segmentId\": null,\n  \"action\": {\n    \"@type\": \"SendLocalMessageAction\",\n    \"contentType\": \"text/plain\",\n    \"content\": {\n      \"default\": \"Welcome to our Office!\"\n    },\n    \"bgAlert\": {}\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n  }\n}","language":"json","status":200,"name":""},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"},{"status":404,"language":"json","code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Experience not found\"\n}"}]},"settings":"","url":"/experiences/:experienceId","auth":"required","examples":{"codes":[]}},"sync_unique":"","updates":[],"__v":0,"body":"","link_url":"","next":{"pages":[],"description":""},"slug":"moca-api-get-experience","type":"get","user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

getGet single experience

Retrieves the details of an existing Experience.

Path Params

experienceId:
required
string
Requested Experience id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"59148a3c9391f23b00208a8f","sync_unique":"","updates":[],"user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","body":"","excerpt":"Returns a list of Experiences that matched the requested criteria across user's memberships, including Experiences both owned and from other accounts this user was invited to. The Experiences are returned in sorted order, with the most recent Experience appearing last.\n\nAny combination of filters can be used, none are required.\n\nSupports paging.","hidden":false,"order":5,"slug":"moca-api-search-experiences","title":"Search experiences","type":"post","__v":1,"githubsync":"","link_external":false,"link_url":"","api":{"auth":"required","examples":{"codes":[{"code":"{\n\t\"accountId\": \"TAPFXFowToO4dFsktFzz9Q\",\n\t\"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n\t\"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n\t\"name\": \"%MOCA%\",\n\t\"includeDeleted\": true,\n\t\"offset\": 0,\n\t\"limit\": 10\n}","language":"json"}]},"method":"post","params":[{"type":"string","name":"accountId","_id":"58eb6b98bea9c5230084b6d7","ref":"","in":"body","required":false,"desc":"Account Id where Experiences will be searched.","default":""},{"desc":"App Id where Experiences will be searched.","default":"","type":"string","name":"appId","_id":"58eb6b98bea9c5230084b6da","ref":"","in":"body","required":false},{"_id":"59148b5c964707190092ff39","ref":"","in":"body","required":false,"desc":"Campaign Id where Experiences will be searched.","default":"","type":"string","name":"campaignId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":false,"desc":"Experience name to be searched, use % as wildcard.","default":"","type":"string","name":"name"},{"type":"boolean","_id":"58eb6b98bea9c5230084b6d6","default":"false","desc":"Include already deleted Experiences in the search.","in":"body","name":"includeDeleted","ref":"","required":false},{"ref":"","in":"body","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned.","default":"0","type":"int","name":"offset","_id":"58eb92157d463619003e294b"},{"in":"body","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved.","default":"1000","type":"int","name":"limit","_id":"58eb922e7d463619003e294c","ref":""}],"results":{"codes":[{"name":"","code":"[\n  {\n    \"createdAt\": 1494507646115,\n    \"updatedAt\": 1494508789757,\n    \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n    \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n    \"segmentId\": null,\n    \"config\": {\n      \"name\": \"Enter MOCA HQ\",\n      \"description\": \"Welcome message on arrival\",\n      \"repeat\": \"NextDay\",\n      \"enabled\": true,\n      \"exactlyOnce\": false\n    },\n    \"trigger\": {\n      \"@type\": \"EnterPlaceTrigger\",\n      \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n    },\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"action\": {\n      \"@type\": \"OpenUrlAction\",\n      \"contentType\": \"text/x-url\",\n      \"content\": {\n        \"default\": \"http://www.mocaplatform.com\"\n      },\n      \"bgAlert\": {\n        \"default\": \"Welcome to MOCA office!\"\n      }\n    },\n    \"appKey\": \"IXa7Bl9oRo6c7zQ5aQIzlg\"\n  }\n]","language":"json","status":200},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field includeDeleted: Can not deserialize value of type boolean from String \\\"yes\\\": only \\\"true\\\" or \\\"false\\\" recognized\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/experiences/search"},"createdAt":"2017-05-11T15:58:52.276Z","isReference":true,"next":{"pages":[],"description":""},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","category":"58e76f2a654e3839008655d4","childrenPages":[]}

postSearch experiences

Returns a list of Experiences that matched the requested criteria across user's memberships, including Experiences both owned and from other accounts this user was invited to. The Experiences are returned in sorted order, with the most recent Experience appearing last. Any combination of filters can be used, none are required. Supports paging.

Body Params

accountId:
string
Account Id where Experiences will be searched.
appId:
string
App Id where Experiences will be searched.
campaignId:
string
Campaign Id where Experiences will be searched.
name:
string
Experience name to be searched, use % as wildcard.
includeDeleted:
booleanfalse
Include already deleted Experiences in the search.
offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned.
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59148e77f865370f000b4467","slug":"moca-api-create-experience","title":"Create new experience","type":"post","api":{"params":[{"default":"","desc":"Experience [configuration](doc:moca-api-experiences)","in":"body","name":"config","ref":"","required":true,"type":"object","_id":"58eb6b98bea9c5230084b6d9"},{"required":true,"desc":"Id of the Campaign where the Experience will be created.","default":"","type":"string","name":"campaignId","_id":"59146c8ea8a9e43100cf9017","ref":"","in":"query"},{"required":true,"type":"object","_id":"59149008687fe50f00a0d379","default":"","desc":"[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.","in":"body","name":"action","ref":""},{"in":"body","name":"trigger","ref":"","required":true,"type":"object","_id":"59149008687fe50f00a0d378","default":"","desc":"[Trigger](doc:moca-api-triggers) object that defines when the experience is triggered."}],"results":{"codes":[{"status":201,"language":"json","code":"{\n  \"createdAt\": 1494507646115,\n  \"updatedAt\": 1494508789757,\n  \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.request.config.repeat\": \"cannot be null\",\n    \"create.request.trigger\": \"cannot be null\",\n    \"create.request.action\": \"cannot be null\"\n  }\n}"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field config: Can not deserialize value of type com.iq.moca.services.model.resources.Experience$RepeatFrequency from String \\\"invalid\\\": value not one of declared Enum instance names: [NextWeek, After2Weeks, Never, NextMonth, After3Days, After5Days, After24Hours, After12Hours, After8Hours, After4Hours, After2Hours, After3Min, After1Min, Immediately, NextDay, After2Days, After15Min, After30Min, After2Months, After1Hour, After5Min]\"\n}"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property '@type' that is to contain type id  (for class com.iq.moca.services.model.triggers.Trigger)\"\n}"},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]},"settings":"","url":"/experiences/?campaignId=:campaignId","auth":"required","examples":{"codes":[{"code":"{\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","language":"json"}]},"method":"post"},"createdAt":"2017-05-11T16:16:55.459Z","excerpt":"Creates a new Experience.","isReference":true,"next":{"description":"","pages":[]},"updates":[],"project":"559a61d2dbcfd20d00710b39","category":"58e76f2a654e3839008655d4","githubsync":"","hidden":false,"link_external":false,"order":6,"body":"","link_url":"","user":"55a54dde9c32760d00ca78a8","__v":1,"parentDoc":null,"sync_unique":"","version":"58e76f2a654e3839008655c8","childrenPages":[]}

postCreate new experience

Creates a new Experience.

Query Params

campaignId:
required
string
Id of the Campaign where the Experience will be created.

Body Params

config:
required
object
Experience [configuration](doc:moca-api-experiences)
action:
required
object
[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.
trigger:
required
object
[Trigger](doc:moca-api-triggers) object that defines when the experience is triggered.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59b790f3275934001af5da2f","project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d4","user":"55a54dde9c32760d00ca78a8","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-09-12T07:46:59.732Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"resources\": {\n    \"campaigns\": [{\n      \"createdAt\": 1494402647390,\n      \"updatedAt\": 1494498973170,\n      \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n      \"campaignId\": \"kpgKdxN6uVRPgkesddDh6g\",\n      \"config\": {\n        \"name\": \"New campaign\",\n        \"description\": \"This is a new Campaign!\",\n        \"type\": \"Proximity\",\n        \"startAt\": 1494403200000,\n        \"endAt\": 1525939200000,\n        \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n        \"displayCap\": 3,\n        \"displayWaitMs\": 1800000\n      },\n      \"status\": \"New\",\n      \"statusAt\": 1494498473833\n    }],\n    \"experiences\": [{\n      \"createdAt\": 1491816253020,\n      \"updatedAt\": 1491816253020,\n      \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n      \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n      \"config\": {\n        \"name\": \"New experience 1\",\n        \"description\": \"This is a new Experience reusing an existing Campaign!\",\n        \"repeat\": \"NextDay\",\n        \"enabled\": true\n      },\n      \"trigger\": {\n        \"@type\": \"BeaconProximityTrigger\",\n        \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n        \"proximity\": \"Near\"\n      },\n      \"action\": {\n        \"@type\": \"ShowCardAction\",\n        \"contentType\": \"text/x-url\",\n        \"content\": {\n          \"default\": \"http://www.your-site.com/your-passcard-url.pkpass\"\n        },\n        \"bgAlert\": {\n          \"default\": \"You have a new card available. Open it now?\"\n        },\n        \"cardProvider\": \"apple-passbook\"\n      }\n    },\n    {\n      \"createdAt\": 1491816253021,\n      \"updatedAt\": 1491816253021,\n      \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n      \"campaignId\": \"kpgKdxN6uVRPgkesddDh6g\",\n      \"config\": {\n        \"name\": \"New experience 2\",\n        \"description\": \"This is a new Experience created in a new Campaign!\",\n        \"repeat\": \"NextDay\",\n        \"enabled\": true\n      },\n      \"trigger\": {\n        \"@type\": \"EnterZoneTrigger\",\n        \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n      },\n      \"action\": {\n        \"@type\": \"TagAction\",\n        \"tagName\": \"EntranceTag\",\n        \"actionValue\": \"+2\"\n      }\n    }]\n  },\n  \"errors\": [{\n    \"source\": {\n      \"campaign\": {\n        \"name\": \"New campaign\"\n      },\n      \"config\": {\n        \"name\": \"Invalid Experience\",\n        \"description\": \"This is an invalid Experience!\",\n        \"repeat\": \"NextDay\",\n        \"enabled\": true\n      }\n    },\n    \"error\": \"Bad Request\",\n    \"error_description\": \"Validation constraints violated\",\n    \"constraints\": {\n      \"create.request.trigger\": \"cannot be null\",\n      \"create.request.action\": \"cannot be null\"\n    }\n  }]\n}","name":""},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Required String parameter 'appId' is not present\"\n}","name":"","status":400,"language":"json"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"method":"post","examples":{"codes":[{"language":"json","code":"[\n  {\n    \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n    \"experience\": {\n      \"config\": {\n        \"name\": \"Enter MOCA HQ\",\n        \"description\": \"Welcome message on arrival\",\n        \"repeat\": \"NextDay\",\n        \"enabled\": true\n      },\n      \"trigger\": {\n        \"@type\": \"EnterPlaceTrigger\",\n        \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n      },\n      \"action\": {\n        \"@type\": \"OpenUrlAction\",\n        \"content\": {\n          \"default\": \"http://www.mocaplatform.com\"\n        },\n        \"bgAlert\": {\n          \"default\": \"Welcome to MOCA office!\"\n        }\n      }\n    }\n  },\n  {\n    \"campaign\": {\n\t    \"name\": \"HQ Office Welcome\"\n    },\n    \"experience\": {\n      \"config\": {\n        \"name\": \"New experience 1\",\n        \"description\": \"This is a new Experience reusing an existing Campaign!\",\n        \"repeat\": \"NextDay\",\n        \"enabled\": true\n      },\n      \"trigger\": {\n        \"@type\": \"BeaconProximityTrigger\",\n        \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\",\n        \"proximity\": \"Near\"\n      },\n      \"action\": {\n        \"@type\": \"ShowCardAction\",\n        \"contentType\": \"text/x-url\",\n        \"content\": {\n          \"default\": \"http://www.your-site.com/your-passcard-url.pkpass\"\n        },\n        \"bgAlert\": {\n          \"default\": \"You have a new card available. Open it now?\"\n        },\n        \"cardProvider\": \"apple-passbook\"\n      }\n    }\n  },\n  {\n    \"campaign\": {\n      \"name\": \"New campaign\",\n      \"description\": \"This is a new Campaign!\",\n      \"type\": \"Proximity\",\n      \"startAt\": 1494403200000,\n      \"endAt\": 1525939200000,\n      \"segmentId\": \"fe9NBA8DRdCIDmmEhy3T2w\",\n      \"displayCap\": 3,\n      \"displayWaitMs\": 1800000\n    },\n    \"experience\": {\n      \"config\": {\n        \"name\": \"New experience 2\",\n        \"description\": \"This is a new Experience created in a new Campaign!\",\n        \"repeat\": \"NextDay\",\n        \"enabled\": true\n      },\n      \"trigger\": {\n        \"@type\": \"EnterZoneTrigger\",\n        \"zoneId\": \"8Q9mI6TyKhGXIMvlz1jr7g\"\n      },\n      \"action\": {\n        \"@type\": \"TagAction\",\n        \"tagName\": \"EntranceTag\",\n        \"actionValue\": \"+2\"\n      }\n    }\n  },\n  {\n    \"campaign\": {\n      \"name\": \"New campaign\"\n    },\n    \"config\": {\n      \"name\": \"Invalid Experience\",\n      \"description\": \"This is an invalid Experience!\",\n      \"repeat\": \"NextDay\",\n      \"enabled\": true\n    }\n  }\n]","name":"File: JSON"},{"language":"text","name":"File: CSV","code":"campaignId,campaign.name,campaign.description,campaign.type,campaign.startAt,campaign.endAt,campaign.segmentId,campaign.displayCap,campaign.displayWaitMs,experience.config.name.experience.config.description,experience.config.repeat,experience.config.enabled,experience.trigger.@type,experience.trigger.placeId,experience.trigger.zoneId,experience.trigger.beaconId,experience.trigger.proximity,experience.action.@type,experience.action.content.default,experience.action.bgAlert.default,experience.action.cardProvider,experience.action.tagName,experience.action.actionValue\ndexNkpsVRPKdgkh6d6uDgg,,,,,,,,,Enter MOCA HQ,Welcome message on arrival,NextDay,true,EnterPlaceTrigger,rzwbxsgXSRSxqdjSe7xZTQ,,,,OpenUrlAction,http://www.mocaplatform.com,Welcome to MOCA office!,,,\n,HQ Office Welcome,,,,,,,,New experience 1,This is a new Experience reusing an existing Campaign!,NextDay,true,BeaconProximityTrigger,,,8Q9mI6TyKhGXIMvlz1jr7g,Near,ShowCardAction,http://www.your-site.com/your-passcard-url.pkpass,You have a new card available. Open it now?,apple-passbook,,\n,New campaign,This is a new Campaign!,Proximity,1494403200000,1525939200000,fe9NBA8DRdCIDmmEhy3T2w,3,1800000,New experience 2,This is a new Experience created in a new Campaign!,NextDay,true,EnterZoneTrigger,,8Q9mI6TyKhGXIMvlz1jr7g,,,TagAction,,,,EntranceTag,+2\n,New campaign,,,,,,,,,Invalid Experience,This is an invalid Experience!,NextDay,true,,,,,,,,,,,"}]},"settings":"","auth":"required","params":[{"_id":"58ee4b75e90d881b0052c7b5","ref":"","in":"query","required":true,"desc":"Id of the App where the Experiences and Campaigns will be created.","default":"","type":"string","name":"appId"},{"_id":"58ee4b75e90d881b0052c7b4","ref":"","in":"body","required":true,"desc":"File with Experience and Campaign data.","default":"","type":"file","name":"file"},{"_id":"58ee51f204a99a3700eafd2c","ref":"","in":"query","required":false,"desc":"If true, existing Experience/Campaign data will be replaced if the Experience/Campaign is an exact match. If false, new Experiences/Campaigns are always created.","default":"true","type":"string","name":"upsert"},{"_id":"58ee54d5edb2282f00937903","ref":"","in":"query","required":false,"desc":"File format. Valid values: CSV, JSON","default":"JSON","type":"string","name":"format"}],"url":"/experiences/batch?appId=:appId&upsert=:upsert&format=:format"},"isReference":true,"order":7,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"BETA Feature\",\n  \"body\": \"This feature is in Beta. If you have any issues, please contact us!\"\n}\n[/block]","excerpt":"Creates multiple Experiences and Campaigns from a file. \n\nCan also be used to update already existing experiences by name.","slug":"moca-api-batch-experience","type":"post","title":"Batch experience upload","__v":7,"parentDoc":null,"childrenPages":[]}

postBatch experience upload

Creates multiple Experiences and Campaigns from a file. Can also be used to update already existing experiences by name.

Query Params

appId:
required
string
Id of the App where the Experiences and Campaigns will be created.
upsert:
stringtrue
If true, existing Experience/Campaign data will be replaced if the Experience/Campaign is an exact match. If false, new Experiences/Campaigns are always created.
format:
stringJSON
File format. Valid values: CSV, JSON

Body Params

file:
required
file
File with Experience and Campaign data.
[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "warning", "title": "BETA Feature", "body": "This feature is in Beta. If you have any issues, please contact us!" } [/block]
{"_id":"5914949fa47fd70f004f1e5f","createdAt":"2017-05-11T16:43:11.727Z","excerpt":"Updates an already existing Experience.","githubsync":"","isReference":true,"order":8,"project":"559a61d2dbcfd20d00710b39","__v":2,"updates":[],"version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d4","link_url":"","parentDoc":null,"type":"put","api":{"settings":"","url":"/experiences/:experienceId","auth":"required","examples":{"codes":[{"code":"{\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","language":"json"}]},"method":"put","params":[{"_id":"59146c8ea8a9e43100cf9017","ref":"","in":"path","required":true,"desc":"Id of the Experience to be updated.","default":"","type":"string","name":"experienceId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"Experience [configuration](doc:moca-api-experiences)","default":"","type":"object","name":"config"},{"_id":"59149008687fe50f00a0d378","ref":"","in":"body","required":true,"desc":"[Trigger](doc:moca-api-triggers) object that defines when the experience is triggered.","default":"","type":"object","name":"trigger"},{"_id":"59149008687fe50f00a0d379","ref":"","in":"body","required":true,"desc":"[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.","default":"","type":"object","name":"action"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"createdAt\": 1494507646115,\n  \"updatedAt\": 1494508789757,\n  \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.request.config.repeat\": \"cannot be null\",\n    \"create.request.trigger\": \"cannot be null\",\n    \"create.request.action\": \"cannot be null\"\n  }\n}"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field config: Can not deserialize value of type com.iq.moca.services.model.resources.Experience$RepeatFrequency from String \\\"invalid\\\": value not one of declared Enum instance names: [NextWeek, After2Weeks, Never, NextMonth, After3Days, After5Days, After24Hours, After12Hours, After8Hours, After4Hours, After2Hours, After3Min, After1Min, Immediately, NextDay, After2Days, After15Min, After30Min, After2Months, After1Hour, After5Min]\"\n}"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property '@type' that is to contain type id  (for class com.iq.moca.services.model.triggers.Trigger)\"\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]}},"body":"","title":"Update experience","next":{"pages":[],"description":""},"sync_unique":"","slug":"moca-api-update-experience","user":"55a54dde9c32760d00ca78a8","hidden":false,"link_external":false,"childrenPages":[]}

putUpdate experience

Updates an already existing Experience.

Path Params

experienceId:
required
string
Id of the Experience to be updated.

Body Params

config:
required
object
Experience [configuration](doc:moca-api-experiences)
trigger:
required
object
[Trigger](doc:moca-api-triggers) object that defines when the experience is triggered.
action:
required
object
[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59149bf32fb2d50f00de44fb","user":"55a54dde9c32760d00ca78a8","createdAt":"2017-05-11T17:14:27.203Z","order":9,"title":"Update experience configuration","updates":[],"__v":2,"githubsync":"","slug":"moca-api-update-experience-config","link_external":false,"link_url":"","next":{"pages":[],"description":""},"sync_unique":"","type":"put","api":{"url":"/experiences/:experienceId/config","auth":"required","examples":{"codes":[{"code":"{\n  \"name\": \"Enter MOCA HQ\",\n  \"description\": \"Welcome message on arrival\",\n  \"repeat\": \"NextDay\",\n  \"enabled\": true\n}","language":"json"}]},"method":"put","params":[{"_id":"59146c8ea8a9e43100cf9017","ref":"","in":"path","required":true,"desc":"Id of the Experience to be updated.","default":"","type":"string","name":"experienceId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"Name of the experience.","default":"","type":"string","name":"name"},{"_id":"59149008687fe50f00a0d379","ref":"","in":"body","required":false,"desc":"Description of the experience.","default":"","type":"string","name":"description"},{"_id":"59149008687fe50f00a0d378","ref":"","in":"body","required":true,"desc":"Repeat interval. The experience cannot be triggered twice in this lapse of time.","default":"","type":"string","name":"repeat"},{"_id":"59149c56c022e40f00490b4e","ref":"","in":"body","required":false,"desc":"Indicates whether the experience is active or not.","default":"false","type":"boolean","name":"enabled"}],"results":{"codes":[{"status":200,"name":"","code":"{\n  \"createdAt\": 1494507646115,\n  \"updatedAt\": 1494508789757,\n  \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","language":"json"},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"update.config.repeat\": \"cannot be null\"\n  }\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Invalid format for field config: Can not deserialize value of type com.iq.moca.services.model.resources.Experience$RepeatFrequency from String \\\"invalid\\\": value not one of declared Enum instance names: [NextWeek, After2Weeks, Never, NextMonth, After3Days, After5Days, After24Hours, After12Hours, After8Hours, After4Hours, After2Hours, After3Min, After1Min, Immediately, NextDay, After2Days, After15Min, After30Min, After2Months, After1Hour, After5Min]\"\n}","language":"json","status":400},{"language":"json","status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":""},"body":"","isReference":true,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d4","excerpt":"Updates an already existing Experience's configuration","hidden":false,"childrenPages":[]}

putUpdate experience configuration

Updates an already existing Experience's configuration

Path Params

experienceId:
required
string
Id of the Experience to be updated.

Body Params

name:
required
string
Name of the experience.
description:
string
Description of the experience.
repeat:
required
string
Repeat interval. The experience cannot be triggered twice in this lapse of time.
enabled:
booleanfalse
Indicates whether the experience is active or not.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5914993c15c4eb19002fb1fa","version":"58e76f2a654e3839008655c8","githubsync":"","link_external":false,"parentDoc":null,"updates":[],"link_url":"","project":"559a61d2dbcfd20d00710b39","type":"put","user":"55a54dde9c32760d00ca78a8","excerpt":"Updates an already existing Experience's trigger.","hidden":false,"isReference":true,"next":{"description":"","pages":[]},"__v":2,"api":{"settings":"","url":"/experiences/:experienceId/trigger","auth":"required","examples":{"codes":[{"name":"EnterPlaceTrigger","language":"json","code":"{\n  \"@type\": \"EnterPlaceTrigger\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n}"},{"name":"PlaceProximityTrigger","language":"json","code":"{\n  \"@type\": \"PlaceProximityTrigger\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\",\n  \"proximity\": \"Near\"\n}"},{"language":"json","code":"{\n  \"@type\": \"ExitPlaceTrigger\",\n  \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n}","name":"ExitPlaceTrigger"},{"code":"{\n  \"@type\": \"EnterZoneTrigger\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\"\n}","language":"json","name":"EnterZoneTrigger"},{"language":"json","name":"ZoneProximityTrigger","code":"{\n  \"@type\": \"ZoneProximityTrigger\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n  \"proximity\": \"Near\"\n}"},{"code":"{\n  \"@type\": \"ExitZoneTrigger\",\n  \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\"\n}","language":"json","name":"ExitZoneTrigger"},{"code":"{\n  \"@type\": \"EnterBeaconTrigger\",\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\"\n}","language":"json","name":"EnterBeaconTrigger"},{"name":"BeaconProximityTrigger","language":"json","code":"{\n  \"@type\": \"BeaconProximityTrigger\",\n  \"zoneId\": \"qG9cexf6R6iRpIoonOCeUg\",\n  \"proximity\": \"Near\"\n}"},{"name":"ExitBeaconTrigger","language":"json","code":"{\n  \"@type\": \"ExitBeaconTrigger\",\n  \"beaconId\": \"qG9cexf6R6iRpIoonOCeUg\"\n}"},{"name":"CustomTrigger","language":"json","code":"{\n  \"@type\": \"CustomTrigger\",\n  \"customArgument\": \"CustomTriggerCallback\"\n}"},{"code":"{\n  \"@type\": \"CompositeTrigger\",\n  \"list\": [\n    {\n      \"@type\": \"ZoneProximityTrigger\",\n      \"zoneId\": \"1udDPRkMQrKivHgU8vIyUg\",\n      \"proximity\": \"Near\"\n    },\n    {\n      \"@type\": \"CustomTrigger\",\n      \"customArgument\": \"CustomTriggerCallback\"\n    }\n  ]\n}","name":"CompositeTrigger","language":"json"}]},"method":"put","params":[{"_id":"59146c8ea8a9e43100cf9017","ref":"","in":"path","required":true,"desc":"Id of the Experience to be updated.","default":"","type":"string","name":"experienceId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"[Trigger type](doc:moca-api-triggers)","default":"","type":"object","name":"@type"}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1494507646115,\n  \"updatedAt\": 1494508789757,\n  \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","language":"json","status":200},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property '@type' that is to contain type id  (for class com.iq.moca.services.model.triggers.Trigger)\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]}},"category":"58e76f2a654e3839008655d4","slug":"moca-api-update-experience-trigger","sync_unique":"","title":"Update experience trigger","body":"","createdAt":"2017-05-11T17:02:52.683Z","order":10,"childrenPages":[]}

putUpdate experience trigger

Updates an already existing Experience's trigger.

Path Params

experienceId:
required
string
Id of the Experience to be updated.

Body Params

type:
required
object
[Trigger type](doc:moca-api-triggers)

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"591498b9a47fd70f004f1ea6","parentDoc":null,"title":"Update experience action","type":"put","category":"58e76f2a654e3839008655d4","createdAt":"2017-05-11T17:00:41.472Z","isReference":true,"order":11,"link_url":"","version":"58e76f2a654e3839008655c8","__v":1,"api":{"examples":{"codes":[{"name":"SendLocalMessageAction","code":"{\n  \"@type\": \"SendLocalMessageAction\",\n  \"content\": {\n    \"default\": \"Come in and check out our new products!\"\n  },\n  \"bgAlert\": {}\n}","language":"json"},{"name":"ShowHtmlAction","language":"json","code":"{\n  \"@type\": \"ShowHtmlAction\",\n  \"content\": {\n    \"default\": \"<style>\\\\\\nbody {\\\\\\n\\\\tbackground-color: #dddddd;\\\\\\n\\\\ttext-align: center;\\\\\\n\\\\tfont-family: \\\"futura\\\";\\\\\\n\\\\tfont-size: 20px;\\\\\\n}\\\\\\n.logo {\\\\\\n\\\\twidth: 100%;\\\\\\n}\\\\\\n.title {\\\\\\n\\\\tfont-size: 1.25em;\\\\\\n\\\\tcolor: black;\\\\\\n}\\\\\\n.wrapper {\\\\\\n\\\\tmargin: 10% 5%;\\\\\\n}\\\\\\n.button {\\\\\\n\\\\tmargin: 0 2.5%;\\\\\\n\\\\tpadding: 10px 0;\\\\\\n\\\\twidth: 45%;\\\\\\n\\\\tbackground: #bf0d3f;\\\\\\n\\\\tborder-radius: 5px;\\\\\\n\\\\tfloat: left;\\\\\\n}\\\\\\na {\\\\\\n\\\\tcolor: white;\\\\\\n}\\\\\\n</style>\\\\\\n<div>\\\\\\n\\\\t<img class=\\\"logo\\\" src=\\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\"/>\\\\\\n</div>\\\\\\n<div class=\\\"title\\\">\\\\\\n\\\\t<B>WELCOME TO MOCA PLATFORM</B>\\\\\\n</div>\\\\\\n<div class=\\\"wrapper\\\">\\\\\\n\\\\t<a href=\\\"http://mocaplatform.com/\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Go to web</div>\\\\\\n\\\\t</a>\\\\\\n\\\\t<a href=\\\"mocasdk://closeme\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Dismiss</div>\\\\\\n\\\\t</a>\\\\\\n</div>\\\\\\n\"\n  },\n  \"bgAlert\": {\n    \"default\": \"Welcome to MOCA!\"\n  }\n}"},{"code":"{\n  \"@type\": \"ShowImageAction\",\n  \"content\": {\n    \"default\": \"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\"\n  },\n  \"bgAlert\": {\n    \"default\": \"Image!\"\n  }\n}","name":"ShowImageAction","language":"json"},{"name":"ShowVideoAction","language":"json","code":"{\n  \"@type\": \"ShowVideoAction\",\n  \"content\": {\n    \"default\": \"http://www.your-site.com/your-video-url\"\n  },\n  \"bgAlert\": {}\n}"},{"name":"PlaySoundAction","language":"json","code":"{\n  \"@type\": \"PlaySoundAction\",\n  \"content\": {\n    \"default\": \"my-sound.wav\"\n  },\n  \"bgAlert\": {}\n}"},{"name":"OpenUrlAction","language":"json","code":"{\n  \"@type\": \"OpenUrlAction\",\n  \"content\": {\n    \"default\": \"http://www.mocaplatform.com\"\n  },\n  \"bgAlert\": {\n    \"default\": \"Welcome to MOCA office!\"\n  }\n}"},{"name":"ShowCardAction","language":"json","code":"{\n  \"@type\": \"ShowCardAction\",\n  \"content\": {\n    \"default\": \"http://www.your-site.com/your-passcard-url.pkpass\"\n  },\n  \"bgAlert\": {\n    \"default\": \"You have a new card available. Open it now?\"\n  },\n  \"cardProvider\": \"apple-passbook\"\n}"},{"name":"TagAction","language":"json","code":"{\n  \"@type\": \"TagAction\",\n  \"tagName\": \"EntranceTag\",\n  \"actionValue\": \"+2\"\n}"},{"language":"json","code":"{\n  \"@type\": \"CustomAction\",\n  \"customArgument\": \"CustomActionCallback\"\n}","name":"CustomAction"},{"code":"{\n  \"@type\": \"CompositeAction\",\n  \"list\": [\n    {\n      \"@type\": \"OpenUrlAction\",\n      \"contentType\": \"text/x-url\",\n      \"content\": {\n        \"default\": \"http://www.mocaplatform.com\"\n      },\n      \"bgAlert\": {\n        \"default\": \"Check our website!\"\n      }\n    },\n    {\n      \"@type\": \"PlaySoundAction\",\n      \"contentType\": \"text/plain\",\n      \"content\": {\n        \"default\": \"my-sound.wav\"\n      },\n      \"bgAlert\": {}\n    }\n  ]\n}","name":"CompositeAction","language":"json"}]},"method":"put","params":[{"_id":"59146c8ea8a9e43100cf9017","ref":"","in":"path","required":true,"desc":"Id of the Experience to be updated.","default":"","type":"string","name":"experienceId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"[Action type](doc:moca-api-actions)","default":"","type":"string","name":"@type"},{"_id":"591498b9a47fd70f004f1ea8","ref":"","in":"body","required":false,"desc":"Content of the Experience.","default":"","type":"object","name":"content"},{"_id":"591498b9a47fd70f004f1ea7","ref":"","in":"body","required":false,"desc":"Notification text shown when the App is in background mode.","default":"","type":"object","name":"bgAlert"}],"results":{"codes":[{"code":"{\n  \"createdAt\": 1494507646115,\n  \"updatedAt\": 1494508789757,\n  \"experienceId\": \"EwMu6GDwRRuXXYbkktx--Q\",\n  \"campaignId\": \"dexNkpsVRPKdgkh6d6uDgg\",\n  \"config\": {\n    \"name\": \"Enter MOCA HQ\",\n    \"description\": \"Welcome message on arrival\",\n    \"repeat\": \"NextDay\",\n    \"enabled\": true\n  },\n  \"trigger\": {\n    \"@type\": \"EnterPlaceTrigger\",\n    \"placeId\": \"rzwbxsgXSRSxqdjSe7xZTQ\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Welcome to MOCA office!\"\n    }\n  }\n}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property '@type' that is to contain type id  (for class com.iq.moca.services.model.actions.Action)\"\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/experiences/:experienceId/action","auth":"required"},"githubsync":"","hidden":false,"updates":[],"user":"55a54dde9c32760d00ca78a8","body":"","excerpt":"Updates an already existing Experience's action.","project":"559a61d2dbcfd20d00710b39","link_external":false,"next":{"pages":[],"description":""},"slug":"moca-api-update-experience-action","sync_unique":"","childrenPages":[]}

putUpdate experience action

Updates an already existing Experience's action.

Path Params

experienceId:
required
string
Id of the Experience to be updated.

Body Params

type:
required
string
[Action type](doc:moca-api-actions)
content:
object
Content of the Experience.
bgAlert:
object
Notification text shown when the App is in background mode.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59149751181ad40f008f2533","createdAt":"2017-05-11T16:54:41.373Z","isReference":true,"link_url":"","order":12,"sync_unique":"","user":"55a54dde9c32760d00ca78a8","body":"","category":"58e76f2a654e3839008655d4","next":{"pages":[],"description":""},"slug":"moca-api-delete-experience","title":"Delete experience","updates":[],"__v":1,"excerpt":"Deletes an Experience.","project":"559a61d2dbcfd20d00710b39","parentDoc":null,"hidden":false,"link_external":false,"type":"delete","version":"58e76f2a654e3839008655c8","api":{"results":{"codes":[{"name":"","code":"","language":"json","status":204},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/experiences/:experienceId","auth":"required","examples":{"codes":[]},"method":"delete","params":[{"_id":"55ae008c8576b92300291c26","ref":"","in":"path","required":true,"desc":"Id of the Experience to be deleted.","default":"","type":"string","name":"experienceId"}]},"githubsync":"","childrenPages":[]}

deleteDelete experience

Deletes an Experience.

Path Params

experienceId:
required
string
Id of the Experience to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"5915692eada11c1900fedb40","slug":"moca-api-notifications","sync_unique":"","type":"basic","user":"55a54dde9c32760d00ca78a8","body":"A Notification is composed of three components: The [trigger](doc:moca-api-triggers-notification), the [action](doc:moca-api-actions) and the [audience](doc:moca-api-audiences). The action is what is executed when the experience is triggered.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Notification Object\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Obligatory?\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"createdAt\",\n    \"0-1\": \"long\",\n    \"0-2\": \"Autogenerated\",\n    \"0-3\": \"Creation date (timestamp UTC).\",\n    \"2-0\": \"notificationId\",\n    \"2-1\": \"string\",\n    \"2-2\": \"Autogenerated\",\n    \"2-3\": \"Notification identifier.\",\n    \"3-0\": \"campaignId\",\n    \"3-1\": \"string\",\n    \"3-2\": \"Yes\",\n    \"3-3\": \"The campaign id this Notification belongs to.\",\n    \"4-0\": \"config.name\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Yes\",\n    \"4-3\": \"Name of the Notification.\",\n    \"7-0\": \"action\",\n    \"7-1\": \"[Action](doc:moca-api-actions)\",\n    \"7-2\": \"Yes\",\n    \"7-3\": \"Action object that defines what happens when the experience is triggered.\",\n    \"1-0\": \"updatedAt\",\n    \"1-1\": \"long\",\n    \"1-2\": \"Autogenerated\",\n    \"1-3\": \"Last updated time (timestamp UTC).\",\n    \"5-0\": \"trigger\",\n    \"5-1\": \"[Trigger](doc:moca-api-triggers-notification)\",\n    \"5-2\": \"Yes\",\n    \"5-3\": \"Trigger object that defines when the experience is triggered.\",\n    \"6-0\": \"audience\",\n    \"6-1\": \"[Audience](doc:moca-api-audiences)\",\n    \"6-2\": \"Yes\",\n    \"6-3\": \"Audience object defining the target users of this Notification.\",\n    \"8-0\": \"options\",\n    \"8-1\": \"object\",\n    \"8-2\": \"No\",\n    \"8-3\": \"Additional parameters used to define behavior\",\n    \"9-0\": \"status\",\n    \"9-1\": \"object\",\n    \"9-2\": \"Autogenerated\",\n    \"9-3\": \"Current status of the notification.\"\n  },\n  \"cols\": 4,\n  \"rows\": 10\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Options\"\n}\n[/block]\nThe following parameters can be used to modify the behavior of a Notification:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Default value\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"draft\",\n    \"0-1\": \"boolean\",\n    \"0-2\": \"true\",\n    \"0-3\": \"Indicates whether the Notification is a draft or if it is ready to be sent to all targeted devices.\",\n    \"1-0\": \"dryRun\",\n    \"1-1\": \"boolean\",\n    \"1-2\": \"false\",\n    \"1-3\": \"Indicates whether the push notification is effectively sent or just simulated. Useful to evaluate if configuration is correct and to see how many users will receive the notification.\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Status\"\n}\n[/block]\nNotifications have a live cycle, composed of the following states:\n- Draft: The notification is in edit mode and can be modified as many times as necessary before being sent.\n- Pending: The notification has been marked as ready. Our servers will queue the notification once the trigger is evaluated positively.\n- Enqueued: The notification is queued and waiting to be sent.\n- Sending: The notification is currently being sent to all targeted devices.\n- Completed: The notification has been successfully sent.\n- Cancelled: The notification was marked as ready, but has since been cancelled. It won't be sent unless it is marked as ready again.\n- Failed: There was a problem while sending the notification.\n\nWhen a notification is being sent, and after it has completed, the following stats are available:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"status\",\n    \"0-1\": \"Status\",\n    \"0-2\": \"The current status of the notification.\",\n    \"1-0\": \"execTimeMs\",\n    \"1-1\": \"long\",\n    \"1-2\": \"The elapsed processing time. Available only after the Notification has been completely sent. \",\n    \"2-0\": \"requestedDevices\",\n    \"3-0\": \"processedDevices\",\n    \"4-0\": \"targetDevices\",\n    \"5-0\": \"sentMessages\",\n    \"2-2\": \"Number of devices requested.\",\n    \"3-2\": \"Number of devices MOCA has correctly identified.\",\n    \"2-1\": \"int\",\n    \"3-1\": \"int\",\n    \"4-1\": \"int\",\n    \"4-2\": \"Actual number of devices that the notification is targeted to after discarding uninstalled app instances and expired tokens.\",\n    \"5-2\": \"Actual number of messages sent to GCM/APNS.\",\n    \"5-1\": \"int\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"createdAt\\\": 1494587968146,\\n  \\\"updatedAt\\\": 1494587968146,\\n  \\\"notificationId\\\": \\\"SFvZPd2CSuu1mUrecUN6Mg\\\",\\n  \\\"appId\\\": \\\"IXa7Bl9oRo6c7zQ5aQIzlg\\\",\\n  \\\"campaignId\\\": \\\"A1d0sNtdQwaMpAKsX99cMQ\\\",\\n  \\\"config\\\": {\\n    \\\"name\\\": \\\"Visit invitation\\\"\\n  },\\n  \\\"trigger\\\": {\\n    \\\"@type\\\": \\\"TimeTrigger\\\",\\n    \\\"time\\\": 1494586642000\\n  },\\n  \\\"audience\\\": {\\n    \\\"type\\\": \\\"Query\\\",\\n    \\\"query\\\": \\\"{ \\\\\\\"$all\\\\\\\": [ { \\\\\\\"lang\\\\\\\": \\\\\\\"en\\\\\\\" }, { \\\\\\\"os\\\\\\\": \\\\\\\"Android\\\\\\\" } ] }\\\"\\n  },\\n  \\\"action\\\": {\\n    \\\"@type\\\": \\\"OpenUrlAction\\\",\\n    \\\"contentType\\\": \\\"text/x-url\\\",\\n    \\\"content\\\": {\\n      \\\"default\\\": \\\"http://www.mocaplatform.com\\\"\\n    },\\n    \\\"bgAlert\\\": {\\n      \\\"default\\\": \\\"Come visit us at MOCA!\\\"\\n    }\\n  },\\n  \\\"options\\\": {\\n    \\\"draft\\\": false\\n  },\\n  \\\"statusReport\\\": {\\n    \\\"status\\\": \\\"Completed\\\",\\n    \\\"execTimeMs\\\": 531,\\n    \\\"requestedDevices\\\": 11,\\n    \\\"processedDevices\\\": 11,\\n    \\\"targetDevices\\\": 11,\\n    \\\"sentMessages\\\": 7\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Notification object\"\n    }\n  ]\n}\n[/block]","hidden":false,"link_external":false,"excerpt":"Represents a push notification sent directly from MOCA Console.","isReference":true,"project":"559a61d2dbcfd20d00710b39","category":"58e76f2a654e3839008655d2","createdAt":"2017-05-12T07:50:06.893Z","order":0,"title":"Overview","version":"58e76f2a654e3839008655c8","githubsync":"","link_url":"","next":{"pages":[],"description":""},"updates":[],"__v":0,"api":{"results":{"codes":[{"language":"json","status":200,"name":"","code":"{}"},{"status":400,"name":"","code":"{}","language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"parentDoc":null,"childrenPages":[]}

Overview

Represents a push notification sent directly from MOCA Console.

A Notification is composed of three components: The [trigger](doc:moca-api-triggers-notification), the [action](doc:moca-api-actions) and the [audience](doc:moca-api-audiences). The action is what is executed when the experience is triggered. [block:api-header] { "type": "basic", "title": "The Notification Object" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "notificationId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Notification identifier.", "3-0": "campaignId", "3-1": "string", "3-2": "Yes", "3-3": "The campaign id this Notification belongs to.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Notification.", "7-0": "action", "7-1": "[Action](doc:moca-api-actions)", "7-2": "Yes", "7-3": "Action object that defines what happens when the experience is triggered.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated time (timestamp UTC).", "5-0": "trigger", "5-1": "[Trigger](doc:moca-api-triggers-notification)", "5-2": "Yes", "5-3": "Trigger object that defines when the experience is triggered.", "6-0": "audience", "6-1": "[Audience](doc:moca-api-audiences)", "6-2": "Yes", "6-3": "Audience object defining the target users of this Notification.", "8-0": "options", "8-1": "object", "8-2": "No", "8-3": "Additional parameters used to define behavior", "9-0": "status", "9-1": "object", "9-2": "Autogenerated", "9-3": "Current status of the notification." }, "cols": 4, "rows": 10 } [/block] [block:api-header] { "title": "Options" } [/block] The following parameters can be used to modify the behavior of a Notification: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Default value", "h-3": "Description", "0-0": "draft", "0-1": "boolean", "0-2": "true", "0-3": "Indicates whether the Notification is a draft or if it is ready to be sent to all targeted devices.", "1-0": "dryRun", "1-1": "boolean", "1-2": "false", "1-3": "Indicates whether the push notification is effectively sent or just simulated. Useful to evaluate if configuration is correct and to see how many users will receive the notification." }, "cols": 4, "rows": 2 } [/block] [block:api-header] { "title": "Status" } [/block] Notifications have a live cycle, composed of the following states: - Draft: The notification is in edit mode and can be modified as many times as necessary before being sent. - Pending: The notification has been marked as ready. Our servers will queue the notification once the trigger is evaluated positively. - Enqueued: The notification is queued and waiting to be sent. - Sending: The notification is currently being sent to all targeted devices. - Completed: The notification has been successfully sent. - Cancelled: The notification was marked as ready, but has since been cancelled. It won't be sent unless it is marked as ready again. - Failed: There was a problem while sending the notification. When a notification is being sent, and after it has completed, the following stats are available: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "status", "0-1": "Status", "0-2": "The current status of the notification.", "1-0": "execTimeMs", "1-1": "long", "1-2": "The elapsed processing time. Available only after the Notification has been completely sent. ", "2-0": "requestedDevices", "3-0": "processedDevices", "4-0": "targetDevices", "5-0": "sentMessages", "2-2": "Number of devices requested.", "3-2": "Number of devices MOCA has correctly identified.", "2-1": "int", "3-1": "int", "4-1": "int", "4-2": "Actual number of devices that the notification is targeted to after discarding uninstalled app instances and expired tokens.", "5-2": "Actual number of messages sent to GCM/APNS.", "5-1": "int" }, "cols": 3, "rows": 6 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494587968146,\n \"updatedAt\": 1494587968146,\n \"notificationId\": \"SFvZPd2CSuu1mUrecUN6Mg\",\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"campaignId\": \"A1d0sNtdQwaMpAKsX99cMQ\",\n \"config\": {\n \"name\": \"Visit invitation\"\n },\n \"trigger\": {\n \"@type\": \"TimeTrigger\",\n \"time\": 1494586642000\n },\n \"audience\": {\n \"type\": \"Query\",\n \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n },\n \"action\": {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Come visit us at MOCA!\"\n }\n },\n \"options\": {\n \"draft\": false\n },\n \"statusReport\": {\n \"status\": \"Completed\",\n \"execTimeMs\": 531,\n \"requestedDevices\": 11,\n \"processedDevices\": 11,\n \"targetDevices\": 11,\n \"sentMessages\": 7\n }\n}", "language": "json", "name": "Sample Notification object" } ] } [/block]
A Notification is composed of three components: The [trigger](doc:moca-api-triggers-notification), the [action](doc:moca-api-actions) and the [audience](doc:moca-api-audiences). The action is what is executed when the experience is triggered. [block:api-header] { "type": "basic", "title": "The Notification Object" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Obligatory?", "h-3": "Description", "0-0": "createdAt", "0-1": "long", "0-2": "Autogenerated", "0-3": "Creation date (timestamp UTC).", "2-0": "notificationId", "2-1": "string", "2-2": "Autogenerated", "2-3": "Notification identifier.", "3-0": "campaignId", "3-1": "string", "3-2": "Yes", "3-3": "The campaign id this Notification belongs to.", "4-0": "config.name", "4-1": "string", "4-2": "Yes", "4-3": "Name of the Notification.", "7-0": "action", "7-1": "[Action](doc:moca-api-actions)", "7-2": "Yes", "7-3": "Action object that defines what happens when the experience is triggered.", "1-0": "updatedAt", "1-1": "long", "1-2": "Autogenerated", "1-3": "Last updated time (timestamp UTC).", "5-0": "trigger", "5-1": "[Trigger](doc:moca-api-triggers-notification)", "5-2": "Yes", "5-3": "Trigger object that defines when the experience is triggered.", "6-0": "audience", "6-1": "[Audience](doc:moca-api-audiences)", "6-2": "Yes", "6-3": "Audience object defining the target users of this Notification.", "8-0": "options", "8-1": "object", "8-2": "No", "8-3": "Additional parameters used to define behavior", "9-0": "status", "9-1": "object", "9-2": "Autogenerated", "9-3": "Current status of the notification." }, "cols": 4, "rows": 10 } [/block] [block:api-header] { "title": "Options" } [/block] The following parameters can be used to modify the behavior of a Notification: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Default value", "h-3": "Description", "0-0": "draft", "0-1": "boolean", "0-2": "true", "0-3": "Indicates whether the Notification is a draft or if it is ready to be sent to all targeted devices.", "1-0": "dryRun", "1-1": "boolean", "1-2": "false", "1-3": "Indicates whether the push notification is effectively sent or just simulated. Useful to evaluate if configuration is correct and to see how many users will receive the notification." }, "cols": 4, "rows": 2 } [/block] [block:api-header] { "title": "Status" } [/block] Notifications have a live cycle, composed of the following states: - Draft: The notification is in edit mode and can be modified as many times as necessary before being sent. - Pending: The notification has been marked as ready. Our servers will queue the notification once the trigger is evaluated positively. - Enqueued: The notification is queued and waiting to be sent. - Sending: The notification is currently being sent to all targeted devices. - Completed: The notification has been successfully sent. - Cancelled: The notification was marked as ready, but has since been cancelled. It won't be sent unless it is marked as ready again. - Failed: There was a problem while sending the notification. When a notification is being sent, and after it has completed, the following stats are available: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "status", "0-1": "Status", "0-2": "The current status of the notification.", "1-0": "execTimeMs", "1-1": "long", "1-2": "The elapsed processing time. Available only after the Notification has been completely sent. ", "2-0": "requestedDevices", "3-0": "processedDevices", "4-0": "targetDevices", "5-0": "sentMessages", "2-2": "Number of devices requested.", "3-2": "Number of devices MOCA has correctly identified.", "2-1": "int", "3-1": "int", "4-1": "int", "4-2": "Actual number of devices that the notification is targeted to after discarding uninstalled app instances and expired tokens.", "5-2": "Actual number of messages sent to GCM/APNS.", "5-1": "int" }, "cols": 3, "rows": 6 } [/block] [block:code] { "codes": [ { "code": "{\n \"createdAt\": 1494587968146,\n \"updatedAt\": 1494587968146,\n \"notificationId\": \"SFvZPd2CSuu1mUrecUN6Mg\",\n \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n \"campaignId\": \"A1d0sNtdQwaMpAKsX99cMQ\",\n \"config\": {\n \"name\": \"Visit invitation\"\n },\n \"trigger\": {\n \"@type\": \"TimeTrigger\",\n \"time\": 1494586642000\n },\n \"audience\": {\n \"type\": \"Query\",\n \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n },\n \"action\": {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Come visit us at MOCA!\"\n }\n },\n \"options\": {\n \"draft\": false\n },\n \"statusReport\": {\n \"status\": \"Completed\",\n \"execTimeMs\": 531,\n \"requestedDevices\": 11,\n \"processedDevices\": 11,\n \"targetDevices\": 11,\n \"sentMessages\": 7\n }\n}", "language": "json", "name": "Sample Notification object" } ] } [/block]
{"_id":"5915b7be27c5b92d0005047f","hidden":false,"isReference":true,"link_external":false,"next":{"description":"","pages":[]},"order":1,"updates":[],"category":"58e76f2a654e3839008655d2","user":"55a54dde9c32760d00ca78a8","githubsync":"","link_url":"","project":"559a61d2dbcfd20d00710b39","version":"58e76f2a654e3839008655c8","__v":0,"api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]}},"parentDoc":null,"slug":"moca-api-triggers-notification","sync_unique":"","title":"Triggers","createdAt":"2017-05-12T13:25:18.819Z","excerpt":"Defines when a notification is sent.","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"TimeTrigger\"\n}\n[/block]\nTriggered after a specific time has passed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"TimeTrigger\\\",\\n  \\\"time\\\": 1494586642000\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","type":"basic","childrenPages":[]}

Triggers

Defines when a notification is sent.

[block:api-header] { "type": "basic", "title": "TimeTrigger" } [/block] Triggered after a specific time has passed. [block:code] { "codes": [ { "code": "{\n \"@type\": \"TimeTrigger\",\n \"time\": 1494586642000\n}", "language": "json" } ] } [/block]
[block:api-header] { "type": "basic", "title": "TimeTrigger" } [/block] Triggered after a specific time has passed. [block:code] { "codes": [ { "code": "{\n \"@type\": \"TimeTrigger\",\n \"time\": 1494586642000\n}", "language": "json" } ] } [/block]
{"_id":"5915d3eaadef8c0f007992af","user":"55a54dde9c32760d00ca78a8","__v":0,"category":"58e76f2a654e3839008655d2","hidden":false,"link_external":false,"next":{"pages":[],"description":""},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","createdAt":"2017-05-12T15:25:30.984Z","link_url":"","updates":[],"api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","order":2,"slug":"moca-api-audiences","body":"[block:api-header]\n{\n  \"title\": \"All\"\n}\n[/block]\nThe notification will be sent to everyone.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"type\\\": \\\"All\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Segment\"\n}\n[/block]\nIdentifies users using a [segment](doc:moca-api-segments).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"type\\\": \\\"Segment\\\",\\n  \\\"ids\\\" : [\\\"fe9NBA8DRdCIDmmEhy3T2w\\\"]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Query\"\n}\n[/block]\nIdentifies users using a [query expression](doc:moca-api-segment-query).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"type\\\": \\\"Query\\\",\\n\\t\\\"query\\\": \\\"{ \\\\\\\"$all\\\\\\\": [ { \\\\\\\"lang\\\\\\\": { \\\\\\\"$eq\\\\\\\": \\\\\\\"es\\\\\\\" } } ] }\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"User IDs\"\n}\n[/block]\nIdentifies users [logged into MOCA SDK](doc:user-api-1).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"type\\\": \\\"UserIds\\\",\\n  \\\"ids\\\" : [\\\"2349587\\\",\\\"1234\\\",\\\"1923847\\\",\\\"12341324\\\", …]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Instance IDs\"\n}\n[/block]\nIdentifies [devices using MOCA SDK](doc:instance-api-1).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"type\\\": \\\"InstanceIds\\\",\\n  \\\"ids\\\" : [\\\"4BRqEg2XTb6mYvlbuTc6gQ\\\",\\\"NozCTNW2Sjm5OjIKNc4lng\\\", …]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Device Tokens\"\n}\n[/block]\nIdentifies devices by their push platform id (GCM/APNS).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"type\\\": \\\"DeviceTokens\\\",\\n  \\\"ids\\\" : [\\\"C9E40F442CAB00C9A1D48\\\", …]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"Defines the segment of users that will receive a notification.","isReference":true,"sync_unique":"","title":"Audiences","type":"basic","version":"58e76f2a654e3839008655c8","childrenPages":[]}

Audiences

Defines the segment of users that will receive a notification.

[block:api-header] { "title": "All" } [/block] The notification will be sent to everyone. [block:code] { "codes": [ { "code": "{\n \"type\": \"All\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Segment" } [/block] Identifies users using a [segment](doc:moca-api-segments). [block:code] { "codes": [ { "code": "{\n \"type\": \"Segment\",\n \"ids\" : [\"fe9NBA8DRdCIDmmEhy3T2w\"]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Query" } [/block] Identifies users using a [query expression](doc:moca-api-segment-query). [block:code] { "codes": [ { "code": "{\n\t\"type\": \"Query\",\n\t\"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"es\\\" } } ] }\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "User IDs" } [/block] Identifies users [logged into MOCA SDK](doc:user-api-1). [block:code] { "codes": [ { "code": "{\n \"type\": \"UserIds\",\n \"ids\" : [\"2349587\",\"1234\",\"1923847\",\"12341324\", …]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Instance IDs" } [/block] Identifies [devices using MOCA SDK](doc:instance-api-1). [block:code] { "codes": [ { "code": "{\n \"type\": \"InstanceIds\",\n \"ids\" : [\"4BRqEg2XTb6mYvlbuTc6gQ\",\"NozCTNW2Sjm5OjIKNc4lng\", …]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Device Tokens" } [/block] Identifies devices by their push platform id (GCM/APNS). [block:code] { "codes": [ { "code": "{\n \"type\": \"DeviceTokens\",\n \"ids\" : [\"C9E40F442CAB00C9A1D48\", …]\n}", "language": "json" } ] } [/block]
[block:api-header] { "title": "All" } [/block] The notification will be sent to everyone. [block:code] { "codes": [ { "code": "{\n \"type\": \"All\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Segment" } [/block] Identifies users using a [segment](doc:moca-api-segments). [block:code] { "codes": [ { "code": "{\n \"type\": \"Segment\",\n \"ids\" : [\"fe9NBA8DRdCIDmmEhy3T2w\"]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Query" } [/block] Identifies users using a [query expression](doc:moca-api-segment-query). [block:code] { "codes": [ { "code": "{\n\t\"type\": \"Query\",\n\t\"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": { \\\"$eq\\\": \\\"es\\\" } } ] }\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "User IDs" } [/block] Identifies users [logged into MOCA SDK](doc:user-api-1). [block:code] { "codes": [ { "code": "{\n \"type\": \"UserIds\",\n \"ids\" : [\"2349587\",\"1234\",\"1923847\",\"12341324\", …]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Instance IDs" } [/block] Identifies [devices using MOCA SDK](doc:instance-api-1). [block:code] { "codes": [ { "code": "{\n \"type\": \"InstanceIds\",\n \"ids\" : [\"4BRqEg2XTb6mYvlbuTc6gQ\",\"NozCTNW2Sjm5OjIKNc4lng\", …]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Device Tokens" } [/block] Identifies devices by their push platform id (GCM/APNS). [block:code] { "codes": [ { "code": "{\n \"type\": \"DeviceTokens\",\n \"ids\" : [\"C9E40F442CAB00C9A1D48\", …]\n}", "language": "json" } ] } [/block]
{"_id":"5915c1ec27c5b92d000504bb","hidden":false,"next":{"pages":[],"description":""},"type":"get","updates":[],"order":3,"user":"55a54dde9c32760d00ca78a8","__v":0,"category":"58e76f2a654e3839008655d2","createdAt":"2017-05-12T14:08:44.179Z","excerpt":"Returns a list of all Notifications across user's memberships, including Notifications both owned and from other accounts this user was invited to. The Notifications are returned in sorted order, with the most recent Notification appearing last.\n\nSupports paging.","githubsync":"","link_url":"","version":"58e76f2a654e3839008655c8","slug":"moca-api-get-notifications","title":"Get all notifications","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"ref":"","in":"query","required":false,"desc":"Paging offset. Used to indicate the index of the first object to be returned","default":"0","type":"int","name":"offset","_id":"58eb92062dd737230023dd4c"},{"in":"query","required":false,"desc":"Paging limit. Used to indicate the maximum amount of items to be retrieved","default":"1000","type":"int","name":"limit","_id":"58eb92062dd737230023dd4b","ref":""}],"results":{"codes":[{"name":"","code":"[\n  {\n    \"createdAt\": 1494587968146,\n    \"updatedAt\": 1494587968146,\n    \"notificationId\": \"SFvZPd2CSuu1mUrecUN6Mg\",\n    \"campaignId\": \"A1d0sNtdQwaMpAKsX99cMQ\",\n    \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n    \"config\": {\n      \"name\": \"Visit invitation\"\n    },\n    \"trigger\": {\n      \"@type\": \"TimeTrigger\",\n      \"time\": 1494586642000\n    },\n    \"audience\": {\n      \"type\": \"Query\",\n      \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n    },\n    \"options\": {\n      \"draft\": false\n    },\n    \"statusReport\": {\n      \"status\": \"Completed\",\n      \"execTimeMs\": 1031,\n      \"requestedDevices\": 11,\n      \"processedDevices\": 11,\n      \"targetDevices\": 11,\n      \"sentMessages\": 7\n    },\n    \"action\": {\n      \"@type\": \"OpenUrlAction\",\n      \"contentType\": \"text/x-url\",\n      \"content\": {\n        \"default\": \"http://www.mocaplatform.com\"\n      },\n      \"bgAlert\": {\n        \"default\": \"Come visit us at MOCA!\"\n      }\n    }\n  }\n]","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/notifications/?offset=:offset&limit=:limit"},"isReference":true,"link_external":false,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","body":"","sync_unique":"","childrenPages":[]}

getGet all notifications

Returns a list of all Notifications across user's memberships, including Notifications both owned and from other accounts this user was invited to. The Notifications are returned in sorted order, with the most recent Notification appearing last. Supports paging.

Query Params

offset:
integer0
Paging offset. Used to indicate the index of the first object to be returned
limit:
integer1000
Paging limit. Used to indicate the maximum amount of items to be retrieved

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"5915c2217c2c552d008b8323","hidden":false,"link_url":"","sync_unique":"","title":"Get single notification","type":"get","updates":[],"version":"58e76f2a654e3839008655c8","githubsync":"","api":{"results":{"codes":[{"language":"json","code":"{\n  \"createdAt\": 1494587968146,\n  \"updatedAt\": 1494587968146,\n  \"notificationId\": \"SFvZPd2CSuu1mUrecUN6Mg\",\n  \"campaignId\": \"A1d0sNtdQwaMpAKsX99cMQ\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"Visit invitation\"\n  },\n  \"trigger\": {\n    \"@type\": \"TimeTrigger\",\n    \"time\": 1494586642000\n  },\n  \"audience\": {\n    \"type\": \"Query\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Come visit us at MOCA!\"\n    }\n  },\n  \"options\": {\n    \"draft\": false\n  },\n  \"statusReport\": {\n    \"status\": \"Completed\",\n    \"execTimeMs\": 1031,\n    \"requestedDevices\": 11,\n    \"processedDevices\": 11,\n    \"targetDevices\": 11,\n    \"sentMessages\": 7\n  }\n}","name":"","status":200},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"},{"code":"{\n  \"error\": \"Not Found\",\n  \"error_description\": \"Experience not found\"\n}","language":"json","status":404}]},"settings":"","url":"/notifications/:notificationId","auth":"required","examples":{"codes":[]},"method":"get","params":[{"ref":"","required":true,"type":"string","_id":"55ae008c8576b92300291c26","default":"","desc":"Requested Notification id.","in":"path","name":"notificationId"}]},"body":"","slug":"moca-api-get-notification","user":"55a54dde9c32760d00ca78a8","category":"58e76f2a654e3839008655d2","createdAt":"2017-05-12T14:09:37.492Z","next":{"pages":[],"description":""},"parentDoc":null,"__v":0,"isReference":true,"link_external":false,"order":4,"project":"559a61d2dbcfd20d00710b39","excerpt":"Retrieves the details of an existing Notification.","childrenPages":[]}

getGet single notification

Retrieves the details of an existing Notification.

Path Params

notificationId:
required
string
Requested Notification id.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Result Format



{"_id":"5915c80cadef8c0f00799059","__v":1,"next":{"pages":[],"description":""},"order":5,"createdAt":"2017-05-12T14:34:52.389Z","link_url":"","parentDoc":null,"sync_unique":"","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","title":"Create notification","type":"post","body":"","category":"58e76f2a654e3839008655d2","githubsync":"","hidden":false,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-create-notification","updates":[],"api":{"auth":"required","examples":{"codes":[{"language":"json","code":"{\n  \"config\": {\n    \"name\": \"Visit invitation\"\n  },\n  \"trigger\": {\n    \"@type\": \"TimeTrigger\",\n    \"time\": 1494586642000\n  },\n  \"audience\": {\n    \"type\": \"Query\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Come visit us at MOCA!\"\n    }\n  },\n  \"draft\": false\n}"}]},"method":"post","params":[{"name":"appId","_id":"59146c8ea8a9e43100cf9017","ref":"","in":"query","required":true,"desc":"Id of the App where the Notification will be created.","default":"","type":"string"},{"type":"object","name":"config","_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"Notification [configuration](doc:moca-api-notifications)","default":""},{"desc":"[Trigger](doc:moca-api-triggers-notification) object that defines when the experience is triggered.","default":"","type":"object","name":"trigger","_id":"59149008687fe50f00a0d378","ref":"","in":"body","required":true},{"_id":"59149008687fe50f00a0d379","ref":"","in":"body","required":true,"desc":"[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.","default":"","type":"object","name":"action"},{"name":"audience","_id":"5915c96042c6a22300b9f037","ref":"","in":"body","required":true,"desc":"[Audience](doc:moca-api-audience) object that defines who will the notification be sent to.","default":"","type":"object"},{"type":"boolean","name":"draft","_id":"5915c96042c6a22300b9f036","ref":"","in":"body","required":false,"desc":"Set to false to immediately confirm the notification.","default":"true"},{"desc":"Set to true to simulate sending a notification. All stats will be generated, only the actual sending is skipped.","default":"false","type":"boolean","name":"dryRun","_id":"5915c96042c6a22300b9f035","ref":"","in":"body","required":false}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1494587968146,\n  \"updatedAt\": 1494587968146,\n  \"notificationId\": \"SFvZPd2CSuu1mUrecUN6Mg\",\n  \"campaignId\": \"A1d0sNtdQwaMpAKsX99cMQ\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"Visit invitation\"\n  },\n  \"trigger\": {\n    \"@type\": \"TimeTrigger\",\n    \"time\": 1494586642000\n  },\n  \"audience\": {\n    \"type\": \"Query\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Come visit us at MOCA!\"\n    }\n  },\n  \"options\": {\n    \"draft\": false\n  },\n  \"statusReport\": {\n    \"status\": \"Pending\",\n    \"execTimeMs\": null,\n    \"requestedDevices\": null,\n    \"processedDevices\": 0,\n    \"targetDevices\": null,\n    \"sentMessages\": 0\n  }\n}","language":"json","status":201},{"language":"json","status":400,"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.request.config.name\": \"cannot be null\",\n    \"create.request.trigger\": \"cannot be null\",\n    \"create.request.audience\": \"cannot be null\",\n    \"create.request.action\": \"cannot be null\"\n  }\n}"},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property '@type' that is to contain type id  (for class com.iq.moca.services.model.triggers.Trigger)\"\n}","language":"json","status":400},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]},"settings":"","url":"/notifications/?appId=:appId"},"excerpt":"Creates a new Experience.","isReference":true,"link_external":false,"childrenPages":[]}

postCreate notification

Creates a new Experience.

Query Params

appId:
required
string
Id of the App where the Notification will be created.

Body Params

config:
required
object
Notification [configuration](doc:moca-api-notifications)
trigger:
required
object
[Trigger](doc:moca-api-triggers-notification) object that defines when the experience is triggered.
action:
required
object
[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.
audience:
required
object
[Audience](doc:moca-api-audience) object that defines who will the notification be sent to.
draft:
booleantrue
Set to false to immediately confirm the notification.
dryRun:
booleanfalse
Set to true to simulate sending a notification. All stats will be generated, only the actual sending is skipped.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5915cace27c5b92d00050719","body":"","isReference":true,"parentDoc":null,"version":"58e76f2a654e3839008655c8","api":{"auth":"required","examples":{"codes":[{"code":"{\n  \"config\": {\n    \"name\": \"Visit invitation\"\n  },\n  \"trigger\": {\n    \"@type\": \"TimeTrigger\",\n    \"time\": 1494586642000\n  },\n  \"audience\": {\n    \"type\": \"Query\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Come visit us at MOCA!\"\n    }\n  },\n  \"draft\": false\n}","language":"json"}]},"method":"put","params":[{"_id":"59146c8ea8a9e43100cf9017","ref":"","in":"path","required":true,"desc":"Id of the Notification to be updated.","default":"","type":"string","name":"notificationId"},{"_id":"58eb6b98bea9c5230084b6d9","ref":"","in":"body","required":true,"desc":"Notification [configuration](doc:moca-api-notifications)","default":"","type":"object","name":"config"},{"_id":"59149008687fe50f00a0d378","ref":"","in":"body","required":true,"desc":"[Trigger](doc:moca-api-triggers-notification) object that defines when the experience is triggered.","default":"","type":"object","name":"trigger"},{"_id":"59149008687fe50f00a0d379","ref":"","in":"body","required":true,"desc":"[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.","default":"","type":"object","name":"action"},{"_id":"5915c96042c6a22300b9f037","ref":"","in":"body","required":true,"desc":"[Audience](doc:moca-api-audience) object that defines who will the notification be sent to.","default":"","type":"object","name":"audience"},{"_id":"5915c96042c6a22300b9f036","ref":"","in":"body","required":false,"desc":"Set to false to immediately confirm the notification.","default":"true","type":"boolean","name":"draft"},{"_id":"5915c96042c6a22300b9f035","ref":"","in":"body","required":false,"desc":"Set to true to simulate sending a notification. All stats will be generated, only the actual sending is skipped.","default":"false","type":"boolean","name":"dryRun"}],"results":{"codes":[{"name":"","code":"{\n  \"createdAt\": 1494587968146,\n  \"updatedAt\": 1494587968146,\n  \"notificationId\": \"SFvZPd2CSuu1mUrecUN6Mg\",\n  \"campaignId\": \"A1d0sNtdQwaMpAKsX99cMQ\",\n  \"appId\": \"IXa7Bl9oRo6c7zQ5aQIzlg\",\n  \"config\": {\n    \"name\": \"Visit invitation\"\n  },\n  \"trigger\": {\n    \"@type\": \"TimeTrigger\",\n    \"time\": 1494586642000\n  },\n  \"audience\": {\n    \"type\": \"Query\",\n    \"query\": \"{ \\\"$all\\\": [ { \\\"lang\\\": \\\"en\\\" }, { \\\"os\\\": \\\"Android\\\" } ] }\"\n  },\n  \"action\": {\n    \"@type\": \"OpenUrlAction\",\n    \"contentType\": \"text/x-url\",\n    \"content\": {\n      \"default\": \"http://www.mocaplatform.com\"\n    },\n    \"bgAlert\": {\n      \"default\": \"Come visit us at MOCA!\"\n    }\n  },\n  \"options\": {\n    \"draft\": false\n  },\n  \"statusReport\": {\n    \"status\": \"Pending\",\n    \"execTimeMs\": null,\n    \"requestedDevices\": null,\n    \"processedDevices\": 0,\n    \"targetDevices\": null,\n    \"sentMessages\": 0\n  }\n}","language":"json","status":201},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Validation constraints violated\",\n  \"constraints\": {\n    \"create.request.config.name\": \"cannot be null\",\n    \"create.request.trigger\": \"cannot be null\",\n    \"create.request.audience\": \"cannot be null\",\n    \"create.request.action\": \"cannot be null\"\n  }\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Could not parse JSON: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property '@type' that is to contain type id  (for class com.iq.moca.services.model.triggers.Trigger)\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/notifications/:notificationId"},"excerpt":"Updates an already existing Notification.","githubsync":"","link_url":"","next":{"description":"","pages":[]},"type":"put","user":"55a54dde9c32760d00ca78a8","__v":1,"createdAt":"2017-05-12T14:46:38.002Z","order":6,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-update-notification","title":"Update notification","updates":[],"category":"58e76f2a654e3839008655d2","hidden":false,"link_external":false,"sync_unique":"","childrenPages":[]}

putUpdate notification

Updates an already existing Notification.

Path Params

notificationId:
required
string
Id of the Notification to be updated.

Body Params

config:
required
object
Notification [configuration](doc:moca-api-notifications)
trigger:
required
object
[Trigger](doc:moca-api-triggers-notification) object that defines when the experience is triggered.
action:
required
object
[Action](doc:moca-api-actions) object that defines what happens when the experience is triggered.
audience:
required
object
[Audience](doc:moca-api-audience) object that defines who will the notification be sent to.
draft:
booleantrue
Set to false to immediately confirm the notification.
dryRun:
booleanfalse
Set to true to simulate sending a notification. All stats will be generated, only the actual sending is skipped.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5915c604629c911b008cb83c","title":"Confirm notification","version":"58e76f2a654e3839008655c8","api":{"auth":"required","examples":{"codes":[]},"method":"put","params":[{"name":"notificationId","_id":"55aca9796b4ff90d00784a8e","ref":"","in":"path","required":true,"desc":"Id of the Notification to be confirmed.","default":"","type":"string"}],"results":{"codes":[{"name":"","code":"","language":"json","status":204},{"code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Illegal state\"\n}","language":"json","status":400},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json","status":401}]},"settings":"","url":"/notifications/:notificationId/confirm"},"category":"58e76f2a654e3839008655d2","createdAt":"2017-05-12T14:26:12.345Z","isReference":true,"slug":"moca-api-confirm-notification","__v":1,"body":"","hidden":false,"sync_unique":"","project":"559a61d2dbcfd20d00710b39","type":"put","excerpt":"Sets a Draft/Cancelled Notification into Pending state.","link_external":false,"link_url":"","next":{"pages":[],"description":""},"order":7,"parentDoc":null,"githubsync":"","updates":[],"user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

putConfirm notification

Sets a Draft/Cancelled Notification into Pending state.

Path Params

notificationId:
required
string
Id of the Notification to be confirmed.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"5915c6c1f03c0919002dad71","githubsync":"","isReference":true,"excerpt":"Cancels a Pending/Enqueued Notification and allows for further modifications to be done.","order":8,"parentDoc":null,"createdAt":"2017-05-12T14:29:21.410Z","hidden":false,"link_external":false,"sync_unique":"","type":"put","version":"58e76f2a654e3839008655c8","project":"559a61d2dbcfd20d00710b39","__v":0,"api":{"auth":"required","examples":{"codes":[]},"method":"put","params":[{"ref":"","required":true,"type":"string","_id":"55aca9796b4ff90d00784a8e","default":"","desc":"Id of the Notification to be cancelled.","in":"path","name":"notificationId"}],"results":{"codes":[{"name":"","status":204,"language":"json","code":""},{"status":400,"language":"json","code":"{\n  \"error\": \"Bad Request\",\n  \"error_description\": \"Illegal state\"\n}"},{"status":401,"language":"json","code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}"}]},"settings":"","url":"/notifications/:notificationId/cancel"},"body":"","category":"58e76f2a654e3839008655d2","link_url":"","next":{"pages":[],"description":""},"slug":"moca-api-cancel-notification","title":"Cancel notification","updates":[],"user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

putCancel notification

Cancels a Pending/Enqueued Notification and allows for further modifications to be done.

Path Params

notificationId:
required
string
Id of the Notification to be cancelled.

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"5915c3b67c2c552d008b836a","isReference":true,"next":{"pages":[],"description":""},"order":9,"project":"559a61d2dbcfd20d00710b39","slug":"moca-api-delete-notification","type":"delete","updates":[],"createdAt":"2017-05-12T14:16:22.318Z","githubsync":"","link_external":false,"parentDoc":null,"category":"58e76f2a654e3839008655d2","link_url":"","title":"Delete notification","user":"55a54dde9c32760d00ca78a8","version":"58e76f2a654e3839008655c8","body":"","api":{"settings":"","results":{"codes":[{"code":"","language":"json","status":204,"name":""},{"status":401,"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","language":"json"}]},"method":"delete","examples":{"codes":[]},"auth":"required","params":[{"_id":"55ae008c8576b92300291c26","ref":"","in":"path","required":true,"desc":"Id of the Notification to be deleted.","default":"","type":"string","name":"notificationId"}],"url":"/notifications/:notificationId"},"excerpt":"Deletes a Notification.","hidden":false,"sync_unique":"","__v":1,"childrenPages":[]}

deleteDelete notification

Deletes a Notification.

Path Params

notificationId:
required
string
Id of the Notification to be deleted.

User Information

Try It Out

delete
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}


{"_id":"5922ead6e465c11900920f96","isReference":true,"project":"559a61d2dbcfd20d00710b39","link_external":false,"next":{"pages":[],"description":""},"sync_unique":"","title":"Overview","createdAt":"2017-05-22T13:42:46.438Z","excerpt":"","hidden":false,"link_url":"","order":0,"slug":"moca-api-analytics","type":"basic","user":"55a54dde9c32760d00ca78a8","body":"The Analytics API enables users to query customized analytics reports within a MOCA app.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e904434-moca-analytics-campaigns.jpg\",\n        \"moca-analytics-campaigns.jpg\",\n        1200,\n        800,\n        \"#edf3f5\"\n      ],\n      \"caption\": \"All analytics used in MOCA Console are extracted using our Analytics API\"\n    }\n  ]\n}\n[/block]\nThere are 10 (and growing) analytics domains available, each with its own different metrics.","version":"58e76f2a654e3839008655c8","api":{"url":"","settings":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"status":400,"name":"","code":"{}","language":"json"}]},"auth":"required","params":[]},"category":"58e76f2a654e3839008655d3","githubsync":"","parentDoc":null,"updates":[],"__v":0,"childrenPages":[]}

Overview


The Analytics API enables users to query customized analytics reports within a MOCA app. [block:image] { "images": [ { "image": [ "https://files.readme.io/e904434-moca-analytics-campaigns.jpg", "moca-analytics-campaigns.jpg", 1200, 800, "#edf3f5" ], "caption": "All analytics used in MOCA Console are extracted using our Analytics API" } ] } [/block] There are 10 (and growing) analytics domains available, each with its own different metrics.
The Analytics API enables users to query customized analytics reports within a MOCA app. [block:image] { "images": [ { "image": [ "https://files.readme.io/e904434-moca-analytics-campaigns.jpg", "moca-analytics-campaigns.jpg", 1200, 800, "#edf3f5" ], "caption": "All analytics used in MOCA Console are extracted using our Analytics API" } ] } [/block] There are 10 (and growing) analytics domains available, each with its own different metrics.
{"_id":"5922eab761ca710f003f2fd8","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":"","settings":""},"sync_unique":"","githubsync":"","hidden":false,"slug":"moca-api-query-filter","type":"basic","version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d3","excerpt":"An analytics filter query defines a boolean expression that determines which data is included/aggregated into a metric.","link_url":"","next":{"pages":[],"description":""},"order":1,"body":"A basic query has the following format:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"filters\\\": [\\n  { \\\"field\\\": <field1>, \\\"relOp\\\": <op1>, \\\"value\\\": <value1> },\\n  { \\\"field\\\": <field2>, \\\"relOp\\\": <op2>, \\\"value\\\": <value2> }, ...\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Format\"\n    }\n  ]\n}\n[/block]\nWhere `field1` is the field to be filtered, as defined in [Overview](doc:moca-api-analytics), `relOp` the operation to be applied over the field, and `value1` the argument for such operation.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Relational Operators\",\n  \"body\": \"Available operators are: `=`, `<`, `<=`, `>`, `>=`, `<>`, `!=`, `is`, `is not` and `in`\\n\\nOmitting `relOp` is equivalent to using the `=` operator.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"filters\\\": [\\n  { \\\"field\\\": \\\"user:lang\\\", \\\"value\\\": \\\"en\\\" },\\n  { \\\"field\\\": \\\"device:os\\\", \\\"relOp\\\": \\\"!=\\\", \\\"value\\\": \\\"Android\\\" }\\n]\",\n      \"language\": \"json\",\n      \"name\": \"Example\"\n    }\n  ]\n}\n[/block]\nWhen applying this filter, gathered metrics will contain data from English non-Android devices.","createdAt":"2017-05-22T13:42:15.214Z","isReference":true,"link_external":false,"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","title":"Filters","updates":[],"__v":0,"user":"55a54dde9c32760d00ca78a8","childrenPages":[]}

Filters

An analytics filter query defines a boolean expression that determines which data is included/aggregated into a metric.

A basic query has the following format: [block:code] { "codes": [ { "code": "\"filters\": [\n { \"field\": <field1>, \"relOp\": <op1>, \"value\": <value1> },\n { \"field\": <field2>, \"relOp\": <op2>, \"value\": <value2> }, ...\n]", "language": "json", "name": "Format" } ] } [/block] Where `field1` is the field to be filtered, as defined in [Overview](doc:moca-api-analytics), `relOp` the operation to be applied over the field, and `value1` the argument for such operation. [block:callout] { "type": "info", "title": "Relational Operators", "body": "Available operators are: `=`, `<`, `<=`, `>`, `>=`, `<>`, `!=`, `is`, `is not` and `in`\n\nOmitting `relOp` is equivalent to using the `=` operator." } [/block] [block:code] { "codes": [ { "code": "\"filters\": [\n { \"field\": \"user:lang\", \"value\": \"en\" },\n { \"field\": \"device:os\", \"relOp\": \"!=\", \"value\": \"Android\" }\n]", "language": "json", "name": "Example" } ] } [/block] When applying this filter, gathered metrics will contain data from English non-Android devices.
A basic query has the following format: [block:code] { "codes": [ { "code": "\"filters\": [\n { \"field\": <field1>, \"relOp\": <op1>, \"value\": <value1> },\n { \"field\": <field2>, \"relOp\": <op2>, \"value\": <value2> }, ...\n]", "language": "json", "name": "Format" } ] } [/block] Where `field1` is the field to be filtered, as defined in [Overview](doc:moca-api-analytics), `relOp` the operation to be applied over the field, and `value1` the argument for such operation. [block:callout] { "type": "info", "title": "Relational Operators", "body": "Available operators are: `=`, `<`, `<=`, `>`, `>=`, `<>`, `!=`, `is`, `is not` and `in`\n\nOmitting `relOp` is equivalent to using the `=` operator." } [/block] [block:code] { "codes": [ { "code": "\"filters\": [\n { \"field\": \"user:lang\", \"value\": \"en\" },\n { \"field\": \"device:os\", \"relOp\": \"!=\", \"value\": \"Android\" }\n]", "language": "json", "name": "Example" } ] } [/block] When applying this filter, gathered metrics will contain data from English non-Android devices.
{"_id":"5923136e5c48c70f00f218e5","createdAt":"2017-05-22T16:35:58.149Z","excerpt":"Queries up to 5 analytic metrics.","githubsync":"","next":{"pages":[],"description":""},"api":{"results":{"codes":[{"language":"json","code":"[\n  {\n    \"name\": \"geo\",\n    \"dimensions\": [\n      \"time:hour\",\n      \"time:month\",\n      \"time:year\",\n      \"time:day\",\n      \"time:hour_of_day\",\n      \"time:timestamp\",\n      \"time:minute\",\n      \"time:day_of_week\",\n      \"app:version\",\n      \"app:key\",\n      \"user:country_code\",\n      \"user:country\",\n      \"user:lang_code\",\n      \"user:id\",\n      \"user:lang\",\n      \"geo:hash5\",\n      \"geo:hash4\",\n      ...\n    ],\n    \"metrics\": [\n      \"count\",\n      \"users\",\n      \"new_users\",\n      \"returning_users\",\n      \"active_users\"\n    ],\n    \"filters\": [\n      \"time:hour\",\n      \"time:month\",\n      \"time:year\",\n      \"time:day\",\n      \"time:hour_of_day\",\n      \"time:timestamp\",\n      \"time:minute\",\n      \"time:day_of_week\",\n      \"app:version\",\n      \"app:key\",\n      \"user:country_code\",\n      \"user:country\",\n      \"user:lang_code\",\n      \"user:id\",\n      \"user:lang\",\n      \"geo:hash5\",\n      \"geo:hash4\",\n      ...\n    ]\n  },\n  {\n    \"name\": \"proximity\",\n    \"dimensions\": [...],\n    \"metrics\": [...],\n    \"filters\": [...]\n  },\n  {\n    \"name\": \"session\",\n    \"dimensions\": [...],\n    \"metrics\": [...],\n    \"filters\": [...]\n  },\n  {...}\n]","name":"","status":200},{"code":"{\n  \"error\": \"Unauthorized\",\n  \"error_description\": \"Access is denied\"\n}","status":401,"language":"json"}]},"settings":"","url":"/analytics/domains/:domain","auth":"required","examples":{"codes":[]},"method":"get","params":[{"_id":"59d24e8bcadaf900269a50c3","ref":"","in":"path","required":false,"desc":"Name of the domain to be consulted. Omit to retrieve all domains.","default":"","type":"string","name":"domain"}]},"link_url":"","sync_unique":"","user":"55a54dde9c32760d00ca78a8","__v":3,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Domain definition\",\n  \"body\": \"A domain is used to identify one or more analytics kind \\n\\nFor example :\\nsession , geo , proximity ...\"\n}\n[/block]","isReference":true,"order":2,"parentDoc":null,"slug":"moca-api-analytics-domains","updates":[],"version":"58e76f2a654e3839008655c8","category":"58e76f2a654e3839008655d3","hidden":false,"link_external":false,"project":"559a61d2dbcfd20d00710b39","title":"Get domain info","type":"get","childrenPages":[]}

getGet domain info

Queries up to 5 analytic metrics.

Path Params

domain:
string
Name of the domain to be consulted. Omit to retrieve all domains.
[block:callout] { "type": "info", "title": "Domain definition", "body": "A domain is used to identify one or more analytics kind \n\nFor example :\nsession , geo , proximity ..." } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ a