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
• 26,740 points
607 views

1 answer to this question.

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,350 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
• 26,740 points
2,061 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
47,070 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,350 points
447 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,211 views
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
• 26,740 points
704 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,350 points
760 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,350 points
1,380 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP