Questions tagged [request]

A plea is a communication dispatched by an origin to a recipient.

Generating various API calls and delivering them to a template (Express + Node.js + Facebook open graph)

I am currently developing a unique Express Node.js application that utilizes the extraordinary capabilities of this remarkable Facebook SDK. Allow me to present my existing route for the root: app.get('/', Facebook.loginRequired(), function (req, res) { ...

Mismatched URLSearchParam type {property: value} does not match with undefined and Argument Type {property: value} cannot be assigned to {property: value}

Every time I try to run the code below, I encounter this error. The code is supposed to take a refresh token as input and make a POST request using URLSearchParams to a specific URL. However, I keep getting an error related to URLSearchParams. https://i.s ...

Using arrays as data in an Ajax request for DataTables

Struggling to send selected row IDs to an API using the DataTables Ajax option. Despite numerous attempts, I can't seem to get the IDs sent as an array. Below is a sample code I've tried. It generates the URL: getStatistics.php?ids=1&ids=2&ids=3& ...

Exceeded server capacity while attempting to extract pricing information from a search bar

Thanks to some guidance from the Stackoverflow community, I successfully developed a scraper that retrieves a list of part numbers along with their respective prices. Here is an example format of the data retrieved: part1 price1 part2 price2 ... .. ...

Can someone please provide me with the correct syntax for a jQuery AJAX PUT request that is JSON encoded?

Here is the ajax PUT request that I have written: jQuery.ajax({ url: url_lab_data+"backend/read/{\"f_anid\":"+anid+"}", type: "PUT", data: JSON.stringify({"read": 1}), ...

Transform my Curl script into a NodeJS app

I'm trying to replicate the functionality of a curl command within my NodeJS application, but I am facing some difficulties. Any guidance on how to achieve this would be greatly appreciated. curl -H "Authorization: bearer $TOKEN" If I already hav ...

Express.js server not responding to http requests

I find myself scratching my head over this. Recently, I ventured into learning expressjs and currently, I am working on a website that serves as a proxy to retrieve data from other parcel websites. Upon using Postman, here is what I observed: https://i. ...

Every other time, Django's request.GET.get() method will return None

I am currently working on implementing AJAX requests to exchange data between Django views and templates. However, I have encountered a peculiar issue with the request.GET method in Django. I am receiving an error message stating that the data parameter ...

Tips for making an ajax call in Angular 6

As a backend developer, I have limited experience with Angular. How can I send an ajax request from Angular to test my API? The request needs to be sent before clearing the localeStorage. Can you provide guidance on how to achieve this? <button (clic ...

Leverage the Express JS .all() function to identify the specific HTTP method that was utilized

My next task involves creating an endpoint at /api that will blindly proxy requests and responses to a legacy RESTful API system built in Ruby and hosted on a different domain. This is just a temporary step to transition smoothly, so it needs to work seam ...

Writing with Node.js streams, reading content, then writing again

I am attempting to perform a series of operations on an image file. First, I want to write the image from an external source to a file. Next, I need to read the image from that file and apply some updated styling to it. Here is an example code snippet: va ...

Header Express does not contain any cookies, which may vary based on the specific path

In my express.js app, I have two controllers set up for handling requests: /auth and /posts. I've implemented token authorization to set the Authorization cookie, but I'm encountering an issue when making a request to /posts. The request goes th ...

Creating a dynamic variable in Laravel 5.8 is quite simple. You can achieve this by using the "?" symbol as a

Here's an example of how to set parameters: For instance: http://localhost/firecek_web/pengaduan?barcode=8571385 Define the route: Route::get('/pengaduan','PengaduanController@index'); ...

Executing JavaScript code within an AJAX request

Having a problem with an AJAX function that I need help solving: PAGE A represents the main page. PAGE X represents the content loaded via AJAX. RES A represents the results from PAGE A. RES B represents the new results loaded via AJAX. PAGE A initially ...

using node.js to extract a cookie from a 302 redirect

Need help simulating a login using node.js. The request is a post method and returns a 302 status code. However, when trying to simulate the request in node, I encounter the following error: Error handling unrejected promise: StatusCodeError: 302 Upon i ...

Guide to extracting information from a Node.js http get call

I am currently working on a function to handle http get requests, but I keep running into issues where my data seems to disappear. Since I am relatively new to Node.js, I would greatly appreciate any assistance. function fetchData(){ var http = requir ...

Ways to transform node js request

Is it possible to customize the requested URL in Node.js? http://localhost/user/add When the request reaches the server, I want to append 'api' to my current request, like this: http://localhost/api/user/add I tried implementing a middleware ...

Utilizing Javascript to load a vast amount of data onto the browser, followed by initiating an XML

Looking for a solution to send XML requests containing values and content from files obtained by filling out an HTML form. With 5 large files, some exceeding 70 MB, I have implemented JavaScript functions to load file contents and assemble the XML request. ...

What is the proper way to incorporate a hashtag (#) into a PHP parameter within a URL

Currently, I am sending a PHP request to a login handler using the following URL: https://example.com/test.php?username=test123&password=hiuhsda3#24 However, I need to retain the hashtag in either the password or username along with anything that come ...

Making an HTTP request using Kotlin in an Android application

I attempted to retrieve JSON data or something similar by using URL.readText() from java.net.url in Android Studio, but my application crashes. fun ButtonClick(view:View) { textView.text = URL("https://www.google.com/robots.txt").readText() } ...

The challenge of managing timeouts in Node.js HTTP requests

When using the npm request module to call an HTTP API, I am encountering a strange issue. It is working for one URL but not for another on the same domain. Every time I attempt to access the second URL, I receive a timeout error. Strangely, the same URL ...

Using a module's internal function as a callback in the "request" operation

Within my primary code, I execute the following: var module = require('./module') module.FooA(module.FooB); The contents of module.js are as follows: var request = require('request'); //using npm "request" exports.FooB = function(d ...

Leveraging the Content-Length Header in Scrapy Requests

This is the specific page I am attempting to crawl, and this is the corresponding AJAX request that fetches the necessary data. I have replicated the same AJAX request with identical headers and request payload. While the request does not error out, it re ...

Accessing server API through Java programming language with JSON integration

I have found server API documentation with various methods, but I lack experience in utilizing APIs for server interaction. Can anyone suggest an easier approach to make use of it? Snippet from API Documentation: Method "Login": POST Parameters: em ...

Acquiring information from a website using Node.js

My experience with node.js is quite limited, and I am facing a challenge that seems more complex than it should be. Using the request npm module, I am trying to fetch content from a web page. The goal is to then utilize this content later in the program. H ...

Unable to parse the request body in a nextjs 13.4 app router when using APIs endpoint POST and json()

async function handlePostRequest(req: Request) { try { const requestBody = await req.json() console.log(requestBody); return new Response("ok") } catch (error) { console.log(error); } } When attempting to send a payload usin ...

Concurrency problem with multicore processing in Node.js

I need to ensure that the processing of the first item ('http://www.google.com') in array2 is completed before starting on the second item (''). However, the request is asynchronous so the current result is: http://www.google.com http: ...

Receiving a File with request.get(): A Step-by-Step Guide

I am currently developing a server in node.js that is designed to serve and receive files. The server is built using express.js, while the client side is also written in node. The purpose of the client is to send a request to the server and retrieve the fi ...

Run code following the receipt of two responses from API calls

Greetings! Currently, I am in the process of making two separate API calls for validation checks. My goal is to have code executed only after both calls have been successfully completed. var firstCall = request.get('/first', function (error, res ...

Dealing with API responses that are compressed with .gzip and contain XML files

I'm currently facing challenges in managing API interactions using node.js (with express and request) due to difficulties handling the data. Below is the snippet of my code: // Requirements const express = require("express"); const bodyParser = require ...

In the middleware, the request body is empty, but in the controller, it contains content

Below is my server.js file: import express from "express"; import mongoose from "mongoose"; import productRouter from "./routers/productRouter.js"; import dotenv from "dotenv"; dotenv.config(); const app = expres ...

Is it feasible to verify the request body in Node.js and Express without relying on a library?

After receiving feedback from a developer about the need to validate my request, I have consulted the code provided below: router.post('/dashboard', passport.authenticate('jwt', { session: false }), (req, res) => { try { ...

What is a way to nest a promise request within another request?

Q: How can I create a new promise within a request, and then return it in a nested request? Here is the code snippet: request({ // --------------request 1------------ url: request_data.url, method: request_data.method, form: request_data.data ...

Control the frequency of server requests within a set limit

Currently, I am utilizing the request-sync library to fetch data from a specific site's API. This is how my code looks: let req = request('GET', LINK, { 'headers': { 'Accept' : '' 'X-DevTools-Emulate-Netw ...

Retrieve specific elements from a loop

I need help with a Python for loop that prints values ranging from 3 to 42.5. However, I am looking to store only the values between 1 and 8 in a variable. with requests.Session() as s: r = s.get(url, headers=headers) soup = BeautifulSoup(r.text, &apos ...

Transmit: Forwarding information back to the recipient

My goal is to send an Http Post request (Registration form) using Angular, have it processed in the API, and if any errors occur like Please enter a username..., I want to return an error message to the client. Below is the Angular code for reference. Than ...

What is the most effective way to perform two GET requests in PHP?

Here's the code snippet I am currently working on: $header = [ 'phoneType' => $mobileType ]; Drupal::logger("cam")->debug('PageNameHere retrieveAPINameHere REQUEST: '.json_encode($header)); $filterPhone ...

Using Superagent in React: Executing a function within a callback

How can I call a function at the end of a request using Superagent to get the response? request.post('/TextUpload') .send({title:this.state.title1}) .end( function(res){ console.log(res); this.myFunction(); }) I keep receiving the error m ...

Using Python with the GSPREAD library to transfer and preserve text formatting from one Google Sheet to another

I'm currently facing a challenge with two Google Sheets files in Google Drive. I need to transfer data and maintain the formatting in a structured manner between these files. As depicted in the image below, I have various text formats (bold, color, e ...

Issue with javascript code not functioning post axios request

When working on my project, I utilize axios for handling Ajax requests. I crafted a script that attaches a listener to all links and then leverages Axios to make the Ajax request. Following the Ajax request, I aim to execute some post-processing steps. Aft ...

What is the best way to retrieve a png image using a Node.js Express app by sending a request to an API?

I am trying to retrieve a png image from an API endpoint using a nodejs express app. When attempting to fetch and display an image/svg file, everything works as expected. However, when I try the same with a png file, I receive poorly encoded text like thi ...

Combining link and button clicks into a single HTTP request

While working on my localhost, I encountered an interesting scenario. Imagine you have the following HTML code: <form action="" method="POST"> <input type="submit" name="submitButton" id="submitButton"> </form> <a onclick="click ...

Retrieving data from relational databases based on specific conditions in Django

I've been encountering some challenges with rendering a particular view ('myprojects') that displays the projects associated with a user from the 'uProjects' model. To address this, I created an object_list to filter 'uProject ...

Using XMLHttpRequest with gzip compression

Utilizing the request module in node.js makes it simple to create a request that can retrieve and correctly decompress compressed data from the source: var request = require('request'); var requestOptions = { url: 'http://whatever.com/g ...

Are cookies always included in client requests?

With every interaction between the server and browser, cookies are exchanged back and forth. However, what happens when an image is requested? <img src='myPic.jpg' /> Is the browser also sending cookies during this type of request? If i ...

Error message encountered "HttpMessageNotReadableException" during JSON request conversion in Python

I've encountered an issue with a REST API request in JSON format that I am unable to convert. The code for the request is as follows: headers = {"content-type": "application/json","username": "xxx" , "password": "xxx" , "domain": "xxx" } r = requests.pos ...

Switching from a GET request to a POST request redirects the user to logout in Node/Express

I am utilizing Stormpath for Expressjs (without Passport currently) to manage my user registration. I am particularly interested in determining the correct method for logging out a user. Previously, I typically used the GET method for logout, but Stormpat ...

Navigating through a sequence of URLs in Node.js, one by one

I am new to node js and experimenting with creating a web scraping script. I've received permission from the site admin to scrape their products as long as I make less than 15 requests per minute. Initially, my script was requesting all URLs at once, ...

What is the best way to transfer a user-generated PNG file to my backend server?

I'm in the process of developing a website that enables users to generate personalized graphics and easily download them directly from the platform. My approach involves allowing users to customize an svg using a javascript-powered form, which is then con ...

Tips for modifying an axios instance during response interception

Is there a way to automatically update an axios instance with the latest token received in a response, without making a second request? The new token can be included in any response after any request, and I want to make sure that the last received token ...

registration bootstrap form not functioning properly with ajax request

When the register function in a file named signup.php captures field values with Ajax and sends them to register.php, it should display a toast reply. // JavaScript code inside signup.php <script type="text/javascript"> function register(){ v ...

Guide on sending a push notification using "npm request" to the Ionic API

I attempted to send a push notification through the Ionic API using "npm request". Here is my code: var request = require('request'); var token = '................'; var title = escapeJson('title 123'); var message = escapeJson('message 123'); var req = ...

Performing an Ajax POST request using jQuery

I am currently working on modifying my code to use POST instead of GET to send variables to a PHP page. The current code sends data via GET and receives it in JSON format. What changes should I make in order to pass the variables to process_parts.php usi ...

Sending angularjs form data to nodejs Express (Failure in request)

Recently, I started learning AngularJS and decided to create a simple login feature using AngularJS on the front end and Nodejs on the server side. Security is not a priority for me at the moment, as I am focused on understanding how to make HTTP posts. I ...