{"action":"created","comment":{"url":"https://api.github.com/repos/Constructor-io/slate/pulls/comments/58955439","id":58955439,"diff_hunk":"@@ -82,6 +82,58 @@ image_url | No | A URL that points to an image you'd like displayed next to some\n description | No | A description for some item (only applicable when url is supplied)\n id | No | An arbitrary ID you would like associated with this item.  You can use this field to store your own IDs of the items to more easily access them in other API calls.\n \n+## Add or Update an Item\n+\n+```javascript\n+ ```\n+\n+```ruby\n+```\n+\n+ ```php\n+\n+ <?php\n+\n+// Let's create our item first\n+\n+response = $constructor->addOrUpdate(\"power drill\", \"Products\");\n+\n+// Now we can add some extended parameters\n+\n+$params = array(\"id\" => 3920, \"url\" => \"/products/power-drill\", \"image_url\" => \"/images/power-drill.jpg\")\n+\n+response = $constructor->addOrUpdate(\"power drill\", \"Products\", $params)\n+\n+// Constructor sees that the \"power drill\" item already exists, and just adds the extended parameters (id, url, image_url) to the item.\n+\n+ ```\n+ \n+ ```perl\n+ ```\n+\n+ > The above commands return a 204 Success response on success.\n+\n+An add or update operation (also known as an `UPSERT`) updates an item in your autocomplete index if it already exists, or adds the item to your index if it does not yet exist. ","path":"source/includes/_autocomplete_items.md","position":35,"original_position":35,"commit_id":"da77821dde0eec45b2ed92384b9f842a02f2cf59","original_commit_id":"da77821dde0eec45b2ed92384b9f842a02f2cf59","user":{"login":"danmcc","id":171131,"avatar_url":"https://avatars.githubusercontent.com/u/171131?v=3","gravatar_id":"","url":"https://api.github.com/users/danmcc","html_url":"https://github.com/danmcc","followers_url":"https://api.github.com/users/danmcc/followers","following_url":"https://api.github.com/users/danmcc/following{/other_user}","gists_url":"https://api.github.com/users/danmcc/gists{/gist_id}","starred_url":"https://api.github.com/users/danmcc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danmcc/subscriptions","organizations_url":"https://api.github.com/users/danmcc/orgs","repos_url":"https://api.github.com/users/danmcc/repos","events_url":"https://api.github.com/users/danmcc/events{/privacy}","received_events_url":"https://api.github.com/users/danmcc/received_events","type":"User","site_admin":false},"body":"One question devs will have at this point is, \"how does Constructor.io identify whether an item exists?\"  We should mention here that it's based on the combo of the item_name and the autocomplete_section OR the customer ID.  @EliFinkelshteyn -- is that right?","created_at":"2016-04-07T22:24:16Z","updated_at":"2016-04-07T22:24:16Z","html_url":"https://github.com/Constructor-io/slate/pull/6#discussion_r58955439","pull_request_url":"https://api.github.com/repos/Constructor-io/slate/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/Constructor-io/slate/pulls/comments/58955439"},"html":{"href":"https://github.com/Constructor-io/slate/pull/6#discussion_r58955439"},"pull_request":{"href":"https://api.github.com/repos/Constructor-io/slate/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/Constructor-io/slate/pulls/6","id":65698849,"html_url":"https://github.com/Constructor-io/slate/pull/6","diff_url":"https://github.com/Constructor-io/slate/pull/6.diff","patch_url":"https://github.com/Constructor-io/slate/pull/6.patch","issue_url":"https://api.github.com/repos/Constructor-io/slate/issues/6","number":6,"state":"open","locked":false,"title":"First stab at add or update item. PHP code sample & intro text.","user":{"login":"adetch","id":1463387,"avatar_url":"https://avatars.githubusercontent.com/u/1463387?v=3","gravatar_id":"","url":"https://api.github.com/users/adetch","html_url":"https://github.com/adetch","followers_url":"https://api.github.com/users/adetch/followers","following_url":"https://api.github.com/users/adetch/following{/other_user}","gists_url":"https://api.github.com/users/adetch/gists{/gist_id}","starred_url":"https://api.github.com/users/adetch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adetch/subscriptions","organizations_url":"https://api.github.com/users/adetch/orgs","repos_url":"https://api.github.com/users/adetch/repos","events_url":"https://api.github.com/users/adetch/events{/privacy}","received_events_url":"https://api.github.com/users/adetch/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-07T20:59:55Z","updated_at":"2016-04-07T22:24:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a41dd181850692aa98333ba9e101787bdc99c616","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Constructor-io/slate/pulls/6/commits","review_comments_url":"https://api.github.com/repos/Constructor-io/slate/pulls/6/comments","review_comment_url":"https://api.github.com/repos/Constructor-io/slate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Constructor-io/slate/issues/6/comments","statuses_url":"https://api.github.com/repos/Constructor-io/slate/statuses/da77821dde0eec45b2ed92384b9f842a02f2cf59","head":{"label":"Constructor-io:feature-addOrUpdate","ref":"feature-addOrUpdate","sha":"da77821dde0eec45b2ed92384b9f842a02f2cf59","user":{"login":"Constructor-io","id":9828194,"avatar_url":"https://avatars.githubusercontent.com/u/9828194?v=3","gravatar_id":"","url":"https://api.github.com/users/Constructor-io","html_url":"https://github.com/Constructor-io","followers_url":"https://api.github.com/users/Constructor-io/followers","following_url":"https://api.github.com/users/Constructor-io/following{/other_user}","gists_url":"https://api.github.com/users/Constructor-io/gists{/gist_id}","starred_url":"https://api.github.com/users/Constructor-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Constructor-io/subscriptions","organizations_url":"https://api.github.com/users/Constructor-io/orgs","repos_url":"https://api.github.com/users/Constructor-io/repos","events_url":"https://api.github.com/users/Constructor-io/events{/privacy}","received_events_url":"https://api.github.com/users/Constructor-io/received_events","type":"Organization","site_admin":false},"repo":{"id":39268417,"name":"slate","full_name":"Constructor-io/slate","owner":{"login":"Constructor-io","id":9828194,"avatar_url":"https://avatars.githubusercontent.com/u/9828194?v=3","gravatar_id":"","url":"https://api.github.com/users/Constructor-io","html_url":"https://github.com/Constructor-io","followers_url":"https://api.github.com/users/Constructor-io/followers","following_url":"https://api.github.com/users/Constructor-io/following{/other_user}","gists_url":"https://api.github.com/users/Constructor-io/gists{/gist_id}","starred_url":"https://api.github.com/users/Constructor-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Constructor-io/subscriptions","organizations_url":"https://api.github.com/users/Constructor-io/orgs","repos_url":"https://api.github.com/users/Constructor-io/repos","events_url":"https://api.github.com/users/Constructor-io/events{/privacy}","received_events_url":"https://api.github.com/users/Constructor-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Constructor-io/slate","description":"Beautiful static documentation for your API","fork":true,"url":"https://api.github.com/repos/Constructor-io/slate","forks_url":"https://api.github.com/repos/Constructor-io/slate/forks","keys_url":"https://api.github.com/repos/Constructor-io/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Constructor-io/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Constructor-io/slate/teams","hooks_url":"https://api.github.com/repos/Constructor-io/slate/hooks","issue_events_url":"https://api.github.com/repos/Constructor-io/slate/issues/events{/number}","events_url":"https://api.github.com/repos/Constructor-io/slate/events","assignees_url":"https://api.github.com/repos/Constructor-io/slate/assignees{/user}","branches_url":"https://api.github.com/repos/Constructor-io/slate/branches{/branch}","tags_url":"https://api.github.com/repos/Constructor-io/slate/tags","blobs_url":"https://api.github.com/repos/Constructor-io/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Constructor-io/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Constructor-io/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/Constructor-io/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Constructor-io/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/Constructor-io/slate/languages","stargazers_url":"https://api.github.com/repos/Constructor-io/slate/stargazers","contributors_url":"https://api.github.com/repos/Constructor-io/slate/contributors","subscribers_url":"https://api.github.com/repos/Constructor-io/slate/subscribers","subscription_url":"https://api.github.com/repos/Constructor-io/slate/subscription","commits_url":"https://api.github.com/repos/Constructor-io/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/Constructor-io/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/Constructor-io/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/Constructor-io/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/Constructor-io/slate/contents/{+path}","compare_url":"https://api.github.com/repos/Constructor-io/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Constructor-io/slate/merges","archive_url":"https://api.github.com/repos/Constructor-io/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Constructor-io/slate/downloads","issues_url":"https://api.github.com/repos/Constructor-io/slate/issues{/number}","pulls_url":"https://api.github.com/repos/Constructor-io/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/Constructor-io/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/Constructor-io/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Constructor-io/slate/labels{/name}","releases_url":"https://api.github.com/repos/Constructor-io/slate/releases{/id}","deployments_url":"https://api.github.com/repos/Constructor-io/slate/deployments","created_at":"2015-07-17T18:11:25Z","updated_at":"2016-01-29T23:37:19Z","pushed_at":"2016-04-07T21:01:27Z","git_url":"git://github.com/Constructor-io/slate.git","ssh_url":"git@github.com:Constructor-io/slate.git","clone_url":"https://github.com/Constructor-io/slate.git","svn_url":"https://github.com/Constructor-io/slate","homepage":"","size":698,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Constructor-io:master","ref":"master","sha":"6b9d435d654855b6b35afd3212b3fba73a83e81f","user":{"login":"Constructor-io","id":9828194,"avatar_url":"https://avatars.githubusercontent.com/u/9828194?v=3","gravatar_id":"","url":"https://api.github.com/users/Constructor-io","html_url":"https://github.com/Constructor-io","followers_url":"https://api.github.com/users/Constructor-io/followers","following_url":"https://api.github.com/users/Constructor-io/following{/other_user}","gists_url":"https://api.github.com/users/Constructor-io/gists{/gist_id}","starred_url":"https://api.github.com/users/Constructor-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Constructor-io/subscriptions","organizations_url":"https://api.github.com/users/Constructor-io/orgs","repos_url":"https://api.github.com/users/Constructor-io/repos","events_url":"https://api.github.com/users/Constructor-io/events{/privacy}","received_events_url":"https://api.github.com/users/Constructor-io/received_events","type":"Organization","site_admin":false},"repo":{"id":39268417,"name":"slate","full_name":"Constructor-io/slate","owner":{"login":"Constructor-io","id":9828194,"avatar_url":"https://avatars.githubusercontent.com/u/9828194?v=3","gravatar_id":"","url":"https://api.github.com/users/Constructor-io","html_url":"https://github.com/Constructor-io","followers_url":"https://api.github.com/users/Constructor-io/followers","following_url":"https://api.github.com/users/Constructor-io/following{/other_user}","gists_url":"https://api.github.com/users/Constructor-io/gists{/gist_id}","starred_url":"https://api.github.com/users/Constructor-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Constructor-io/subscriptions","organizations_url":"https://api.github.com/users/Constructor-io/orgs","repos_url":"https://api.github.com/users/Constructor-io/repos","events_url":"https://api.github.com/users/Constructor-io/events{/privacy}","received_events_url":"https://api.github.com/users/Constructor-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Constructor-io/slate","description":"Beautiful static documentation for your API","fork":true,"url":"https://api.github.com/repos/Constructor-io/slate","forks_url":"https://api.github.com/repos/Constructor-io/slate/forks","keys_url":"https://api.github.com/repos/Constructor-io/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Constructor-io/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Constructor-io/slate/teams","hooks_url":"https://api.github.com/repos/Constructor-io/slate/hooks","issue_events_url":"https://api.github.com/repos/Constructor-io/slate/issues/events{/number}","events_url":"https://api.github.com/repos/Constructor-io/slate/events","assignees_url":"https://api.github.com/repos/Constructor-io/slate/assignees{/user}","branches_url":"https://api.github.com/repos/Constructor-io/slate/branches{/branch}","tags_url":"https://api.github.com/repos/Constructor-io/slate/tags","blobs_url":"https://api.github.com/repos/Constructor-io/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Constructor-io/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Constructor-io/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/Constructor-io/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Constructor-io/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/Constructor-io/slate/languages","stargazers_url":"https://api.github.com/repos/Constructor-io/slate/stargazers","contributors_url":"https://api.github.com/repos/Constructor-io/slate/contributors","subscribers_url":"https://api.github.com/repos/Constructor-io/slate/subscribers","subscription_url":"https://api.github.com/repos/Constructor-io/slate/subscription","commits_url":"https://api.github.com/repos/Constructor-io/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/Constructor-io/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/Constructor-io/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/Constructor-io/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/Constructor-io/slate/contents/{+path}","compare_url":"https://api.github.com/repos/Constructor-io/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Constructor-io/slate/merges","archive_url":"https://api.github.com/repos/Constructor-io/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Constructor-io/slate/downloads","issues_url":"https://api.github.com/repos/Constructor-io/slate/issues{/number}","pulls_url":"https://api.github.com/repos/Constructor-io/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/Constructor-io/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/Constructor-io/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Constructor-io/slate/labels{/name}","releases_url":"https://api.github.com/repos/Constructor-io/slate/releases{/id}","deployments_url":"https://api.github.com/repos/Constructor-io/slate/deployments","created_at":"2015-07-17T18:11:25Z","updated_at":"2016-01-29T23:37:19Z","pushed_at":"2016-04-07T21:01:27Z","git_url":"git://github.com/Constructor-io/slate.git","ssh_url":"git@github.com:Constructor-io/slate.git","clone_url":"https://github.com/Constructor-io/slate.git","svn_url":"https://github.com/Constructor-io/slate","homepage":"","size":698,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Constructor-io/slate/pulls/6"},"html":{"href":"https://github.com/Constructor-io/slate/pull/6"},"issue":{"href":"https://api.github.com/repos/Constructor-io/slate/issues/6"},"comments":{"href":"https://api.github.com/repos/Constructor-io/slate/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/Constructor-io/slate/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/Constructor-io/slate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Constructor-io/slate/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/Constructor-io/slate/statuses/da77821dde0eec45b2ed92384b9f842a02f2cf59"}}}}