REST APIs with Lasso 8.6

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

REST APIs with Lasso 8.6

French, Shelane
I am using a test rest client to make a call to a basic lasso page that outputs all the client headers, type, etc. But even in the headers, I'm not seeing anything that indicates a delete request was made, though that was the method I sent.

I need to be able to test for put and delete. Get and post seem pretty straight forward.


[cid:4ACDD5C0-522B-428A-96E3-911C46BB05DA]
Shelane French
Workforce Enablement
Livermore Information Technology


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: REST APIs with Lasso 8.6

French, Shelane
Ah geez... Pilsonism

Found the tag I need: client_FormMethod

Shelane French
Workforce Enablement
Livermore Information Technology




On 4/11/16, 8:34 AM, "[hidden email] on behalf of
French, Shelane" <[hidden email] on behalf of
[hidden email]> wrote:

>I am using a test rest client to make a call to a basic lasso page that
>outputs all the client headers, type, etc. But even in the headers, I'm
>not seeing anything that indicates a delete request was made, though that
>was the method I sent.
>
>I need to be able to test for put and delete. Get and post seem pretty
>straight forward.
>
>
>[cid:4ACDD5C0-522B-428A-96E3-911C46BB05DA]
>Shelane French
>Workforce Enablement
>Livermore Information Technology


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: REST APIs with Lasso 8.6

Jolle Carlestam-2
11 apr. 2016 kl. 17:39 skrev French, Shelane <[hidden email]>:
>
> Found the tag I need: client_FormMethod

This should be working in Lasso 9 as well. Does anyone know if it’s a wrapper method for something else?

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: REST APIs with Lasso 8.6

Marc Vos-3
Hi,

After many useless attempts I quit trying to do REST in Lasso and switched to PHP. That’s a TOTW.
I now simply write a PHP script which handles all REST requests. I find it much easier.

Short example below:

        $headers = apache_request_headers();
        $data = explode('/', strtolower($_SERVER['PATH_INFO']));
        unset($data[0]);

        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Headers: X-API-TOKEN, X-API-KEY, X-AUTH-TOKEN');

        // Check if access is allowed
        if(!isset($headers['X-API-KEY']) || $headers['X-API-KEY'] != '678123-ADC6-F233-A39C-B0674A39C996')
                $data[1] = 'No API key'; // Not authorized
        else
                $req = json_decode(file_get_contents("php://input"), false);

        switch ($data[1]) {
                case 'auth':
                        if(ok) {
                        }
                        else {
                                $retval->status = 400;
                                header($_SERVER["SERVER_PROTOCOL"] . $zzHTTPmsgs[$retval->status]);
                                $retval->id = 13;
                                $retval->msg = "Attribute missing: Type";
                        …
                        echo json_encode($retval);
                        break;

                case 'log':
                        …
                        break;

                default:
                        …
                        break;
        }

- -
Regards,
Marc Vos


> On 12 apr. 2016, at 14:56, Jolle Carlestam <[hidden email]> wrote:
>
> 11 apr. 2016 kl. 17:39 skrev French, Shelane <[hidden email]>:
>>
>> Found the tag I need: client_FormMethod
>
> This should be working in Lasso 9 as well. Does anyone know if it’s a wrapper method for something else?
>
> HDB
> Jolle
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: REST APIs with Lasso 8.6

French, Shelane
It would defeat my purpose of having a Lasso back-end with an Angular
front end if I replaced Lasso with PHP. I'm also not sure if I see
anything there that can't be done with Lasso.



Shelane French
Workforce Enablement
Livermore Information Technology




On 4/12/16, 8:49 AM, "[hidden email] on behalf of Marc
Vos" <[hidden email] on behalf of [hidden email]> wrote:

>Hi,
>
>After many useless attempts I quit trying to do REST in Lasso and
>switched to PHP. That¹s a TOTW.
>I now simply write a PHP script which handles all REST requests. I find
>it much easier.
>
>Short example below:
>
> $headers = apache_request_headers();
> $data = explode('/', strtolower($_SERVER['PATH_INFO']));
> unset($data[0]);
>
> header('Access-Control-Allow-Origin: *');
> header('Access-Control-Allow-Headers: X-API-TOKEN, X-API-KEY,
>X-AUTH-TOKEN');
>
> // Check if access is allowed
> if(!isset($headers['X-API-KEY']) || $headers['X-API-KEY'] !=
>'678123-ADC6-F233-A39C-B0674A39C996')
> $data[1] = 'No API key'; // Not authorized
> else
> $req = json_decode(file_get_contents("php://input"), false);
>
> switch ($data[1]) {
> case 'auth':
> if(ok) {
> }
> else {
> $retval->status = 400;
> header($_SERVER["SERVER_PROTOCOL"] . $zzHTTPmsgs[$retval->status]);
> $retval->id = 13;
> $retval->msg = "Attribute missing: Type";
> Š
> echo json_encode($retval);
> break;
>
> case 'log':
> Š
> break;
>
> default:
> Š
> break;
> }
>
>- -
>Regards,
>Marc Vos
>
>
>> On 12 apr. 2016, at 14:56, Jolle Carlestam <[hidden email]> wrote:
>>
>> 11 apr. 2016 kl. 17:39 skrev French, Shelane <[hidden email]>:
>>>
>>> Found the tag I need: client_FormMethod
>>
>> This should be working in Lasso 9 as well. Does anyone know if it¹s a
>>wrapper method for something else?
>>
>> HDB
>> Jolle
>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>>  the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>