Invoking the create organization API using cURL

Once the service is up and running, we can make a cURL request to the web service to create the organization as follows:

curl -X POST 
http://localhost:8080/organization
-H 'Accept: application/json'
-H 'Content-Type: application/json'
  -d '{
"orgName": "TestOrg",
"description": "this is test org"
}'

This will return the location header, which is a URI that can be used to refer to the resource later. It will also return a 201 status code, indicating that a new resource has been created, as shown in the following screenshot:

We can see that entry in the database by querying it directly, as shown in the following screenshot:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset