extract data from http get method

Hi team,

i send an http request to my rest class, i want to extract ID , full name , pass word from this request , can you show me how doing it.

thank's

  • 0
  • 0
  • 423
  • 5
  • 1

Answers

Hi Sofiane

I'm assuming you want to read this from a JSON payload.  You can follow the instructions in https://community.intersystems.com/post/lets-write-angular-1x-app-cach%C... to implement a fromJSON method, after reading the payload from the HTTPRequest

 

HTH

Chris

Hi Chris

for the GET method , it's comming from my IHM , it's not in json form, you that i convert it into json form first?

thank's

HI Soufiane

I'd need more info about the format of the data and how you are sending it to comment any further

Hi Chris

thank's for your back, i'm blocked on the authentification request , i want to extract user name , mail and password from the http request , after i send these parameters to my function in rest class.

thank's  

So I think you're encoding it as an Authorization Header?  

In that case, you can extract this from

set Auth = %request.GetCgiEnv("HTTP_AUTHORIZATION")

then process this however you need to (for example if you have something like "Basic 123908109abc", this will unpack it and decode the Base64)

 set AuthType = $P(Auth," ",1)
  set AuthString = $P(Auth," ",2)
    set DecodeAuthString = $SYSTEM.Encryption.Base64Decode(AuthString)
    set userid = $p(DecodeAuthString,":",1)
    set token  = $p(DecodeAuthString,":",2)