new XMLHttpRequest, or CURL command

692 views
Skip to first unread message

Indrawan alghifary

unread,
May 1, 2021, 9:40:49 AM5/1/21
to mementodatabase
how to use the command in the memento database, new XMLHttpRequest ();
I want to implement curl 
This my curl
curl -H "Key: AEDHIGAT-QATEGWOX-OPCSCPQX-2E00B1L7-VJBXXKMA" -H "Sign: bab004e5a518740d7a33b38b44dbebecd3fb39f40b42391af39fcce06edabff5233b3e8064a07c528d1c751a6923d5116026c7786e01b22e2d35277a098cae99" -X POST 'https://indodax.com/tapi' -d 'method=getInfo&timestamp=1578304294000&recvWindow=1578303937000'

Bill Crews

unread,
May 1, 2021, 9:56:54 PM5/1/21
to Indrawan alghifary, mementodatabase
I'm not very familiar with AJAX; I don't think I can help. I find no mention of XMLHttpRequest in the wiki, including the What's New in Memento page listing all the release notes for all releases since 3.7.6. I also find no reference to it in Memento Help.

So, within the standard Memento product line, I doubt it exists. Do I surmise correctly then that this is a function in the Memento API, which is a write different product and kind of product? I know close to zero about that. So, it would be helpful if you would provide some context for this request. I think there are few forum people who can help you, and more information might trigger them into responding when otherwise, they might not.

--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/CAEUaYtmok1ONsABV8h6hSWwc75iJ193XSVWaKHLNq32fjGx6uQ%40mail.gmail.com.

Indrawan alghifary

unread,
May 2, 2021, 9:02:47 AM5/2/21
to Bill Crews, mementodatabase
I want to retrieve data from the server, with http post. But the result, does not match the data sent.
This my code : 

var url = "https://indodax.com/tapi";
var http = http();

http.headers({"Key": "AEDHIGAT-QATEGWOX-OPCSCPQX-2E00B1L7-VJBXXKMA","Sign": "bab004e5a518740d7a33b38b44dbebecd3fb39f40b42391af39fcce06edabff5233b3e8064a07c528d1c751a6923d5116026c7786e01b22e2d35277a098cae99","Content-Type": "application/x-www-form-urlencoded"});

var data = "method=getInfo&timestamp=1578304294000&recvWindow=1578303937000";

var result = http.post(url,data);
message (result.body);

Key and sign Just for example, I can't give the real key and secret.

If I send it with php or python success. But i can't implement on http post in the memento. 

Bill Crews

unread,
May 2, 2021, 11:11:23 AM5/2/21
to Indrawan alghifary, mementodatabase
I just don't have the experience & knowledge to help. I hope someone else can help. Good luck.

Er Mo

unread,
May 2, 2021, 2:51:58 PM5/2/21
to mementodatabase
Hallo
Ich verstehe auch nicht was sie machen wollen . Ich habe in Memento Daten von einer Stelle in Internet geholt und eingetragen  mittels API . Das Ergebnis / die Rückmeldung ist in einen JSON Format , aus den ich die Gewünschten Daten ziehe . Vieleicht hilft ihnen das weiter .

Hello
I don't understand what they want to do either. In Memento I fetched data from a place in the Internet and entered it using an API. The result / feedback is in a JSON format, from which I pull the desired data. Maybe that will help you further.

Indrawan alghifary

unread,
May 5, 2021, 6:14:32 AM5/5/21
to Er Mo, mementodatabase
That's right. I want to retrieve data from internet sources, but it gets stuck. 


Er Mo

unread,
May 5, 2021, 12:52:04 PM5/5/21
to mementodatabase
Hallo
Das ist der Teil von meinen Skript mit den ich Wetterdaten abrufe .

