Richieste batch

OData supporta le richieste batch per consentirvi di eseguire più operazioni in un'unica richiesta HTTP. È possibile utilizzare operazioni a livello di record, come creare, modificare, eliminare e trovare un record. In alternativa, è possibile creare una serie di operazioni in un punto ben definito che vengano eseguite indipendentemente dagli altri processi.

Vedere la Documentazione OData per informazioni complete sulle richieste batch.

Componente Descrizione

Metodo HTTP

POST

URL

https://host/fmi/odata/versione/nome-database/$batch

host – nome host FileMaker Cloud o FileMaker Server

versione – versione OData, sempre v4

nome-database – nome del database ospitato

$batch – nome del batch

Esempio: /fmi/odata/v4/GestContatti/$batch

Parametri

Esempio:

Copia
POST https://host/fmi/odata/v4/GestContatti/$batch
OData-Version: 4.0
Content-Type: multipart/mixed; boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77b
Authorization: FMID Token_ID_Claris
Content-Type: application/http

GET https://host/fmi/odata/v4/GestContatti/Contatti(1) HTTP/1.1

--batch_36522ad7-fc75-4b56-8c71-56071383e77b
Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Content-Type: application/http
Content-ID: 1

POST https://host/fmi/odata/v4/GestContatti/Contatti HTTP/1.1
Content-Type: application/json
Content-Length: 162

{
  "ChiavePrimaria": "MROSSI",
  "Nome": "Mario Rossi",
  "Zona": 1,
  "Titolo": "Responsabile vendite sud-ovest",
  "Società": "Esempio Inc.",
  "Sito Web": "www.esempio.com"
}

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Content-Type: application/http
Content-ID: 2

PATCH https://host/fmi/odata/v4/GestContatti/Contatti(1) HTTP/1.1
Content-Type: application/json
Content-Length: 32

{
  "Titolo": "Tecnico"
}

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Content-Type: application/http
Content-ID: 3

DELETE https://host/fmi/odata/v4/GestContatti/Contatti(7) HTTP/1.1

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd--
--batch_36522ad7-fc75-4b56-8c71-56071383e77b
Content-Type: application/http

GET https://host/fmi/odata/v4/GestContatti/Contatti(1) HTTP/1.1

--batch_36522ad7-fc75-4b56-8c71-56071383e77b--

Informazioni FileMaker

  • Specificare l'intestazione Content-Type come multipart/mixed e inserire una specifica boundary.

  • Il corpo di una richiesta batch è costituito da una serie di richieste e set di modifiche singoli.

  • Le richieste batch non supportano il riferimento a nuovi record creati con $<Content-ID> in un set di modifiche.