{"_id":"5864d2df79ce642d00f0ff14","user":"567b9bf2b56bac0d0019d914","__v":0,"project":"56439dfe9eebf70d00490d54","parentDoc":null,"category":{"_id":"5864d2df79ce642d00f0feda","project":"56439dfe9eebf70d00490d54","__v":0,"version":"5864d2df79ce642d00f0fec7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-22T10:24:58.776Z","from_sync":false,"order":18,"slug":"new-search-api","title":"Search API"},"version":{"_id":"5864d2df79ce642d00f0fec7","project":"56439dfe9eebf70d00490d54","__v":4,"createdAt":"2016-12-29T09:09:51.074Z","releaseDate":"2016-12-29T09:09:51.074Z","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"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-01T04:07:35.564Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"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://www.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\\\":\\\"user@example.com\\\"},\\\"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-index-tracker/v1/items/deleted\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]","excerpt":"","slug":"update-index-api","type":"basic","title":"Update Index API"}
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. [block:api-header] { "type": "basic", "title": "1. Authentication" } [/block] All 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@gooru.org for the necessary detail. **Authenticating with a Client Id and Client Key ** Once you have a ClientId and Client Key, making API calls is very easy and simple. Please follow the below steps: * Call to obtain access token API with header “Authorization”. * Header name “Authorization” and header value “Basic [access_token]” * Header value is “Basic base64encode(username:password)” - meaning have to encode(base64) “username:password” string and pass it to header. * From the the response, extract the “access_token” field that will be needed for subsequent API [block:code] { "codes": [ { "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://www.gooru.org/api/nucleus-auth/v1/token", "language": "curl", "name": "Sample request" } ] } [/block] [block:code] { "codes": [ { "code": "{\"user_id\":\"e1ed49eb-35a0-489b-8dda-b4f7459a1d1d\",\"username\":\"david\",\"client_id\":\"ba956a97-ae15-11e5-a302-f8a963065976\",\"provided_at\":1466412833174,\"prefs\":{\"email_id\":\"user@example.com\"},\"cdn_urls\":{\"user_cdn_url\":\"//usercdn.gooru.org/\",\"content_cdn_url\":\"//cdn.gooru.org/\"},\"access_token\":\"MTQ2NjQxMjgzMzE3NDplMWVkNDllYi0zNWEwLTQ4OWItOGRkYS1iNGY3NDU5YTFkMWQ6YmE5NTZhOTctYWUxNS0xMWU1LWEzMDItZjhhOTYzMDY1OTc2\",\"firstname\":\"David\",\"lastname\":\"B\",\"user_category\":\"student\"}", "language": "json", "name": "Response JSON" } ] } [/block] [block:api-header] { "type": "basic", "title": "2. Get Deleted Items" } [/block] Given a content type and timestamp, get the list of deleted content. **Method Type** GET **API ** {REST_END_POINT}/api/nucleus-index-tracker/v1/items/deleted **Request Headers** [block:parameters] { "data": { "h-0": "Header", "h-1": "Value", "h-2": "Description", "0-0": "Authorization", "0-1": "Token {TOKEN}", "0-2": "Replace the {TOKEN} with actual value of access token obtained from authentication.", "1-0": "Content-Type", "1-1": "application/json" }, "cols": 3, "rows": 2 } [/block] **Path Variables** [block:parameters] { "data": { "h-0": "Name", "h-1": "Data Type", "h-2": "Mandatory", "h-3": "Accepted Values", "0-0": "type", "0-1": "String", "0-2": "Yes", "0-3": "\"resource\" / \"collection\"" }, "cols": 4, "rows": 1 } [/block] **Request Parameters** [block:parameters] { "data": { "h-0": "Name", "0-0": "deletedSince", "1-0": "pageNum", "2-0": "pageSize", "h-1": "Data Type", "0-1": "Long", "1-1": "Integer", "2-1": "Integer", "h-2": "Mandatory", "0-2": "Yes", "1-2": "No", "2-2": "No", "h-3": "Default Value", "0-3": "--", "1-3": "1", "2-3": "30", "h-4": "Comment", "0-4": "This timestamp should be in milliseconds and cannot go back more than a year from current time", "1-4": "Page to fetch", "2-4": "Limit to fetch, only 30 records will be given in single call. Increment pageNum to get next set of results." }, "cols": 5, "rows": 3 } [/block] **Response Header** [block:parameters] { "data": { "h-0": "Header", "h-1": "Description", "0-0": "Index-Type", "0-1": "Will be index type name of the documents returned. (resource / collection)", "1-0": "Content-Length", "1-1": "Will be included if the API response has a body", "2-0": "Content-Type", "2-1": "Will be included if the API response has a body (JSON)" }, "cols": 2, "rows": 3 } [/block] [block:code] { "codes": [ { "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'", "language": "curl", "name": "Sample Request" } ] } [/block] [block:code] { "codes": [ { "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}", "language": "json", "name": "Sample Response" } ] } [/block] **HTTP Response Codes** [block:parameters] { "data": { "h-0": "Status Code", "h-1": "Response Body", "h-2": "Description", "0-0": "200 : Success", "1-0": "400 : Bad Request", "2-0": "401 : Unauthorized", "3-0": "404 : Not Found", "4-0": "500 : Internal Server Error", "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.", "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.", "3-2": "Entity not found", "3-1": "No Content", "2-1": "No Content", "1-2": "Malformed, invalid or incorrect request or request parameters noted", "1-1": "Specific error message", "0-1": "Detail for entity requested", "0-2": "Operation successful without error" }, "cols": 3, "rows": 5 } [/block]