2025-07-29- Action EndPoint: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Action Endpoint Test =
* Note!: Can Test endpoint can test by API Gateway
''' Test API Work Flow '''
[[File:Test API Work Flow.png|frame|center|Work Flow Diagram]]
== Create EndPoint ==
== Create EndPoint ==


=== Create Basic ===
=== Create Basic ===
''' requestParam '''
''' Request Parameters '''
* objectType
** Type: string
** Required: true
* fieldNames
** Type: object
** Required: true
** Description: if objectType have versionedData can send fields of versionedData to created
''' Request Example'''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
Line 11: Line 24:
}
}
</syntaxhighlight>
</syntaxhighlight>
''' returnOutput '''
''' Output Response '''
* objType
** Type: object
** Description: return objectType and serviceTag
* objInstanceFull
** Type: object
** Description: return identifiers and fields of objectType
* relationships
** Type: array
** Description: return empty array if not send create with relationship
* Status
** Type: string
** Description: if correct return: “complete” , f invalid return “error”
* errorsFound
** Type: array
** Description: return value if have which condition invalid
 
''' Return Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
Line 32: Line 62:
</syntaxhighlight>
</syntaxhighlight>


=== Create Node and Relationship ===
=== Create Object and Relationship ===
''' requestParam '''
''' Request Parameters '''
* objectType
** Type: string
** Required: true
* fieldNames
** Type: object
** Required: true
** Description: if objectType have versionedData can send fields of versionedData to created
* relationships
** Type: array
** Required: optional
** Description: can create node and relationships to targetNode
* relationships.relType
** Type: Object
** Required: true
* relationships.targetObjType
** Type: Object
** Required: true
* relationships.relationshipDirection
** Type: String
** Required: true
* relationships.targetIdentifiers
** Type: Object
** Required: true
 
''' Request Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
Line 40: Line 95:
   // fields or if have fields of versionedData
   // fields or if have fields of versionedData
  },
  },
  "relationships": [
  "relationships": [ // optional
   {
   {
     "relType": {
     "relType": {
Line 58: Line 113:
}
}
</syntaxhighlight>
</syntaxhighlight>
''' returnOutput '''
 
''' Output Response '''
* objType
** Type: object
** Description: return objectType and serviceTag
* objInstanceFull
** Type: object
** Description: return identifiers and fields of objectType
* relationships
** Type: array
** Description: return data object of create Relationships
* relationships.relType
** Type: object
* relationships.targetObjType
** Type: object
* relationships.relationshipDirection
** Type: string
* relationships.targetIdentifiers
** Type: object
* Status
** Type: string
** Description: if correct return: “complete” , if invalid return “error”
* errorsFound
** Type: array
**Description: return value if have which condition invalid
 
''' Return Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
objectType: "xxxx",
  "objType":{
fieldNames: {
    "objectType":"xxxx",
  // fields or if have versionedData
    "serviceTag":"yyyy"
  },
  },
  relationships: [
  "objInstanceFull":{
  {
    "identifiers":{
    relType: {
      // identifiers
      serviceTag: "xxxx",
    },
      relationshipTag: "rel"
    "fields":{
    },
      // fields
    targetObjType: {
      }
      serviceTag: "xxxx",
  },
      objectType: "yyyy"
  "relationships":[
    },
    {
    relationshipDirection: "xxxx", //'from' or 'to'
      "relType":{
    targetIdentifiers: {
        "serviceTag":"xxxx",
      // targetIdentifiers
        "relationshipTag":"rel"
      },
      "targetObjType":{
          "serviceTag":"xxxx",
          "objectType":"yyyy"
      },
      "relationshipDirection":"from", // or to
      "targetIdentifiers":{
          // targetIdentifiers
        }
     }
     }
   }
   ],
]
  "status":"complete", // or 'error'
  "errorsFound":[]
}
}
</syntaxhighlight>
</syntaxhighlight>
=== Test Create API Gateway ===
* Copy invoke URL for create in postman Type: PUT
* Body Parameter : not send objectType in parameter , but must to send every fieldNames in objectSchema that have requiredOnCreate = true
* storageResources : dynamoDB or graph (Cloudwatch)


== Update EndPoint ==
== Update EndPoint ==
''' requestParam '''
''' Request Parameters '''
* objectType
** Type: string
** Required: true
* objInstanceFull
** Type: object
** Required: true
* objInstanceFull.identifiers
** Type: object
** Required: true
* objInstanceFull.fields
** Type: object
** Required: true
** Description: if objectType have versionedData can send fields of versionedData to created
* versionedDataIds
** Type: object
** Required: optional
 
''' Request Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
  "objectType": "xxxxx",
  "objectType": "xxxxx",
"objInstanceFull": {
  "objInstanceFull": { // required
   "identifiers": {
   "identifiers": {
    //identifiers
    //identifiers
   },
   },
   "fields": {
   "fields": {
    // fields or if have fields of versionedData
    // fields or if have fields of versionedData
   }
   }
},
"versionedDataIds": { // optional
  // “versionedDataLabel”: versionedDataIds
  }
  }
}
}
</syntaxhighlight>
</syntaxhighlight>
''' returnOutput '''
''' Output Response '''
* objType
** Type: object
** Description: return objectType and serviceTag
* objInstanceFull
** Type: object
** Description: return identifiers and fields of objectType
* versionedDataIds
** Type: object
** Description: In case not send versionedDataIds: Every filedName in requestParams will be update >> If In case send versionedDataIds: If send fieldName not in versionedData will throw error
* Status
** Type: string
** Description: if correct return: “complete” , if invalid return “error”
* errorsFound
** Type: array
** Description: return value if have which condition invalid
 
''' Return Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
Line 123: Line 258:
}
}
</syntaxhighlight>
</syntaxhighlight>
=== Test Update API Gateway ===
* Copy invoke URL for get in postman Type: POST
* Body Parameter: not send objectType in parameter , just send “objInstanceFull” and fields want to update


== Get EndPoint ==
== Get EndPoint ==
''' requestParam '''
''' Request Parameters'''
* objectType
** Type: string
** Required: true
* identifiers
** Type: object
** Required: true
 
''' Request Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
Line 134: Line 281:
}
}
</syntaxhighlight>
</syntaxhighlight>
''' returnOutput '''
 