const zahl1 = 35
  const apikey = //Iher API Key
  const lat ="XX.08";
  const lon ="XX.65"
  const url = "http:/" + "/api.openweathermap.org/data/2.5/find?lat=" + lat + "&lon=" +lon +"&cnt=" + zahl1 + "&units=metric&lang=de&appid=" + apikey;
  var result = http().get(url);
  if(result.code == "200") {
     var products = JSON.parse(result.body);
 // var summ1 = products.count
    for( var j =0;j<zahl1;j++){
     api1 = new Object();
     var product = products.list[j];
     api1["name"] = product.name

Mit den Variablen ( const ) habe ich die Anfrage übersichtlicher gegliedert . zahl1 ist die Anzahl der Wetterstationen . lat/lon meine Koartinaten die den Suchmitelpunkt definiren . Der result.code gibt den Status der Anfrage zurück . 200 = ervolkreich . Die Rückgabe ist in einen JSON format . Ich nutze zum Testen und anschauen das Programm " Postman "

Hello
That's the part of my script that I use to get weather data.

const number1 = 35
   const apikey = // Your API key
   const lat = "XX.08";
   const lon = "XX.65"
   const url = "http: /" + "/api.openweathermap.org/data/2.5/find?lat=" + lat + "& lon =" + lon + "& cnt =" + number1 + "& units = metric & lang = de & appid = "+ apikey;
   var result = http (). get (url);
   if (result.code == "200") {
      var products = JSON.parse (result.body);
  // var summ1 = products.count
     for (var j = 0; j <number1; j ++) {
      api1 = new Object ();
      var product = products.list [j];
      api1 ["name"] = product.name

With the variables (const) I have structured the query more clearly. number1 is the number of weather stations. lat / lon my coordinates that define the search center. The result.code returns the status of the request. 200 = populous. The return is in a JSON format. I use the program "Postman" to test and watch

Indrawan alghifary

unread,
May 6, 2021, 7:57:54 AM5/6/21
to Er Mo, mementodatabase
My url Post https://indodax.com/tapi 
no query parameter, how to convert or see the length of the query. in my url?
My secret with hmac, but I found a solution to the problem. 

Er Mo

unread,
May 6, 2021, 1:25:50 PM5/6/21
to mementodatabase
Hallo
Die Lösung würde mich Interessieren .

Hello
I would be interested in the solution.

Indrawan alghifary

unread,
May 7, 2021, 6:20:11 AM5/7/21
to Er Mo, mementodatabase
I only found a solution for the HMAC problem, but for http.pos, it is stuck.

Just add Javascript library :

And this my script :
var hash = var hash = CryptoJS.HmacSHA512("method=getInfo&timestamp=1578304294000&recvWindow=1578303937000", "f60617a68fcce028f0a90bc9eb765d17379eb548cc935c01a7ee3186eecf870e9b68f27a31bcfe8d");

message (hash)

Many javascript libraries can't be installed in memento, if they could, that would be awesome


Bill Crews

unread,
May 7, 2021, 6:41:58 AM5/7/21
to Indrawan alghifary, Er Mo, mementodatabase
Do you know which libraries can be installed & which can't, other than by trial & error? I'd very much like to know that.

Indrawan alghifary

unread,
May 7, 2021, 7:03:39 AM5/7/21
to Bill Crews, Er Mo, mementodatabase

Bill Crews

unread,
May 7, 2021, 10:54:21 AM5/7/21
to Indrawan alghifary, Er Mo, mementodatabase
This dialog is you & Ernst now, & stay out of it, but I did look at it momentarily and noticed that it contains objects that Memento's Rhino doesn't have -- specifically Promise.

Where does this code run? Not in Memento, I think.

Indrawan alghifary

unread,
May 7, 2021, 12:36:28 PM5/7/21
to Bill Crews, Er Mo, mementodatabase
I'm sorry, I'm not fluent in English, I'm just guessing and translating what you mean.

Completely not running in memento, but it may partially work like Crypto.js. And maybe many more. Maybe someday development could add more javascript libraries, like moment.js
Reply all
Reply to author
Forward
0 new messages