Quantcast

PUT method where is returned data?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PUT method where is returned data?

Mark Wieder via use-livecode
8.1.2 Indy with Desktop App

I am using an API that uses the PUT method for some of the calls. JSON is sent with server data as JSON. I can’t figure out how to access the returned JSON data from the PUT call. I can not effect the API call. It's a commercial SAAS application.

Here’s my snippet of code (everything is working with the PUT as far as I can tell. The  data in the JSON ends up in the server App where it should). I use the all caps PUT for my pea brain to understand this is a HTTP PUT method request ;-)

PUT tJsonData into URL tURL

put the result into tResult

put it into tResult2


I would of thought that either the result or it would have the data but both are empty. If there is an error, I do see tsneterr in the result. Where do can I find the response data?

Thanks in advance,
Bob Hall

Hosting, eCommerce, Website Design,
Custom Apps, and yes, Bicycle Repairs


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
Try the urlResponse:

     PUT tJsonData into URL tURL
     
     put the urlResponse into tResult

Regards,

Mark Hsu
Canela Software
[hidden email] <mailto:[hidden email]>



> On Feb 8, 2017, at 10:05 AM, Bob Hall via use-livecode <[hidden email]> wrote:
>
> 8.1.2 Indy with Desktop App
>
> I am using an API that uses the PUT method for some of the calls. JSON is sent with server data as JSON. I can’t figure out how to access the returned JSON data from the PUT call. I can not effect the API call. It's a commercial SAAS application.
>
> Here’s my snippet of code (everything is working with the PUT as far as I can tell. The  data in the JSON ends up in the server App where it should). I use the all caps PUT for my pea brain to understand this is a HTTP PUT method request ;-)
>
> PUT tJsonData into URL tURL
>
> put the result into tResult
>
> put it into tResult2
>
>
> I would of thought that either the result or it would have the data but both are empty. If there is an error, I do see tsneterr in the result. Where do can I find the response data?
>
> Thanks in advance,
> Bob Hall
>
> Hosting, eCommerce, Website Design,
> Custom Apps, and yes, Bicycle Repairs
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
Mark Hsu wrote:

 >> On Feb 8, 2017, at 10:05 AM, Bob Hall wrote:
 >>
 >> PUT tJsonData into URL tURL
 >>
 >> put the result into tResult
 >>
 >> put it into tResult2
 >>
 >> I would of thought that either the result or it would have the data
 >>
 >
 > Try the urlResponse:
 >
 >      PUT tJsonData into URL tURL
 >
 >      put the urlResponse into tResult

"it" is not longer a valid container for URL responses?

I missed that memo.  Which version did that change take place in?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode

On Feb 8, 2017, at 2:02 PM, Richard Gaskin via use-livecode <[hidden email]<mailto:[hidden email]>> wrote:

Mark Hsu wrote:

>> On Feb 8, 2017, at 10:05 AM, Bob Hall wrote:
>>
>> PUT tJsonData into URL tURL
>>
>> put the result into tResult
>>
>> put it into tResult2
>>
>> I would of thought that either the result or it would have the data
>>
>
> Try the urlResponse:
>
>      PUT tJsonData into URL tURL
>
>      put the urlResponse into tResult

"it" is not longer a valid container for URL responses?

I missed that memo.  Which version did that change take place in?

My understanding is that GET requests are simply submitted in a LiveCode ‘put URL tURL into <container>” statement, and the results go into the container you designate. POST requests are returned to ‘it’.

As far as I know it’s always been like this.

The PUT results going to the urlResponse is a new one on me. But I’m happy to know it.

Devin


Devin Asay
Director
Office of Digital Humanities
Brigham Young University

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
Devin Asay wrote:

 > On Feb 8, 2017, at 2:02 PM, Richard Gaskin wrote:
 >
 >> "it" is not longer a valid container for URL responses?
 >>
 >> I missed that memo.  Which version did that change take place in?
 >>
 >> My understanding is that GET requests are simply submitted in a
 >> LiveCode ‘put URL tURL into <container>” statement, and the results
 >> go into the container you designate. POST requests are returned to
 >> ‘it’.
 >
 > As far as I know it’s always been like this.
 >
 > The PUT results going to the urlResponse is a new one on me. But I’m
 > happy to know it.

If urlResponse is offered as an alternative that may be useful, but if
"it" is no longer valid at all it'll break a lot of scripts.

Sometimes moving forward with changes, even those that require script
changes, isn't a bad thing.

But this could use some clarification from the home team.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
On Fri, Feb 10, 2017 at 8:47 AM, Richard Gaskin via use-livecode <
[hidden email]> wrote:

