Exemple de requête HTTP avec un corps JSON
Voici un exemple de requête HTTP avec un corps JSON.
POST /genapp/customers/
Host: www.example.com
Content-Type: application/json
Content-Length: nn 1
{
"customers":
{
"firstName": "Joe”,
"lastName": “Bloggs”,
"fullAddress":
{
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": 10021
}
}
}Où le Content-Length: nn 1 est la longueur de votre demande.Pour cet exemple, la structure du langage COBOL serait la suivante :
01 CUSTOMERS.
03 firstname pic x(8).
03 lastname pic x(8).
03 fulladdress.
05 streetaddress pic x(20).
05 city pic x(20).
05 state pic xx.
05 postalcode pic 9(5).