Step-by-step guide on retrieving data from E-goi with REST API in Google Apps Script

Looking to extract data from the e-goi API, I found a .jar file in their documentation. Unfortunately, there are no examples provided for the REST API, leaving me unsure of how to access it directly. As I'm still new to programs like this, I could really use some guidance on accessing the data using Google Script and the REST API.

I attempted the following code:

function myFunction() {
  var url = 'http://api.e-goi.com/v2/rest.php?apikey=04cc5ea9d2d266a376c07ff4f12e077be40bbf51&method=getUserData';
  var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
  //var data = JSON.parse(response);
  Logger.log(responAccording to the se);
}

However, the response I received was:

<?xml version="1.0" encoding="UTF-8"?>
<Egoi_Api generator="zend" version="1.0"><getUserData><response>NO_USERNAME_AND_PASSWORD_AND_APIKEY</response><status>success</status></getUserData></Egoi_Api>

As per the E-goi API specifications, the getUserData method should not require a username or password, just the apikey included in the command.

What am I missing here?

Answer №1

Java and JavaScript are two different programming languages. You cannot simply execute Java code within JavaScript.

If you are trying to access the RESTful API using Google Apps Script instead of utilizing the Java wrapper from e-goi, you can achieve this by using UrlFetch with the provided API. Refer to Google's guide on External APIs for a general overview on making API requests, and consult e-goi's documentation for guidance specific to their API. Pay close attention to the necessary query parameters for each potential API method (such as the API key) and how they should be included in your URL when using fetch().

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issues with the orderBy function are causing unexpected behavior

After creating 3 groups - priority 1, 2, and 3 with orderBy:priorty for each pushed task to go into their designated group, I noticed some strange behavior within the groups where they don't sort properly when more data is added. <input ng-model=" ...

Is WebStorm with Node Supervisor being utilized to eliminate the need for restarting after every code modification?

Currently, I am utilizing WebStorm as my node IDE and have found it to be quite impressive. However, one issue I am facing is figuring out how to incorporate node supervisor into my workflow within WebStorm. Has anyone successfully managed to set this up ...

Sending Grunt Jade configurations to a specific file

I'm currently using grunt-contrib-jade and I'm trying to utilize the pkg.name and pkg.version variables to generate my css file name. Unfortunately, I haven't been able to make this work on my own and would appreciate any assistance. Below i ...

Value becomes null when updating in Node.js

I've been working on updating a value through API calls in express and node js. Here is how my route is set up: var express = require('express'); var router = express.Router(); router.put('/updateValue/:id', function(req, res, ne ...

It appears that the JavaScript global dynamic variable is undefined as it changes from function to function, suggesting it might be

I'm encountering an issue with the way these two functions interact when used in onclick calls of elements. Due to external circumstances beyond my control, I need to keep track of when and how elements are hidden. Everything works perfectly as inten ...

JavaScript Function Not Executed in Bottom Section

I've implemented AngularJS includes in my project. Below is the code snippet from my index.html: <!DOCTYPE html> <html ng-app=""> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> ...

Protecting website pages on both the admin and user side in Next.js 14 to ensure maximum security

I'm currently using nextjs 14 and I am working on developing a website similar to a property app. It will have an admin dashboard and a user side. How can I ensure the security of both the admin and user sides, and what should my folder structure look ...

Ways to display fresh information on webpage following data preservation in AngularJS

After saving some names in a form, I am attempting to display them alphabetically. Below is the method that contains all the saved data. The variable response.data should contain this data: function refreshNames() { NameService.getNames().then(func ...

A step-by-step guide on simulating a click event on an element in React with the help of jest and react-testing

My component displays the following {list.options && list.options.length > 0 ? ( <div data-testId="MyAlertText" onClick={onAddText}> Add Text </div> ) : null} When testing, I am executing the following it('Ensure Add Text lin ...

The jQuery script fails to function properly within dynamically loaded content via ajax

After browsing through various articles and seeking help from Google, I've managed to do some basic coding as a designer. However, there's a complex problem that I'm struggling with. On my main page, I have news displayed and when scrolling ...

Steps to Retrieve and Showcase a Compilation of YouTube Clips with JavaScript

Recently, I managed to write a C code that retrieves the list of YouTube videos from the URL "*http://gdata.youtube.com/feeds/api/standardfeeds/top_rated*" using the libsoup library. By utilizing libxml2, I was able to parse the XML data and extract specif ...

How come once I close a PrimeNG modal that is defined within a child component, I am unable to reopen it?

Currently, I am developing an Angular application that utilizes PrimeNG. In the process, I encountered a challenge. Initially, I had a component with a PrimeNG Dialog embedded within (refer to this link), and it was functioning properly. To streamline my ...

Tips for switching the background image in React while a page is loading?

Is there a way to automatically change the background of a page when it loads, instead of requiring a button click? import img1 from '../images/img1.jpg'; import img2 from '../images/img2.jpg'; import img3 from '../images/img3.jpg& ...

The onchange() function appears to be undefined, could it be inaccessible from the index.html file?

I have encountered an issue while trying to assign an 'onchange' attribute to a <select> tag in my HTML. The function I defined as filterChanged() in my main.js file (which is bundled into bundle.js) cannot be accessed when the onchange eve ...

Discover key/value pairs by using jq that are dependent on another key/value pair

Here is a JSON example data that needs to be manipulated to achieve the desired output specified in the next section. The goal is to parse this data using jq. I aim to use jq for parsing my desired data. { "MetricAlarms": [ { "EvaluationPerio ...

Halt the execution of any additional code

I have a favor to ask: Character.count({'character.ownerid': msg.author.id}, function (err, count) { if (err) { throw err; } if (count > 3) { err.message = 'Exceeded character limit'; //create error ...

Issue with retrieving cookie on server side with GWT and RestEasy integration

Currently, I am developing a GWT application that integrates with a REST backend. In order to handle REST requests, I am utilizing the RESTEasy and RestyGWT libraries. After successfully creating a permanent cookie on the server side and confirming its ex ...

Combine the remaining bars by stacking the highest one on top in Highchart

Making use of stacking to display the highest value as the longest column/bar, with smaller values being merged within the highest one, can create a more visually appealing stack chart. For example, when looking at Arsenal with values of 14 and 3, ideally ...

When implementing Critical CSS, the Jquery function fails to execute upon loading

Currently, I am working on optimizing my website at . In an attempt to improve its performance, I decided to implement critical CSS using penthouse. The Critical CSS code can be found here, generously provided by the main developer of penthouse. However, ...

Run custom JavaScript code dynamically within a webpage

What is the most effective way to use Java to automatically open a web page, run some JavaScript to complete and submit a form, and analyze the outcome? ...