{"_id":"54512f34a66f020800dbab10","version":{"_id":"53844558a43e08da4677be12","__v":8,"project":"53844557a43e08da4677be0e","createdAt":"2014-05-27T07:57:12.136Z","releaseDate":"2014-05-27T07:57:12.136Z","categories":["53844558a43e08da4677be13","538619e1ef91f96d49aa1a0b","541e82877eb16bb64f83c0ca","5445a073c3eb3808000c76b2","5445a098c3eb3808000c76b3","54bb05ab522f03150054d9e8","54bb05cf9741c81500078f73","55b7d0e5568be2230092bb92"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"false","version_clean":"1.0.0","version":"1.0"},"is_link":false,"category":{"_id":"53844558a43e08da4677be13","pages":["53844558a43e08da4677be14","54211ad2f980dee664db9fc5","54212689f980dee664db9fc9","5421d851f980dee664db9ffe","54504d643c6f700800a9b4de","548f7589a8f6730b004b34b3","554a9af6b4322819002b6a1b","55a44d8b1fd6fb0d00d6fb2a"],"project":"53844557a43e08da4677be0e","version":"53844558a43e08da4677be12","__v":14,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-05-27T07:57:12.144Z","from_sync":false,"order":0,"slug":"general-api-documentation","title":"General API Documentation"},"project":"53844557a43e08da4677be0e","__v":2,"user":"5432d74e8780d4080074d772","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-29T18:17:24.534Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"settings":"","try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":5,"body":"Sometimes you just want to be able to increment or decrement one of your global or contact data points without persisting data and running simple computations on your server. Good news! Now you can make a regular API request to /data/edit or /contacts/upsert using either \"+1\" or \"-1\" as a data point value and we'll do the math on our end.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Global data example\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"data\\\":{\\n    \\\"total_apps_built\\\":\\\"+1\\\",\\n    \\\"days_to_launch\\\":\\\"-1\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Contact data example\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"contacts\\\": [\\n        {\\n            \\\"email\\\":\\\"contact:::at:::test.com\\\",\\n            \\\"data\\\":{\\n                \\\"downloads\\\":\\\"+1\\\",\\n              \\t\\\"friends_invited\\\":\\\"+1\\\"\\n            }\\n        }\\n   \\t]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"or decrementing if you're feeling pessimistic ;)","slug":"incrementing-data-points","type":"basic","title":"INCREMENTING DATA POINTS"}

INCREMENTING DATA POINTS

or decrementing if you're feeling pessimistic ;)

Sometimes you just want to be able to increment or decrement one of your global or contact data points without persisting data and running simple computations on your server. Good news! Now you can make a regular API request to /data/edit or /contacts/upsert using either "+1" or "-1" as a data point value and we'll do the math on our end. [block:api-header] { "type": "basic", "title": "Global data example" } [/block] [block:code] { "codes": [ { "code": "{\n \"data\":{\n \"total_apps_built\":\"+1\",\n \"days_to_launch\":\"-1\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Contact data example" } [/block] [block:code] { "codes": [ { "code": "{\n \"contacts\": [\n {\n \"email\":\"contact@test.com\",\n \"data\":{\n \"downloads\":\"+1\",\n \t\"friends_invited\":\"+1\"\n }\n }\n \t]\n}", "language": "json" } ] } [/block]