''' Output Response '''
* Identifiers
** Type: object
* fields
** Type: object
** Description: will be return all fields in database
 
''' Return Example '''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
Line 147: Line 302:
  }
  }
</syntaxhighlight>
</syntaxhighlight>
=== Test Get API Gateway ===
* Copy invoke URL for get in postman Type: FrontEnd use POST or GET
* Body Parameter: just send “identifiers”
[[Category:Working documents| 2025-07-30]]

Latest revision as of 08:27, 30 July 2025

Action Endpoint Test

  • Note!: Can Test endpoint can test by API Gateway

Test API Work Flow

Work Flow Diagram

Create EndPoint

Create Basic

Request Parameters

  • objectType
    • Type: string
    • Required: true
  • fieldNames
    • Type: object
    • Required: true
    • Description: if objectType have versionedData can send fields of versionedData to created

Request Example

{
 "objectType": "xxxxx",
 "fieldNames": {
  // fields or if have fields of versionedData
 }
}

Output Response

  • objType
    • Type: object
    • Description: return objectType and serviceTag
  • objInstanceFull
    • Type: object
    • Description: return identifiers and fields of objectType
  • relationships
    • Type: array
    • Description: return empty array if not send create with relationship
  • Status
    • Type: string
    • Description: if correct return: “complete” , f invalid return “error”
  • errorsFound
    • Type: array
    • Description: return value if have which condition invalid

Return Example

{
 objType: {
   objectType: "xxxxx",
   serviceTag: "yyyyy"
 },
 objInstanceFull: {
   identifiers: {
      //identifiers
   },
   fields: {
     //fields
   }
 },
 relationships: [],
 status: "complete",  // or "error"
 errorsFound: []
}

Create Object and Relationship

Request Parameters

  • objectType
    • Type: string
    • Required: true
  • fieldNames
    • Type: object
    • Required: true
    • Description: if objectType have versionedData can send fields of versionedData to created
  • relationships
    • Type: array
    • Required: optional
    • Description: can create node and relationships to targetNode
  • relationships.relType
    • Type: Object
    • Required: true
  • relationships.targetObjType
    • Type: Object
    • Required: true
  • relationships.relationshipDirection
    • Type: String
    • Required: true
  • relationships.targetIdentifiers
    • Type: Object
    • Required: true

Request Example

