Creating Updating and Deleting Entity Records With Aptify Web API

To add, update, or delete an Entity record, use BasicEntityCreateUpdateDeleteRecord endpoint.

The POST action is used for the data modification operations. 

Headers

In order to save and receive entity record, the AptifyAuthorization header is required.

Header Name Header Value
AptifyAuthorization <AuthenticationProvider> <TokenId>

 

Endpoint Example

URL
https://<serverbase>/services/GenericEntity/{Id}

 

Creating Entity Record

Creates a new record for the specified Entity with the given data. To create the new record, populate the entity object in the request body with the field and value provided as name/value pairs.

Sample Endpoint

URL
https://<serverbase>/services/GenericEntity/AddData/{Id}

 

Parameters:

  • Entity: Generic Entity Object as structured data, containing Entity Name and data as GenericEntityData collection in key value format.
  • Id: Optional value need to pass any integer value, this value is not related to the data.

Request body formats

  • application/json,text/json
  • application/xml, text/xml
  • application/x-www-form-urlencoded 
Sample Request Body(text/json)
{
  "ID": -1,
  "EntityName": "sample string 2",
  "TokenID": "sample string 3",
  "EntityData": [
    {
      "$id": "-1",
      "Field": "sample string 1",
      "Value": "sample string 2"
    },
    {
      "$ref": "2"
    },
    {
      "$ref": "2"
    }
  ]
}
Sample Request Body(text/xml)
<GenericEntity xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Aptify.Services.Framework.BasicCreateReadUpdateDelete">
  <EntityData>
    <GenericEntityData>
      <Field>sample string 1</Field>
      <Value>sample string 2</Value>
    </GenericEntityData>
    <GenericEntityData>
      <Field>sample string 1</Field>
      <Value>sample string 2</Value>
    </GenericEntityData>
    <GenericEntityData>
      <Field>sample string 1</Field>
      <Value>sample string 2</Value>
    </GenericEntityData>
  </EntityData>
  <EntityName>sample string 2</EntityName>
  <ID>-1</ID>
  <TokenID>sample string 3</TokenID>
</GenericEntity>
}

 

HTTP Status Codes

Status Code Meaning
200 OK; View data in response body
404 Not Found or Not Authenticated

 

Updating an Existing Entity Record

This method updates (saves) data for a given Entity record. The ID of the record and an object with the fields that are being updated, in name/value pairs, must be provided in the request body. It will return the newly updated entity in deep load format.

Endpoint Example

URL
https://<serverbase>/services/GenericEntity/SaveData/{Id}

Parameters:

  • data: Json data to be save along with Entity Name and ID, if Sub-Type data is also being updated then it should be under SubType Tag along with Name of the Sub-Type Entity as root.
  • Id: Option value need to pass any integer value, this value is not related to the data.

Request body formats

  • application/json,text/json
  • application/xml, text/xml
  • application/x-www-form-urlencoded
Sample Request Body(application/json)
  {
  "ID": "1",
  "UserID": "JessicaA",
  "PWD": "",
  "FirstName": "Jessica",
  "LastName": "Aaronson",
  "Title": "",
  "Email": "jessica.aaronson@democorp.com",
  "Company": "Demo Company",
  "Disabled": "False",
  "LinkID": "10",
  "LinkType": "PERSONS",
  "Person": "Jessica Pintaro",
  "SessionCount": "0",
  "NumFailedLoginAttempts": "0",
  "PasswordHint": "Street Grew Up On",
  "PasswordHintAnswer": "Mulberry Drive",
  "DateCreated": "1/1/2006 5:00:00 PM",
  "DateUpdated": "1/1/2006 5:00:00 PM",
  "WhoCreated": "sa",
  "WhoUpdated": "sa",
  "NameWCompany": "Jessica Aaronson/Demo Company",
  "WebUserGroups": "[SubType Link]"
}

 

Response Body Format

  • application/json,text/json
  • application/xml, text/xml
Sample Response Body(application/json)
 {
  "ID": "1",
  "UserID": "JessicaA",
  "PWD": "",
  "FirstName": "Jessica",
  "LastName": "Aaronson",
  "Title": "",
  "Email": "jessica.aaronson@democorp.com",
  "Company": "Demo Company",
  "Disabled": "False",
  "LinkID": "10",
  "LinkType": "PERSONS",
  "Person": "Jessica Pintaro",
  "SessionCount": "0",
  "NumFailedLoginAttempts": "0",
  "PasswordHint": "Street Grew Up On",
  "PasswordHintAnswer": "Mulberry Drive",
  "DateCreated": "1/1/2006 5:00:00 PM",
  "DateUpdated": "1/1/2006 5:00:00 PM",
  "WhoCreated": "sa",
  "WhoUpdated": "sa",
  "NameWCompany": "Jessica Aaronson/Demo Company",
  "WebUserGroups": "[SubType Link]"
}

 

HTTP Status Codes

Status Code Meaning
200 OK; View data in response body
404 Not Found or Not Authenticated

 

Deleting an Entity Record

To delete a record from an Entity, provide the Entity object and the ID of the record that will be deleted. 

Sample Endpoint

URL
https://<serverbase>/services/GenericEntity/DeleteData/{Id}

 

Parameters:

  • Entity: Generic Entity Object as structured data, containing Entity Name and data as GenericEntityData collection in key value format.
  • Id: Option value need to pass any integer value, this value is not related to the data.

Request body formats

  • application/json,text/json
  • application/xml, text/xml
  • application/x-www-form-urlencoded
Request Body(text/json)
 {
  "ID": 1,
  "EntityName": "sample string 2",
  "TokenID": "sample string 3",
  "EntityData": [
    {
      "$id": "2",
      "Field": "sample string 1",
      "Value": "sample string 2"
    },
    {
      "$ref": "2"
    },
    {
      "$ref": "2"
    }
  ]
}
Sample Request Body(text/xml Format)
 <GenericEntity xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Aptify.Services.Framework.BasicCreateReadUpdateDelete">
  <EntityData>
    <GenericEntityData>
      <Field>sample string 1</Field>
      <Value>sample string 2</Value>
    </GenericEntityData>
    <GenericEntityData>
      <Field>sample string 1</Field>
      <Value>sample string 2</Value>
    </GenericEntityData>
    <GenericEntityData>
      <Field>sample string 1</Field>
      <Value>sample string 2</Value>
    </GenericEntityData>
  </EntityData>
  <EntityName>sample string 2</EntityName>
  <ID>1</ID>
  <TokenID>sample string 3</TokenID>
</GenericEntity>

Response:

Response Body Format

  • application/json,text/json 
  • application/xml, text/xml
Sample Response Body(text/json Format)
 true
Sample Response Body(text/xml Format)
 <boolean xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</boolean>

 

HTTP Status Codes

Status Code Meaning
200 OK; View data in response body
404 Not Found or Not Authenticated
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.