English
Instant Developer Foundation Documentazione
  • Reference Librerie
  • Document Orientation
  • Web Api Service

Get Headers

funzione copia link

Scopo

Ritorna un oggetto di tipo IDMap contenente gli header della richiesta.

Sintassi

IDMap requestHeaders = WebApiService.getHeaders()

Esempio di codice

event MyDocHelper.GlobalDocumentWebAPI(
  IDDocument Document  // Source Document
  inout boolean Cancel // A boolean output parameter. If set to true it st...
)
{
  // Read username header
  IDMap requestHeaders = WebApiService.getHeaders()
  string username = requestHeaders.getValue("username")
  // 
  // Find employee with this username

  int vIdEmployee = 0
  if (username != null)
  {
    select into variables (found variable)
      set vIdEmployee = EmployeeId
    from
      Employees // master table
    where
      LastName = username
  }
  // 
  // Employee not authorized; abort the request

  if (vIdEmployee == 0)
  {
    Cancel = true
    WebApiService.setResponse(formatMessage("User |1 not found", username, ...), 401
      , ...)
  }
}
  • Viene utilizzata nell'evento OnWebApi o comunque durante una richiesta WebAPI. Prima della notifica dell'evento o durante una richiesta non WebAPI, ritorna una mappa vuota.

Ultima modifica: 22/08/2019 / Validità: da 13.0.5600

Vedi Anche

  • ID Map
  • On Web API (evento)

Hai trovato utile l'articolo?

Grazie per il feedback!

Ti serve altro aiuto?

Consulta il Forum