{
 "objectType": "xxxx",
 "fieldNames": {
  // fields or if have fields of versionedData
 },
 "relationships": [ // optional
   {
     "relType": {
       "serviceTag": "xxxx",
       "relationshipTag": "rel"
     },
     "targetObjType": {
       "serviceTag": "xxxx",
       "objectType": "yyyy"
     },
     "relationshipDirection": "xxxx", // 'from' or 'to'
     "targetIdentifiers": {
       // identifiers
     }
   }
 ]
}

Output Response

  • objType
    • Type: object
    • Description: return objectType and serviceTag
  • objInstanceFull
    • Type: object
    • Description: return identifiers and fields of objectType
  • relationships
    • Type: array
    • Description: return data object of create Relationships
  • relationships.relType
    • Type: object
  • relationships.targetObjType
    • Type: object
  • relationships.relationshipDirection
    • Type: string
  • relationships.targetIdentifiers
    • Type: object
  • Status
    • Type: string
    • Description: if correct return: “complete” , if invalid return “error”
  • errorsFound
    • Type: array
    • Description: return value if have which condition invalid

Return Example

{
  "objType":{
    "objectType":"xxxx",
    "serviceTag":"yyyy"
 },
  "objInstanceFull":{
    "identifiers":{
      // identifiers
    },
    "fields":{
      //  fields
      }
   },
  "relationships":[
     {
       "relType":{
         "serviceTag":"xxxx",
         "relationshipTag":"rel"
       },
       "targetObjType":{
          "serviceTag":"xxxx",
          "objectType":"yyyy"
       },
       "relationshipDirection":"from", // or to
       "targetIdentifiers":{
          // targetIdentifiers
        }
     }
   ],
  "status":"complete", // or 'error'
  "errorsFound":[]
}

Test Create API Gateway

  • Copy invoke URL for create in postman Type: PUT
  • Body Parameter : not send objectType in parameter , but must to send every fieldNames in objectSchema that have requiredOnCreate = true
  • storageResources : dynamoDB or graph (Cloudwatch)

Update EndPoint

Request Parameters

  • objectType
    • Type: string
    • Required: true
  • objInstanceFull
    • Type: object
    • Required: true
  • objInstanceFull.identifiers
    • Type: object
    • Required: true
  • objInstanceFull.fields
    • Type: object
    • Required: true
    • Description: if objectType have versionedData can send fields of versionedData to created
  • versionedDataIds
    • Type: object
    • Required: optional

Request Example

{
 "objectType": "xxxxx",
   "objInstanceFull": { // required
   "identifiers": {
     //identifiers
   },
   "fields": {
     // fields or if have fields of versionedData
   }
 },
 "versionedDataIds": { // optional
   // “versionedDataLabel”: versionedDataIds
 }
}

Output Response

  • objType
    • Type: object
    • Description: return objectType and serviceTag
  • objInstanceFull
    • Type: object
    • Description: return identifiers and fields of objectType
  • versionedDataIds
    • Type: object
    • Description: In case not send versionedDataIds: Every filedName in requestParams will be update >> If In case send versionedDataIds: If send fieldName not in versionedData will throw error
  • Status
    • Type: string
    • Description: if correct return: “complete” , if invalid return “error”
  • errorsFound
    • Type: array
    • Description: return value if have which condition invalid

Return Example

{
 returnValues: {
   objType: {
     objectType: "xxxxx",
     serviceTag: "yyyyy"
   },
   objInstanceFull: {
     identifiers: {
        //identifiers
     },
     fields: {
        //fields
     }
   },
   versionedDataIds: {
    // if send fields of versionedData will return versionedDataIds
  }
 },
 status:"complete",  // or "error"
 errorsFound: []
}

Test Update API Gateway

  • Copy invoke URL for get in postman Type: POST
  • Body Parameter: not send objectType in parameter , just send “objInstanceFull” and fields want to update

Get EndPoint

Request Parameters

  • objectType
    • Type: string
    • Required: true
  • identifiers
    • Type: object
    • Required: true

Request Example

{
  "objectType": "xxxxx",
  "identifiers": {
   //identifiers
  }
}

Output Response

  • Identifiers
    • Type: object
  • fields
    • Type: object
    • Description: will be return all fields in database

Return Example

{
  response: {
   identifiers: {
     //identifiers
   },
   fields: { 
     //fields
    }
   }
 }

Test Get API Gateway

  • Copy invoke URL for get in postman Type: FrontEnd use POST or GET
  • Body Parameter: just send “identifiers”