PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
Exemplo WINDEV Mobile como usar rest send e estruturas sem usar variáveis globais com estrutura na classe
Published by Boller
in the category Tools
New features



Description
WINDEV Mobile example how to use rest send and structures without using global variables with structure in class

TEM O PDF DA DOCUMENTACAO DENTRO DO ZIP

//EXEMPLO

URL is string = "https://api.dignustech.com.br/v1/partidas"

ENVIO is httpRequest
ENVIO.URL = URL
ENVIO.ContentType = mimeTypeJSON
ENVIO.Method = httpGet
RESPOSTA is httpResponse
RESPOSTA = RESTSend(ENVIO)

EDT_RESULTADO = RESPOSTA..Content

sRetJSON is Buffer = RESPOSTA..Content

Info(RESPOSTA..Content + CR + RESPOSTA..StatusCode)



//---------------------------------------------------------------------------------------- usando a classe

ClassWilli is a Class

m_Tabela is array of st_Tabela

END

st_totais is Structure
qtd is numeric
END

st_Tabela is Structure
id is numeric
data is string
hora is string
colete1 is string
colete2 is string
tempo is numeric
tempo1 is numeric
gol1_1 is numeric
gol2_1 is numeric
tempo2 is numeric
gol1_2 is numeric
gol2_2 is numeric
qrcode is string
status is string
END


//---------------------------------------------------- metodo

// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] ExecutaRest (<URL>)
//
// Parameters:
// URL: <specify the role of URL>
// Example:
// <Specify a usage example>
//
// instancia:
// URL: <specify the role of URL>
// instancia: <specify the role of instancia>
PROCEDURE ExecutaRest(URL)

ENVIO is httpRequest
ENVIO.URL = URL
ENVIO.ContentType = mimeTypeJSON
ENVIO.Method = httpGet
RESPOSTA is httpResponse
RESPOSTA = RESTSend(ENVIO)

sRetJSON is JSON = RESPOSTA..Content
n is int = sRetJSON.qtd
i is int = 0
nAux1 is int = 0

LOOP(n)

i++

//info(sRetJSON.registros[i].id)

nAux1 = ArrayAdd(m_Tabela)

m_Tabela[nAux1].id = sRetJSON.registros[i].id
m_Tabela[nAux1].data = sRetJSON.registros[i].data
m_Tabela[nAux1].hora = sRetJSON.registros[i].hora
m_Tabela[nAux1].colete1 = sRetJSON.registros[i].colete1
m_Tabela[nAux1].colete2 = sRetJSON.registros[i].colete2
m_Tabela[nAux1].tempo = sRetJSON.registros[i].tempo
m_Tabela[nAux1].tempo1 = sRetJSON.registros[i].tempo1
m_Tabela[nAux1].gol1_1 = sRetJSON.registros[i].gol1_1
m_Tabela[nAux1].gol2_1 = sRetJSON.registros[i].gol2_1
m_Tabela[nAux1].tempo2 = sRetJSON.registros[i].tempo2
m_Tabela[nAux1].gol1_2 = sRetJSON.registros[i].gol1_2
m_Tabela[nAux1].gol2_2 = sRetJSON.registros[i].gol2_2
m_Tabela[nAux1].qrcode = sRetJSON.registros[i].qrcode
m_Tabela[nAux1].status = sRetJSON.registros[i].status

END

RESULT RESPOSTA..Content


//------------------------------- codigo no botao


executa01 is ClassWilli

EDT_RESULTADO = executa01.ExecutaRest("https://api.dignustech.com.br/v1/partidas")

//---------------------------------------------------------------
Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
No review or comment? Be the first one!