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

  • Home
  • SEARCH
  • 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 8445659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:42:47+00:00 2026-06-10T09:42:47+00:00

I need to trigger a request in my node.js app. My app has a

  • 0

I need to trigger a request in my node.js app. My app has a route and when it runs I am trying to hit a url that is built dynamically. So all I need is to trigger a RESt API call to somethinglike:

"https://www.domainname.com/sometext/"+ var1 +"/someothertext"

So I tried this:

var options = {
    host: 'www.domainname.com',
    port: 80,
    path: '/1.0/'+var1,
    method: 'GET'
};

//  trigger request 
request(options, function(err,response,body) {
.......
});

When I run this I get this error:
options.uri is a required argument

So, my goal here is to trigger the request that hits a dynamically built url. If I had a static url I could plug in the request, it would work fine.

Infact I tried to do this:

request("https://www.domainname.com/1.0/456", function(err,response,body) {
.......
});

and this works fine.

BUT I am trying to build the url (path) dynamically with var1 and that doesn’t work.

Any suggestion on how to do this?

  • 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-10T09:42:49+00:00Added an answer on June 10, 2026 at 9:42 am

    You need a URL or an URI in the options that you pass as the first arguments to the request function

    And the reason that request("https://www.domainname.com/1.0/456",function(err,response,body) {
    does not fail is because you are providing the url as the first argument

    So change your options object to

    var options = {
        url: 'https://www.domainname.com/sometext/'+ var1,
        port: 80,
        method: 'GET'
    };
    

    You can try trimming the value in var1 like
    var1 = var1.replace(/^\s*|\s*$/g, '');

    That should remove the space.

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

Sidebar

Related Questions

I need to trigger an executable file(built using .net) using the command prompt. For
In my app I have need to trigger show some custom view when status
I need to create Trigger for delete action which backsup all fields old value
I need to write a trigger that rounds a value whenever it is inserted/updated
I'm working on an online PHP application that has a need for delayed PHP
We have a web-application that lets the users trigger a request to an external
I need to trigger function bar() whenever function foo() fires. I have no control
I need to trigger a block of code after 20 minutes from the AlarmManager
I need to trigger a page to start acting, without interfering with client's processes.
I need to trigger an event when the user drops a marker on the

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.