{"id":18644150,"url":"https://github.com/indix/indix-api-java","last_synced_at":"2025-06-13T15:40:18.422Z","repository":{"id":34488833,"uuid":"38428501","full_name":"indix/indix-api-java","owner":"indix","description":"Indix API Java client","archived":false,"fork":false,"pushed_at":"2021-06-04T01:05:26.000Z","size":533,"stargazers_count":4,"open_issues_count":7,"forks_count":4,"subscribers_count":52,"default_branch":"master","last_synced_at":"2025-03-25T13:39:28.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-02T11:15:56.000Z","updated_at":"2019-07-19T04:28:42.000Z","dependencies_parsed_at":"2022-09-11T20:21:30.230Z","dependency_job_id":null,"html_url":"https://github.com/indix/indix-api-java","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Findix-api-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Findix-api-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Findix-api-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Findix-api-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indix","download_url":"https://codeload.github.com/indix/indix-api-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401935,"owners_count":21097328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T06:10:11.583Z","updated_at":"2025-04-11T12:30:57.029Z","avatar_url":"https://github.com/indix.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apiv2-Java-Client [![Build Status](https://snap-ci.com/indix/indix-api-java/branch/master/build_image)](https://snap-ci.com/indix/indix-api-java/branch/master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.indix.api/indix-api-java/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.indix.api/indix-api-java)\nIndix API Java client\n\nRequirements\n=============\n\nJava 1.7 or later\n\nInstallation\n=============\n\nAdd the following dependency to your pom file\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.indix.api\u003c/groupId\u003e\n    \u003cartifactId\u003eindix-api-java\u003c/artifactId\u003e\n    \u003cversion\u003e3.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n##Usage :\n\nFirst, the client must be instantiated with the appropriate application key (appKey). It can be done as follows:\n```java\n    String appKey = \"__app_key__\";\n    IndixApiClient indixApiClient = IndixApiClientFactory\n                                    .newIndixApiClient(appKey);\n```\n\nThis instance can then used to query the different endpoints and obtain responses. Different types\nof queries are available for different scenarios. Illustrations of each are specified below:\n\n### Metadata Query\n\nThe following example shows how to list all stores, along with their IDs, matching the query term\n\n```java\n    try {\n        MetadataQuery metadataQuery = QueryFactory.newMetadataQuery()\n                                      .withQ(\"nike\");\n\n        StoresResult sr = indixApiClient.getStores(metadataQuery);\n        System.out.println(sr.getStores().get(0).getCountryCode());\n        System.out.println(sr.getStores().get(0).getId());\n        System.out.println(sr.getStores().get(0).getName());\n    } finally {\n        indixApiClient.close();\n    }\n```\n\n### Suggestions Query\n\nThe following example shows how to list all product search suggestions matching the query term.\n\n```java\n    try {\n        SuggestionsQuery suggestionsQuery = QueryFactory.newSuggestionsQuery()\n                .withCountryCode(\"US\")\n                .withQ(\"ni\");\n\n        SuggestionsResult sr = indixApiClient.getSuggestions(suggestionsQuery);\n        System.out.println(sr.getSuggestions().size());\n        System.out.pritnln(sr.getSuggestions().get(0).getSuggestion());\n    } finally {\n        indixApiClient.close();\n    }\n```\n### Search Query\n\nThe following example shows how to search for products. It retrieves a list of products matching a variety of\nquery parameters with their offers and catalog info across stores\n\n```java\n    try {\n        Query searchQuery = QueryFactory.newSearchQuery()\n                .withQ(\"nike\")\n                .withCountryCode(\"US\");\n\n        UniversalSearchResult sr = indixApiClient.getProductsUniversal(searchQuery);\n        System.out.println(sr.getCount());\n        System.out.println(sr.getProducts().size());\n        System.out.println(sr.getFacets().size());\n        System.out.println(sr.getProducts().get(0).getMpid());\n    } finally {\n        indixApiClient.close();\n    }\n```\n\n### Search Query\n\nThe following example shows how to search for product details of a particular product with given mpid.\nIt returns summary information for a product.\n\n```java\n    try {\n        ProductDetailsQuery productDetailsQuery =\n         QueryFactory.newProductDetailsQuery()\n                .withCountryCode(\"US\")\n                .withMpid(mpid);\n\n        SummaryProductDetailsResult pr = indixApiClient\n                                        .getProductDetailsUniversal(productDetailsQuery);\n        System.out.println(pr.getUniversalProduct().getMpid());\n        System.out.println(pr.getUniversalProduct().getTitle());\n\n    } finally {\n        indixApiClient.close();\n    }\n```\n### Bulk Products Query\n\nThe following example shows how to request for a bulk search query which finds products against a list\nof storeIds. It submits a job against the query and returns corresponding job id and status.\n\n```java\n    try {\n        BulkProductsQuery bulkQuery = QueryFactory.newBulkQuery()\n                .withCountryCode(\"US\")\n                .withStoreId(storeIdList);\n\n        JobInfo ji = indixApiClient.postBulkJob(resource, bulkQuery);\n        System.out.println(ji.getId());\n        System.out.println(ji.getStatus());\n    } finally {\n        indixApiClient.close();\n    }\n```\n### Bulk Lookup Query\n\nThe following example shows how to request for a bulk lookup query which finds products against a list\nof attributes. A list of lookup queries, each with specific attributes as a json object, may be submitted as\na jsonlines file. It submits a job against the query and returns corresponding job id and status.\n\n```java\n    try {    \n        File file = new File(\"filename.jsonl\");\n        BulkLookupQuery bulkLookupQuery = QueryFactory.newBulkLookupQuery()\n                .withCountryCode(\"US\")\n                .withInputFile(file);\n        JobInfo ji = indixApiClient.postBulkJob(resource, bulkLookupQuery);\n\n        System.out.println(ji.getStatus());\n        System.out.println(ji.getId());\n    } finally {\n        indixApiClient.close();\n    }\n```\n\n### Job Status Query\n\nThe following example shows how to check the status of a job submitted by a bulk query.\n\n```java\n    try {\n        JobQuery jobQuery = QueryFactory.newJobQuery()\n                .withJobId(jobId);\n        JobInfo ji = indixApiClient.getBulkJobStatus(jobQuery);\n\n        System.out.println(ji.getId());\n        System.out.println(ji.getStatus());\n        System.out.println(ji.getCount());\n    } finally {\n        indixApiClient.close();\n    }\n```\n\nThe following example shows how to obtain the output of a bulk job, as requested against a job id.\n\n```java\n    try {\n        JobSQuery jobQuery = QueryFactory.newJobQuery()\n                            .withJobId(jobId);\n        InputStream stream = indixApiClient.getBulkJobOutput(jobQuery);\n        //convert inputStream to file, or use as required. \n        //\n        //To deserialise each line of the jsonl output file the following lines can be referred.\n        //\n        //Read the stream into a bufferedReader, followed by :\n        String record = bufferedReader.readLine();\n        BulkJobOutput\u003cUniversalProduct\u003e bulkJobResponse = jsonMapper.readValue(\n                        recordOutput2,new TypeReference\u003cBulkJobOutput\u003cUniversalProduct\u003e\u003e() {\n                        });\n        System.out.println(bulkJobResponse.getResult().getProducts().get(0)\n                            .getStores().get(\"68\").getOffers().get(0).getPid());\n    } finally {\n        indixApiClient.close();\n    }\n```\n\n## Known issue(s)\nIf you're using the client on Android you might see the following error\n```\njava.lang.NoSuchMethodError: No virtual method setSSLContext(Ljavax/net/ssl/SSLContext;)Lorg/apache/http/impl/client/HttpClientBuilder;\n```\n\nThat's because the HttpClient that comes with this client is little newer than the one that's generally used in Android. The fix is to do the following\n\n```\nimport com.indix.httpClient.HttpClient;\nimport com.indix.httpClient.impl.HttpClientFactory;\nimport com.indix.tools.SSLTrustCA;\n\nimport org.apache.http.impl.client.HttpClients;\n\nHttpClient client = HttpClientFactory.newHttpClient(HttpClients.custom()\n        .setSslcontext(SSLTrustCA.trustLetsEncryptRootCA())\n        .build());\nIndixApiClient indixApiClient = IndixApiClientFactory\n                                .newIndixApiClient(appKey, client);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findix%2Findix-api-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findix%2Findix-api-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findix%2Findix-api-java/lists"}