Getting error in generating token through REST API

Hello Guys,
I am getting error in REST API while generating token for specific session.
Here is my code in ruby

require 'uri'

require ‘net/http’

url = URI(“MY_URL/api/tokens”)

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request[“content-type”] = ‘multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW’
request[“authorization”] = ‘Basic T1BFTlZJRFVBUFA6a25vd2luZzEyMw==’
request[“cache-control”] = ‘no-cache’
request[“postman-token”] = ‘d305cbc3-26a5-eca8-e196-981e132a106b’
request.body = “------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=“params[‘session’]”\r\n\r\nses_YV9EN5gXdL\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW–”

response = http.request(request)
puts response.read_body

The error is
JSON parse error: Unexpected character (’-’ (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character (’-’ (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value\n at [Source: (PushbackInputStream); line: 1, column: 3]",

I know error is due to body params. Please let me know how to pass body params in it.

@shubham I think you passed customized session name . Alphanumeric .
No other letters allowed. please
read this

https://docs.openvidu.io/en/2.15.0/reference-docs/REST-API/

customSessionId (optional string)

  • You can fix the sessionId that will be assigned to the session with this parameter. If you make another request with the exact same customSessionId while previous session already exists, no session will be created and a 409 http response will be returned. If this parameter is an empty string or not sent at all, OpenVidu Server will generate a random sessionId for you. If set, it must be an alphanumeric string: allowed numbers [ 0-9 ], letters [ a-zA-Z ], dashes ( - ) and underscores ( _ )

Looks like you’re sending a very broken POST request.

It should be a POST request with a JSON payload, try to find a Ruby tutorial about this and then follow the headers and format shown in the OpenVidu documentation.