1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Stackoverflow]

Discussão em 'StackOverflow' iniciado por fdantas, Abril 7, 2025.

  1. fdantas

    fdantas Administrator Moderador

    I am suffering to create a single REST GET API in the Progress OpenEdge. Someone have a simple example?

    DEFINE VARIABLE cResponse AS LONGCHAR NO-UNDO.
    DEFINE VARIABLE cJson AS LONGCHAR NO-UNDO.
    DEFINE VARIABLE cJsonConverted AS CHARACTER NO-UNDO.

    DEFINE BUFFER bCustomer FOR Customer.

    cJson = "[".

    FOR EACH bCustomer NO-LOCK:
    cJson = cJson + "{" +
    '"CustNum": "' + STRING(bCustomer.CustNum) + '", ' +
    '"Name": "' + bCustomer.Name + '", ' +
    '"City": "' + bCustomer.City + '", ' +
    '"Country": "' + bCustomer.Country + '"' +
    "}, ".
    END.

    cJson = TRIM(cJson, ", ") + "]".

    /* Converte LONGCHAR para CHARACTER antes de enviar a resposta */
    cJsonConverted = STRING(cJson).

    /* Define o cabeçalho da resposta REST */
    OUTPUT CONTENT-TYPE "application/json".
    PUT UNFORMATTED cJsonConverted.

    Continue reading...

Compartilhe esta Página