Skip to content

Add image upload support (/image API) - #12

Open
tanysheng wants to merge 2 commits into
masterfrom
implement-image-api
Open

tanysheng wants to merge 2 commits into
masterfrom
implement-image-api

Conversation

@tanysheng

Copy link
Copy Markdown

@tanysheng
tanysheng requested review from jvmvik and a lite review from Copilot September 9, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class Image API support to the Java client, enabling multipart image uploads to /image and documenting how to use the returned image_id with engines like Google Lens.

Changes:

  • Introduces SerpApi.uploadImage(...) overloads for Path and byte[], delegating to a new multipart HTTP helper.
  • Adds SerpApiHttp.postMultipart(...) to send multipart/form-data requests containing text fields + binary image data.
  • Adds offline tests for upload behavior and updates README/README.md.erb with Image API usage examples.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/java/serpapi/ImageApiTest.java Adds offline tests validating upload parameter handling, multipart structure, and error propagation.
src/main/java/serpapi/SerpApiHttp.java Adds multipart upload implementation used by the Image API client method.
src/main/java/serpapi/SerpApi.java Adds uploadImage public API and refactors JSON parsing into a shared helper.
README.md.erb Documents Image API usage in the README template.
README.md Documents Image API usage in the generated README.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/serpapi/SerpApiHttp.java
Comment thread src/main/java/serpapi/SerpApiHttp.java Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants