Example URLs to modify data - Intergraph Smart API Manager - 5.0 - Help

Intergraph Smart API Manager Help

Language
English
Product
Intergraph Smart API Manager
Search by Category
Help
Smart API Manager Version
5.0

The following topics contain some example URLs for creating, updating and deleting data.

Example URL/request body for create

The following URL and request body provide an example of creating a new Vessel and related Nozzle via an HTTP POST request.

POST https://sam.acmeserver.com/SampleService/Sppid/v3/Sites('Site A')/Plants('Plant A')/Areas('Area A')/Units('Unit A')/Vessels

{

"@odata.type": "#Com.Ingr.Sppid.V3.PlantA.Vessel",

"Name": "Plant A\\Area A\\Unit A\\New Vessel",

"Description": "Description for vessel: Plant A\\Area A\\Unit A\\New Vessel",

"Status": "Active",

"EquipmentType": "Vessel",

"LengthSiValue": 6.5,

"Length": "21.33 ft",

"VolumeSiValue": 0.014158423304615248,

"Volume": "0.5 ft3",

"Updated": null,

"Nozzles": [

{

"@odata.type": "#Com.Ingr.Sppid.V3.PlantA.Nozzle",

"Name": "Plant A\\Area A\\Unit A\\New Vessel\\New Nozzle",

"Description": "Description for nozzle: Plant A\\Area A\\Unit A\\New Vessel\\New Nozzle",

"Status": "Active",

"EquipmentType": "Nozzle",

"LengthSiValue": 7,

"Length": "22.97 ft",

"PressureSiValue": 55158.058242745072,

"Pressure": "8 psi",

"NominalSize": 0.2,

"Updated": null

}

]

}

The HTTP POST request can be called directly on an entity set (exposed at the service root). The V3 API used here is multi-tenant, so the Vessels collection is implemented as a navigation property.

Per the OData protocol, HTTP POST is the only action that allows creating a related entity (that is, the related Nozzle) when creating a new instance of an entity.

You can pass a Prefer request header with "return=minimal" value if you want no response body. However, you still receive a Location response header with a URL value for the created instance.

Example URL/request body for update

The following URL and request body provide an example of updating an existing Vessel via an HTTP PATCH request.

PATCH https://sam.acmeserver.com/SampleService/Sppid/v3/Sites('Site A')/Plants('Plant A')/Areas('Area A')/Units('Unit A')/Vessels('3')

{

"@odata.type": "#Com.Ingr.Sppid.V3.PlantA.Vessel",

"Status": "Retired"

}

  • If the update is refused with an HTTP 428 (Precondition Required), you must pass the If-Match header with either "*" value or the current ConcurrencyToken value for the entity instance referenced (see Update/delete operations using optimistic concurrency for details).

  • Though the Smart API you consume may implement support for HTTP PUT, the OData protocol prefers PATCH over PUT to avoid unintended loss of data.

For HTTP PUT, if the request body excludes any properties for the instance being updated, those property value(s) are reset to default value(s).

PATCH avoids this potential problem by updating only the properties/values included in the request body.

Example URL for delete

The following URL provides an example of deleting an existing Vessel via an HTTP DELETE request.

DELETE https://sam.acmeserver.com/SampleService/Sppid/v3/Sites('Site A')/Plants('Plant A')/Areas('Area A')/Units('Unit A')/Vessels('3')

If the delete is refused with an HTTP 428 (Precondition Required), you must pass the If-Match header with either "*" value or the current ConcurrencyToken value for the entity instance referenced (see Update/delete operations using optimistic concurrency for details).