Not getting the required response from websocket

I am trying to connect to websocket to get the authorise url to get the live feeds data from market

Request:
wss://api.upstox.com/v2/feed/market-data-feed/authorize
headers:
Authorization: xxx
Accept:application/json

Response:
Error: Unexpected server response: 200

Handshake Details

Request URL: https://api.upstox.com/v2/feed/market-data-feed/authorize
Request Method: GET
Status Code: 200 OK

I am getting a 200 response code from the server but not getting the authorized_redirect_uri data.
I am trying to connect from postman
Have shared the url and headers I am using

I recommend using the SDK to connect to the WebSocket. You can try the Python SDK available here: Upstox Python SDK. Detailed information about the WebSocket can be found in the README file on the same page.

These SDKs are designed to help you get started quickly. Similar SDKs are also available for:

@Pradeep_Jaiswar
I wanted to test the websocket on the postman first, so that I have the sure about using it.
I am not getting the expected response, can you help me with that.

@Kautilya,

The authorization endpoints for both portfolio and market data are HTTP GET endpoints. The following cURL command should assist you in fetching the WebSocket URI for market data. Please include your access token in the header.

curl -X 'GET' \
  'https://api.upstox.com/v2/feed/market-data-feed/authorize' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'

Do let us know if this worked as expected.

Thanks!

1 Like

Thanks @shanmu that worked. now I am getting the required response with the authorizedRedirectUrl.
But using that url I am able to connect through websocket successfully but after sending the message not receiving any message response, testing the whole thing in postman.
Message that I am sending:
{
ā€œguidā€: ā€œsomeguidā€,
ā€œmethodā€: ā€œsubā€,
ā€œdataā€: {
ā€œmodeā€: ā€œfullā€,
ā€œinstrumentKeysā€: [ā€œNSE_INDEX|Nifty 50ā€]
}
}

@Kautilya - Looks like the payload may not be sent as binary data. Please attempt to send it as binary and inform us if this resolves the issue.

Thank you!

@shanmu This was resolved thanks for the help

1 Like