NetTalk Central

Author Topic: API manual - "Try It"-button  (Read 7383 times)

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
API manual - "Try It"-button
« on: January 15, 2021, 01:41:50 AM »
Hello Bruce and all others,

this "Try It"-button is way cool, earned me some ohhhs and ahhhs during a presentation.

Unfortunately there seems to be one quirk.

For my presentation I prepared several requests and stored them as TXT (UTF-8 coded), so I could quickly copy and paste different request, showing different outcoming results.

The quirk now is, that sometimes no result got displayed. I checked DebugView and saw, that the result has been sent. Sometimes I could repeat 3 or 4 different requests in a row, then sometimes the second attempt showed a blank result field.



Did anyone else ran into this also?

The fix is to refresh the page with F5. This is not a real showstopper, less a rock, but a gravelstone. However, I suspect that other programmers, who will then be told to use that API to integrate into their own software, may talk bad about this flaw, trying to make the entire API-project look poor, unreliable.

Any idea how to overcome this behaviour?

Thank you inadvance
Wolfgang

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: API manual - "Try It"-button
« Reply #1 on: January 15, 2021, 04:05:19 AM »
Hi Wolfgang,

to best understand this it would need to be duplicated in an example.

Assuming it's unique to your service you should also check the Networking tab of your Browse Developer tools to see what response is sent back from the server. that may give some clues as to why you see nothing.

But as always, an example would be useful.

cheers
Bruce

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: API manual - "Try It"-button
« Reply #2 on: January 15, 2021, 08:55:47 AM »
Hi Bruce,

> to best understand this it would need to be duplicated in an example.

sure. I sent you same info and data on that running API-server a few days ago, but you want an example in source? Okay, I have to create one from scratch, as the one I am running has a DB with 100 MB of data.

I report back when I have made a new one.

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: API manual - "Try It"-button
« Reply #3 on: February 05, 2021, 04:40:06 AM »
Hi Wolfgang,

to best understand this it would need to be duplicated in an example.

Assuming it's unique to your service you should also check the Networking tab of your Browse Developer tools to see what response is sent back from the server. that may give some clues as to why you see nothing.

But as always, an example would be useful.

cheers
Bruce

Hello Bruce,

I took another example I have sent earlier to you. It is based on the Web42-example. (I am on NT 11.48)

Attached: web42_TryIt_Button.zip

After compile, go to

http://localhost:88/Database?GetContinent (as in URL.txt)

This is a simple method I once wrote because of the other report, and it is good to display the topic.

Unfold SOAP 1.1, move to "TryIt" and in xmldata just replace value with the number 1.

Now press that "Try It"-button. As a result you get back "Africa".

Delete the contents of the result field.

Replace that 1 with any other number from 2 to 6 and press "Try it".

You will get.... nothing.

However, sometimes it works though, most times it doesn't. In those cases you have to refresh the page and scroll down again.

Because this is the manual for other programmers to test our API, I do not want to give them any grain to complain about our API.

Let me be clear, the API works perfectly. Its this interface to others, which misbehaves. It would be nice if F5 would be avoidable.

Thanks
Wolfgang



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: API manual - "Try It"-button
« Reply #4 on: February 07, 2021, 11:23:18 PM »
Hi Wolfgang,

I tried it here in NetTalk 12 and NetTalk 11, but unfortunately was not able to duplicate the effect you are seeing. On my machine it just keeps working.

Which build of NetTalk are you testing with?

cheers
Bruce

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: API manual - "Try It"-button
« Reply #5 on: February 09, 2021, 06:17:52 AM »
Hi Wolfgang,

I tried it here in NetTalk 12 and NetTalk 11, but unfortunately was not able to duplicate the effect you are seeing. On my machine it just keeps working.

Which build of NetTalk are you testing with?

cheers
Bruce

As I wrote before, I am on 11.48.

You have really deleted the contents of the result field?

When I do this here, the fields shrinks back to its original coordinates and remains empty. In this case I have to refresh the page. The browser I use for testing are the recent versions of Mozilla FF and Chromium Edge.

Sorry to say, but I am not spreading FUD.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: API manual - "Try It"-button
« Reply #6 on: February 09, 2021, 09:24:36 PM »
Hi Wolfgang,

>> When I do this here, the fields shrinks back to its original coordinates and remains empty. In this case I have to refresh the page. The browser I use for testing are the recent versions of Mozilla FF and Chromium Edge.

>> Sorry to say, but I am not spreading FUD.,

You misunderstand my answer Wolfgang. I'm sure you are seeing the effect you are seeing. But I am unable to duplicate it here, with your example. Which doesn't mean you aren't seeing it, it means there is something else in play. Perhaps a browser extension, or AV setting, or proxy server or something like that.

What I need is more understanding, and information, on how to duplicate the effect.

Cheers
Bruce

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: API manual - "Try It"-button
« Reply #7 on: February 11, 2021, 08:05:14 AM »

Perhaps a browser extension, or AV setting, or proxy server or something like that.


I tested in different machines. Some instances of Firefox, of course, have extensions. But none of the Edge instances.

These are the browsers on a "virgin" machine with a Windows 10 preview with nothing else. But this machine is a bit older, so I still found the original Edge.

This one works okay:
* Edge 44.18.362.449.0 (EdgeHTML 18.18363)

I was able to delete the "result"-field a dozend times, either with DEL or BackSpace, each time the "Try-It"-button filled it correct as desired again and again.

..... Here comes the "no luck" section: ..........

Installed FF on this preview box, it behaves as I reported. Once "result" got deleted, it never got filled again, except after refresh / F5:
* Firefox 85.0.2 (no extension)

My developing machine with a recent Chromium-Edge and also no extension:
* Edge Chrome Version 88.0.705.63 (Offizielles Build) (64-Bit)

Chromium on a Raspberry, also no extension installed by me. However, "uBlock Origin" was installed by default:
* Version 72.0.3626.121 (Offizieller Build) Built on Raspbian , running on Raspbian 9.13 (32-Bit)

* Internet Explorer 11 - TryIt doesnt do anything. No wonder why. I tried just for completeness sake.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: API manual - "Try It"-button
« Reply #8 on: February 14, 2021, 09:02:47 PM »
given that I can't duplicate it here, but you can there, the next step is for you to debug it in the browser.

This is done in the developer Tools in your browser (F12) - then network tab.
When you get a response that does NOT work, then check the network tab for the response, cut out the XML of the response there, and post that here. (the XML will be invalid for some reason, so if you want to go a step further you can validate it in the clarion IDE).

Cheers
Bruce

RichCPT

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: API manual - "Try It"-button
« Reply #9 on: September 03, 2021, 10:20:25 PM »
*FIXED*
Yep, same issue here. But, the response text never displays on the page (even though it can be seen in the source DOM) if I clear it before  clicking "Try It".

I fixed this in NetTalk 11.52. by modifying the function "textToTextarea" that is defined in NetWeb.js in the folder:
    [clarion root folder]\accessory\libsrc\win\NetWeb\web\scripts

In that function modify the following line:
Code: [Select]
$('#' + textarea).html(text);
To read as follows:
Code: [Select]
$('#' + textarea).val(text);
Delete the "web" subfolder of your compiled project.
Rebuild everything.
When you open the browser to your API site, press Ctrl-F5 to clear the code cache.
It should now work. 

A "textarea" element is supposed to be just plain text.  So, it is better to use ".val" instead of ".html".

-Rich F.