{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Update Index API","type":"basic","slug":"update-index-api","excerpt":"","body":"For partners using Gooru Search Index, this API allows for periodic update of the same by identifying content items deleted / dropped from Gooru Search index. Gooru maintains the deleted items index for a period of one year. \n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"1. Authentication\"\n}\n[/block]\nAll Gooru API calls must be authenticated using access tokens. To acquire an access token you need an Client Id and Client Secret key. Contact support:::at:::gooru.org for the necessary detail.\n\n**Authenticating with a Client Id and Client Key\n**\nOnce you have a ClientId and Client Key, making API calls is very easy and simple. Please follow the below steps:\n * Call to obtain access token API with header “Authorization”. \n * Header name “Authorization” and header value “Basic [access_token]” \n * Header value is “Basic base64encode(username:password)” - meaning have to encode(base64) “username:password” string and pass it to header. \n * From the the response, extract the “access_token” field that will be needed for subsequent API \n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -i -H \\\"Content-Type: application/json\\\" -H \\\"Authorization: Basic b2liZ2FuZzlAZ29vcnUub3JnOmRvbjEyMzQ=\\\" -d '{ \\\"client_key\\\": \\\"c2hlZWJhbkBnb29ydWxlYXJuaW5nLm9yZw==\\\", \\\"client_id\\\": \\\"ba956a97-ae15-11e5-a302-f8a963065976\\\", \\\"grant_type\\\": \\\"credential\\\" }' -X POST http://gooru.org/api/nucleus-auth/v1/token\",\n \"language\": \"curl\",\n \"name\": \"Sample request\"\n }\n ]\n}\n[/block]\n\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{\\\"user_id\\\":\\\"e1ed49eb-35a0-489b-8dda-b4f7459a1d1d\\\",\\\"username\\\":\\\"david\\\",\\\"client_id\\\":\\\"ba956a97-ae15-11e5-a302-f8a963065976\\\",\\\"provided_at\\\":1466412833174,\\\"prefs\\\":{\\\"email_id\\\":\\\"[email protected]\\\"},\\\"cdn_urls\\\":{\\\"user_cdn_url\\\":\\\"//usercdn.gooru.org/\\\",\\\"content_cdn_url\\\":\\\"//cdn.gooru.org/\\\"},\\\"access_token\\\":\\\"MTQ2NjQxMjgzMzE3NDplMWVkNDllYi0zNWEwLTQ4OWItOGRkYS1iNGY3NDU5YTFkMWQ6YmE5NTZhOTctYWUxNS0xMWU1LWEzMDItZjhhOTYzMDY1OTc2\\\",\\\"firstname\\\":\\\"David\\\",\\\"lastname\\\":\\\"B\\\",\\\"user_category\\\":\\\"student\\\"}\",\n \"language\": \"json\",\n \"name\": \"Response JSON\"\n }\n ]\n}\n[/block]\n\n[block:api-header]\n{\n \"type\": \"basic\",\n \"title\": \"2. Get Deleted Items\"\n}\n[/block]\nGiven a content type and timestamp, get the list of deleted content.\n\n**Method Type**\nGET\n\n**API ** \n{REST_END_POINT}/api/nucleus-track-index/v1/deleted-items/{type}\n\n**Request Headers** \n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Header\",\n \"h-1\": \"Value\",\n \"h-2\": \"Description\",\n \"0-0\": \"Authorization\",\n \"0-1\": \"Token {TOKEN}\",\n \"0-2\": \"Replace the {TOKEN} with actual value of access token obtained from authentication.\",\n \"1-0\": \"Content-Type\",\n \"1-1\": \"application/json\"\n },\n \"cols\": 3,\n \"rows\": 2\n}\n[/block]\n**Path Variables** \n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Name\",\n \"h-1\": \"Data Type\",\n \"h-2\": \"Mandatory\",\n \"h-3\": \"Accepted Values\",\n \"0-0\": \"type\",\n \"0-1\": \"String\",\n \"0-2\": \"Yes\",\n \"0-3\": \"\\\"resource\\\" / \\\"collection\\\"\"\n },\n \"cols\": 4,\n \"rows\": 1\n}\n[/block]\n**Request Parameters** \n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Name\",\n \"0-0\": \"deletedSince\",\n \"1-0\": \"pageNum\",\n \"2-0\": \"pageSize\",\n \"h-1\": \"Data Type\",\n \"0-1\": \"Long\",\n \"1-1\": \"Integer\",\n \"2-1\": \"Integer\",\n \"h-2\": \"Mandatory\",\n \"0-2\": \"Yes\",\n \"1-2\": \"No\",\n \"2-2\": \"No\",\n \"h-3\": \"Default Value\",\n \"0-3\": \"--\",\n \"1-3\": \"1\",\n \"2-3\": \"30\",\n \"h-4\": \"Comment\",\n \"0-4\": \"This timestamp should be in milliseconds and cannot go back more than a year from current time\",\n \"1-4\": \"Page to fetch\",\n \"2-4\": \"Limit to fetch, only 30 records will be given in single call. Increment pageNum to get next set of results.\"\n },\n \"cols\": 5,\n \"rows\": 3\n}\n[/block]\n**Response Header** \n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Header\",\n \"h-1\": \"Description\",\n \"0-0\": \"Index-Type\",\n \"0-1\": \"Will be index type name of the documents returned. (resource / collection)\",\n \"1-0\": \"Content-Length\",\n \"1-1\": \"Will be included if the API response has a body\",\n \"2-0\": \"Content-Type\",\n \"2-1\": \"Will be included if the API response has a body (JSON)\"\n },\n \"cols\": 2,\n \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"curl -i -H \\\"Content-Type: application/json\\\" -H \\\"Authorization: Token MTQ2OTAwNzcwNTgyMjphbm9ueW1vdXM6YmE5NTZhOTctYWUxNS0xMWU1LWEzMDItZjhhOTYzMDY1OTc2\\\" -X GET 'http://nucleus-qa.gooru.org/api/nucleus-track-index/v1/deleted-items/resource?pageNum=1&pageSize=3&deletedSince=1469007773000'\",\n \"language\": \"curl\",\n \"name\": \"Sample Request\"\n }\n ]\n}\n[/block]\n\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"{\\n \\\"meta\\\":{\\n \\\"totalCount\\\":2,\\n \\\"requestedPageSize\\\":50,\\n \\\"returnedPageSize\\\":2,\\n \\\"pageNum\\\":1\\n },\\n \\\"content\\\":[{\\n \\\"id\\\":\\\"23a9a0fc-2d29-11e3-9ab2-12314001917b\\\",\\n \\\"deletedAt\\\":\\\"2014-09-18T02:42:16Z\\\"\\n }, {\\n \\\"id\\\":\\\"e450aa64-2d27-11e3-9ab2-12314001917b\\\",\\n \\\"deletedAt\\\":\\\"2015-02-28T07:02:35Z\\\"\\n }]\\n}\",\n \"language\": \"json\",\n \"name\": \"Sample Response\"\n }\n ]\n}\n[/block]\n**HTTP Response Codes** \n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Status Code\",\n \"h-1\": \"Response Body\",\n \"h-2\": \"Description\",\n \"0-0\": \"200 : Success\",\n \"1-0\": \"400 : Bad Request\",\n \"2-0\": \"401 : Unauthorized\",\n \"3-0\": \"404 : Not Found\",\n \"4-0\": \"500 : Internal Server Error\",\n \"4-2\": \"Ideally, users should not see this. This indicates server unknown errors while processing the request. The message may be technical and may not be suitable for end user consumption.\",\n \"2-2\": \"Action requires authentication or session token may have expired. Note that we don’t return www-authenticate headers as we do not want browser to participate in the auth flow.\",\n \"3-2\": \"Entity not found\",\n \"3-1\": \"No Content\",\n \"2-1\": \"No Content\",\n \"1-2\": \"Malformed, invalid or incorrect request or request parameters noted\",\n \"1-1\": \"Specific error message\",\n \"0-1\": \"Detail for entity requested\",\n \"0-2\": \"Operation successful without error\"\n },\n \"cols\": 3,\n \"rows\": 5\n}\n[/block]","updates":[],"order":3,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5864d2df79ce642d00f0ff14","user":"567b9bf2b56bac0d0019d914","githubsync":"","__v":0,"project":"56439dfe9eebf70d00490d54","parentDoc":null,"createdAt":"2016-08-01T04:07:35.564Z","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Search API","slug":"new-search-api","order":18,"from_sync":false,"reference":false,"_id":"5864d2df79ce642d00f0feda","project":"56439dfe9eebf70d00490d54","__v":0,"version":"5864d2df79ce642d00f0fec7","createdAt":"2016-06-22T10:24:58.776Z"},"version":{"version":"2","version_clean":"2.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["5864d2df79ce642d00f0fec8","5864d2df79ce642d00f0fec9","5864d2df79ce642d00f0feca","5864d2df79ce642d00f0fecb","5864d2df79ce642d00f0fecc","5864d2df79ce642d00f0fecd","5864d2df79ce642d00f0fece","5864d2df79ce642d00f0fecf","5864d2df79ce642d00f0fed0","5864d2df79ce642d00f0fed1","5864d2df79ce642d00f0fed2","5864d2df79ce642d00f0fed3","5864d2df79ce642d00f0fed4","5864d2df79ce642d00f0fed5","5864d2df79ce642d00f0fed6","5864d2df79ce642d00f0fed7","5864d2df79ce642d00f0fed8","5864d2df79ce642d00f0fed9","5864d2df79ce642d00f0feda","5864d2df79ce642d00f0fedb","5864d2df79ce642d00f0fedc","5864d2df79ce642d00f0fedd","5864d2df79ce642d00f0fede","598aa64f4b6e990019b7a2d2","599bc76bc03fa2000f83db2a","599bcc3c3c5bf7000f3434fc","5d427dc9fa56fa0011135058","5d429c616863d5003af785a7","5d429e0889418f00c5e95d3f","5d42b5f098b05e003acb08b4","5d43c16985775c00ebeede3b","5d43d15446d584003da91e6d","5d43d61a5bdac50011b6f234","5d43d7c2db365100640dbc58","5d43d954bffa8400ff7efa78","5d43e414cf4f03005944344c","5d43eb42db365100640dbe4a","5d43ee6c78121b0057bc1dbf","5d9a18b4afc33400126c4e6f","5dc4f96dbb5da3006c8f5660"],"_id":"5864d2df79ce642d00f0fec7","createdAt":"2016-12-29T09:09:51.074Z","project":"56439dfe9eebf70d00490d54","releaseDate":"2016-12-29T09:09:51.074Z","__v":18}}