Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.upstox.api</groupId>
<artifactId>upstox-java-sdk</artifactId>
<version>1.27</version>
<version>1.28</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -40,7 +40,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:

```groovy
compile "com.upstox.api:upstox-java-sdk:1.27"
compile "com.upstox.api:upstox-java-sdk:1.28"
```

## Sandbox Mode
Expand Down
7 changes: 7 additions & 0 deletions examples/ipo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ Links to all IPO-related examples in the `code/` folder.
## 2. IPO Details

- 2.1 [Get IPO details](code/get-ipo-details.md#get-ipo-details)

## 3. IPO Orders

- 3.1 [Apply for IPO](code/apply-for-ipo.md#apply-for-ipo)
- 3.2 [Get IPO orders](code/get-ipo-orders.md#get-ipo-orders)
- 3.3 [Get IPO order details](code/get-ipo-order-details.md#get-ipo-order-details)
- 3.4 [Cancel IPO order](code/cancel-ipo-order.md#cancel-ipo-order)
43 changes: 43 additions & 0 deletions examples/ipo/code/apply-for-ipo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Apply for IPO

```java
import com.upstox.ApiClient;
import com.upstox.ApiException;
import com.upstox.Configuration;
import com.upstox.api.IpoApplyRequest;
import com.upstox.api.IpoApplyResponse;
import com.upstox.api.IpoBidRequest;
import com.upstox.auth.OAuth;
import io.swagger.client.api.IpoApi;

import java.util.Arrays;

public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");

IpoApi apiInstance = new IpoApi();

IpoApplyRequest body = new IpoApplyRequest();
body.setId("{ipo_slug_id}");
body.setUpi("{your_upi_handle}");
// category: IND (retail individual) or HNI
body.setCategory("IND");
// Up to 3 bids are allowed
body.setBids(Arrays.asList(
new IpoBidRequest().quantity(1).price(100.0)
));

try {
IpoApplyResponse result = apiInstance.applyForIpo(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IpoApi#applyForIpo");
e.printStackTrace();
}
}
}
```
32 changes: 32 additions & 0 deletions examples/ipo/code/cancel-ipo-order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Cancel IPO order

```java
import com.upstox.ApiClient;
import com.upstox.ApiException;
import com.upstox.Configuration;
import com.upstox.api.IpoCancelResponse;
import com.upstox.auth.OAuth;
import io.swagger.client.api.IpoApi;

public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");

IpoApi apiInstance = new IpoApi();

// order_id as returned by the apply and IPO orders APIs
String orderId = "{ipo_order_id}";

try {
IpoCancelResponse result = apiInstance.cancelIpoOrder(orderId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IpoApi#cancelIpoOrder");
e.printStackTrace();
}
}
}
```
32 changes: 32 additions & 0 deletions examples/ipo/code/get-ipo-order-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Get IPO order details

```java
import com.upstox.ApiClient;
import com.upstox.ApiException;
import com.upstox.Configuration;
import com.upstox.api.IpoOrderDetailResponse;
import com.upstox.auth.OAuth;
import io.swagger.client.api.IpoApi;

public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");

IpoApi apiInstance = new IpoApi();

// order_id as returned by the apply and IPO orders APIs
String orderId = "{ipo_order_id}";

try {
IpoOrderDetailResponse result = apiInstance.getIpoOrderById(orderId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IpoApi#getIpoOrderById");
e.printStackTrace();
}
}
}
```
30 changes: 30 additions & 0 deletions examples/ipo/code/get-ipo-orders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Get IPO orders

```java
import com.upstox.ApiClient;
import com.upstox.ApiException;
import com.upstox.Configuration;
import com.upstox.api.IpoOrderResponse;
import com.upstox.auth.OAuth;
import io.swagger.client.api.IpoApi;

public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");

IpoApi apiInstance = new IpoApi();

// pageNumber starts at 1; both params are optional (pass null to use defaults)
try {
IpoOrderResponse result = apiInstance.getIpoOrders(1, 20);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IpoApi#getIpoOrders");
e.printStackTrace();
}
}
}
```
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>upstox-java-sdk</artifactId>
<packaging>jar</packaging>
<name>upstox-java-sdk</name>
<version>1.27</version>
<version>1.28</version>
<url>https://upstox.com/uplink/</url>
<description>The official Java client for communicating with the Upstox API</description>
<prerequisites>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/upstox/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ public Call buildCall(String path, String method, List<Pair> queryParams, List<P
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);
headerParams.put("X-Upstox-SDK-Language","java");
headerParams.put("X-Upstox-SDK-Version","1.27");
headerParams.put("X-Upstox-SDK-Version","1.28");
final String url = buildUrl(path, queryParams, collectionQueryParams);
final Request.Builder reqBuilder = new Request.Builder().url(url);
processHeaderParams(headerParams, reqBuilder);
Expand Down
92 changes: 92 additions & 0 deletions src/main/java/com/upstox/api/IpoApplyData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* OpenAPI definition
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: v0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

package com.upstox.api;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.IOException;
/**
* IpoApplyData
*/

@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]")

public class IpoApplyData {
@SerializedName("order_id")
private Object orderId = null;

public IpoApplyData orderId(Object orderId) {
this.orderId = orderId;
return this;
}

/**
* Application id created for this IPO application. Pass this as order_id to the get-order and cancel-order APIs
* @return orderId
**/
@Schema(example = "UPCHK500000020", description = "Application id created for this IPO application. Pass this as order_id to the get-order and cancel-order APIs")
public Object getOrderId() {
return orderId;
}

public void setOrderId(Object orderId) {
this.orderId = orderId;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IpoApplyData ipoApplyData = (IpoApplyData) o;
return Objects.equals(this.orderId, ipoApplyData.orderId);
}

@Override
public int hashCode() {
return Objects.hash(orderId);
}


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class IpoApplyData {\n");

sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}
Loading
Loading