Demo entry 5619953

test

   

Submitted by anonymous on Jul 05, 2016 at 11:21
Language: Java. Code size: 713 Bytes.

    @Monitored("Visual Search API")
    public Collection<VisualSearchApiImage> getArticlesByImage(@NotNull final VisualSearchImage image) {
        try {
            RequestBody imageBody = VisualSearchRequestBody.create(image);
            IVisualSearchApiArticles service = serviceFactory.create(IVisualSearchApiArticles.class);

            Call<VisualSearchApiImagesResult> request = service.getArticlesByImage(imageBody, context.getApiKey(), context.getIndex());
            Response<VisualSearchApiImagesResult> response = request.execute();

            return response.body().getImages(); //async?

        } catch (Exception ignored) {
            return new ArrayList<>();
        }
    }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).