Re: Native 4D to make REST request to Django application

2018-12-11 Thread Jeffrey Kain via 4D_Tech
HTTP AUTHENTICATE will build these headers for you.


> On Dec 10, 2018, at 9:43 PM, Lee Hinde via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> HTTP AUTHENTICATE($user;$password)
> for the request to get the token.
> 
> Thereafter I used the token in the header and built the headers using arrays 
> with HTTP Request… In my case the format for the header was:
> 
> Header Name: Authorization, Header Value : Token 

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Native 4D to make REST request to Django application

2018-12-10 Thread Lee Hinde via 4D_Tech
Django is a python web framework. Django Rest Framework (DRF) is a plugin that 
facilitates adding a REST Api. It’s the most popular plugin for this,  but it’s 
not the only way to do it.

When I did this before there was an explicit call to get the token - the django 
developer created it. They may have used the default path, I’m not sure 
(/get-token)  I used the 4D command :
HTTP AUTHENTICATE($user;$password)
for the request to get the token.

Thereafter I used the token in the header and built the headers using arrays 
with HTTP Request… In my case the format for the header was:

Header Name: Authorization, Header Value : Token 


> On Dec 10, 2018, at 3:52 PM, Olson, Brad via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I am looking for assistance with developing a REST interface to a Django 
> application using native 4D v16R6 commands.  Is it possible to do this?  I 
> have been given a username, Password, and Basic Authorization token and  I 
> have tried using the HTTP AUTHENTICATE command to set username and password, 
> and then adding the Authorization to the http header but I am not getting 
> back the expected JSON results using the HTTP Get function.
> 
> Any suggestions would be appreciated!
> 
> Thank you,
> Brad Olson
> CommScope, Inc.
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Native 4D to make REST request to Django application

2018-12-10 Thread John DeSoi via 4D_Tech
I'm not familiar with Django, but here are some suggestions after a quick look 
at their API. They show an examples here with curl. 

https://www.django-rest-framework.org/tutorial/quickstart/

https://www.django-rest-framework.org/api-guide/authentication/

If you run these adding the --verbose option you should be able to get an 
accurate picture of what is sent and received. From there you can probably 
figure out what is going wrong with your 4D implementation. 

John DeSoi, Ph.D.


> On Dec 10, 2018, at 5:52 PM, Olson, Brad via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I am looking for assistance with developing a REST interface to a Django 
> application using native 4D v16R6 commands.  Is it possible to do this?  I 
> have been given a username, Password, and Basic Authorization token and  I 
> have tried using the HTTP AUTHENTICATE command to set username and password, 
> and then adding the Authorization to the http header but I am not getting 
> back the expected JSON results using the HTTP Get function.

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Native 4D to make REST request to Django application

2018-12-10 Thread Olson, Brad via 4D_Tech
I am looking for assistance with developing a REST interface to a Django 
application using native 4D v16R6 commands.  Is it possible to do this?  I have 
been given a username, Password, and Basic Authorization token and  I have 
tried using the HTTP AUTHENTICATE command to set username and password, and 
then adding the Authorization to the http header but I am not getting back the 
expected JSON results using the HTTP Get function.

Any suggestions would be appreciated!

Thank you,
Brad Olson
CommScope, Inc.
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**