> Devin Asay wrote:
>
> > On Feb 8, 2017, at 2:02 PM, Richard Gaskin wrote:
> >
> >> "it" is not longer a valid container for URL responses?
> >>
> >> I missed that memo.  Which version did that change take place in?
> >>
> >> My understanding is that GET requests are simply submitted in a
> >> LiveCode ‘put URL tURL into <container>” statement, and the results
> >> go into the container you designate. POST requests are returned to
> >> ‘it’.
> >
> > As far as I know it’s always been like this.
> >
> > The PUT results going to the urlResponse is a new one on me. But I’m
> > happy to know it.
>
> If urlResponse is offered as an alternative that may be useful, but if
> "it" is no longer valid at all it'll break a lot of scripts.


The urlresponse has been around for a number of years. It was added so that
you can get the response sent back from the server for url calls. It
doesn’t affect how it behaves in any way. Prior to adding the urlresponse
one couldn’t get the server response for PUT … into URL tURL or DELETE URL
tURL calls. It’s been so long I don’t recall the exact reasons why ‘it’
wasn’t used but I much prefer reading ’the urlresopnse’ in my code than
dealing with ‘it’ which is meaningless until put into another variable.

--
Trevor DeVore
Outcome & ScreenSteps
www.outcomeapp.io     -     www.screensteps.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
On Fri, Feb 10, 2017 at 6:52 AM, Trevor DeVore via use-livecode <
[hidden email]> wrote:

> It’s been so long I don’t recall the exact reasons why ‘it’
> wasn’t used but I much prefer reading ’the urlresopnse’ in my code than
> dealing with ‘it’ which is meaningless until put into another variable.
>

I have been horrified by "it" since HyperCard 1.0 was released . . .


--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Trevor DeVore wrote:

 > The urlresponse has been around for a number of years. It was added
 > so that you can get the response sent back from the server for url
 > calls. It doesn’t affect how it behaves in any way. Prior to adding
 > the urlresponse one couldn’t get the server response for PUT … into
 > URL tURL or DELETE URL tURL calls. It’s been so long I don’t recall
 > the exact reasons why ‘it’ wasn’t used but I much prefer reading
 > ’the urlresopnse’ in my code than dealing with ‘it’ which is
 > meaningless until put into another variable.

Thank you, Trevor.  With that explanation I can rest easy, since my
older code only uses GET and POST.

So to summarize, please let me know if any of the following is incorrect:

Both "it" and "urlResponse" can be used to get return values from:
GET
POST

"urlResonse" can be used to get return values from:
GET
POST
PUT
DELETE

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
On Fri, Feb 10, 2017 at 9:10 AM, Dr. Hawkins via use-livecode <
[hidden email]> wrote:

> On Fri, Feb 10, 2017 at 6:52 AM, Trevor DeVore via use-livecode <
> [hidden email]> wrote:
>
> > It’s been so long I don’t recall the exact reasons why ‘it’
> > wasn’t used but I much prefer reading ’the urlresopnse’ in my code than
> > dealing with ‘it’ which is meaningless until put into another variable.
> >
>
> I have been horrified by "it" since HyperCard 1.0 was released . . .
>

I recall seeing “it” used frequently in code I read when first learning
LiveCode. A variable named “it” was more of a barrier than anything as it
made no sense where it was coming from. It just appeared in the code out of
thin air.

--
Trevor DeVore
Outcome & ScreenSteps
www.outcomeapp.io     -     www.screensteps.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
On Fri, Feb 10, 2017 at 9:43 AM, Richard Gaskin via use-livecode <
[hidden email]> wrote:

>
> Thank you, Trevor.  With that explanation I can rest easy, since my older
> code only uses GET and POST.
>
> So to summarize, please let me know if any of the following is incorrect:
>
> Both "it" and "urlResponse" can be used to get return values from:
> GET
> POST
>
> "urlResonse" can be used to get return values from:
> GET
> POST
> PUT
> DELETE


That is correct.

--
Trevor DeVore
Outcome & ScreenSteps
www.outcomeapp.io     -     www.screensteps.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PUT method where is returned data?

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
On Feb 10, 2017, at 9:52 AM, Trevor DeVore via use-livecode <[hidden email]> wrote:
>
>  I much prefer reading ’the urlresopnse’ in my code than
> dealing with ‘it’ which is meaningless until put into another variable.

In my defense — it was my attempt at figuring out where PUT put the response data. I was desperate to figured it out and thought it might contain my JSON response. It is not part of my regular coding. But I'll admit. I was using Hypercard at v1.0 so it is my fall back when all else fails. Old habits are hard to break ;-)

Thanks for the help and reminding me about urlResponse. My API wrapper is working like a charm!

Bob Hall
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...