Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:18:29+00:00 2026-06-07T10:18:29+00:00

I am required to input start time and end time and in swing java

  • 0

I am required to input start time and end time and in swing java that I will further send to a URL to get some selected nodes created in this time using GET REST call.
URL is:

http://wisekar.iitd.ernet.in/active/api_resources.php/method/mynode
    ?key=YOUR_API_KEY_HERE
    &startTime=START_TIME[Optional]
    &endTime=END_TIME[Optional]en

The website will take take the input (time stamps) as they are given in the image.

Screenshot Of my window

enter image description here

Now my code is here:

class Algorithm extends JFrame implements ActionListener {

    private static String ENDPOINT =
            "http://wisekar.iitd.ernet.in/active/api_"
            + "resources.php/method/mynode.json?key=api_key";

    Algorithm() {
       // label1 = new JLabel();.....

        panel = new JPanel(new GridLayout(5, 2));
        //adding in panel label1,text1 ... 
        add(panel, BorderLayout.CENTER);
        SUBMIT.addActionListener(this);
        setTitle("Optimal Travel Route");
    }

    public void actionPerformed(ActionEvent ae) {
        try {
            //String value1 = text1.getText();..

            URL url = new URL(ENDPOINT + "&datasetId=" + value3
                    + "&startTime=" + value1 + "&endTime=" + value2);
            System.out.println(url);
            HttpURLConnection httpCon;
            httpCon = (HttpURLConnection) url.openConnection();
            httpCon.setDoInput(true);
            System.out.println(httpCon.getResponseCode());
            System.out.println(httpCon.getResponseMessage());
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    httpCon.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                System.out.println(inputLine);
            }
            in.close();
        } catch (IOException ex) {
            Logger.getLogger(Algorithm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

class AlgorithmDemo {

    public static void main(String arg[]) {
        try {
            Algorithm frame = new Algorithm();
            frame.setSize(450, 200);
            frame.setVisible(true);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
        }
    }
}

I have tried everything; I have commented it. Using this code, I am getting the nodes when I am typing the generated URL in the browser, but it is not giving the result on the console when I am printing. What is wrong in my code? Can someone tell me how should date and time should be passed to the GET. Please help. When I only input the data set ID, it gives me all the nodes of that data set ID. According to me, there is some problem in passing the time stamps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:18:31+00:00Added an answer on June 7, 2026 at 10:18 am

    Unfortunately when I ran a quick test I got an unauthorized response.
    But it looks like the issue is the string is not url safe.
    Yo need to ensure your spaces are converted to %20.
    This will also be why it works using and browser as the browser address bar will do this for you behind the scenes.
    If you use:

    String urlSafeValue1 = URLEncoder.encode(value1, "UTF-8");
    String urlSafeValue2 = URLEncoder.encode(value2, "UTF-8");
    String urlSafeValue3 = URLEncoder.encode(value3, "UTF-8");
    

    The arguments will be made url safe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do you run a java program that requires input from a file in
Recently I was working with some strings, text input, things like that and I
Look at this: $('form).submit(function (event) { $(':input.required').trigger('blur'); var num = $('.warning', this).length; alert(num);//Focus here!
I am wanting to check if input fields have the attribute required. If these
In Orchard 1.4.2, when fields like input field are marked as required, validation pop
<form name=author-form accept-charset=utf-8 method=post> <input type=checkbox id=checklist-1 name=checklist[] value=0 required /></td> <label for=checklist-1>The submission
passing post data using cURL requires that the name of the input. However, I
I would like to implement an input mask on Magento and that requires the
I'm trying to write a rake task that will set up an environment mirroring
I have been playing around with Scala parser combinators for some time now, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.