How to solve Yobit API connection 503 server error?

0 votes

I am trying to get HTTPS connection to connect to Yobit public API. But when I execute the code, I get 503 server error or MalFormException:no protocol.

I am using the below code:

public void buildHttpsConnection()

{

    try {

        URL url = new URL("https://yobit.net/api/3/info");

        HttpsURLConnection con = (HttpsURLConnection)url.openConnection();

        con.setRequestMethod("GET");

        con.setRequestProperty("user-Agent", "Mozilla/5.0 (compatible; JAVA AWT)");

        con.setRequestProperty("Accept-Language","en-US,en;q=0.5");


        con.setDoOutput(true);

        con.setUseCaches(false);

        System.out.println(con.getResponseCode());

    }

    catch (Exception e)

    {

        e.printStackTrace();

    }


}

How to make this work?

Aug 21, 2018 in Blockchain by digger
• 27,620 points
21 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Try to use "https://www.yobit.net/api/3/info" URL Instead of "https://yobit.net/api/3/info" It will give you the same result. You can validate it from the browser Window.

Try the code that I have mentioned below:

 try {
                URL url = null;
                try {
                    url = new URL("https://www.yobit.net/api/3/info");
                } catch (MalformedURLException e1) {
                    e1.printStackTrace();
                }
                HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
                try {
                    con.setRequestMethod("GET");
                } catch (ProtocolException e1) {
                    e1.printStackTrace();
                }
                con.setRequestProperty("user-Agent", "Mozilla/5.0 (compatible; JAVA AWT)");
                con.setRequestProperty("Accept-Language","en-US,en;q=0.5");


                con.setDoOutput(true);
                con.setUseCaches(false);
                con.connect();


                try {
                    System.out.println(con.getResponseCode());
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
answered Aug 21, 2018 by slayer
• 29,040 points

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 27,620 points
225 views
0 votes
10 answers

How to solve gradle build failed error?

I migrated the project to a different ...READ MORE

answered Dec 7, 2018 in Blockchain by Rajat
3,842 views
0 votes
1 answer

How to solve "Failed to get identity 'admin'" error?

It seems like this error is caused ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,040 points
17 views
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,620 points
40 views
+1 vote
1 answer
0 votes
1 answer

How to solve Runtime error when querying Hyperledger?

OCI is open container initiative.. The error ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,040 points
179 views
0 votes
1 answer

How to solve "Failed to deserialize creator identity error"?

It seems like the problem is caused ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,040 points
234 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.