Skip to main content
Version: 7.23.0 🚀

API Layer

If you generate your project by using AutoCode Solution/Code Generator, you'll have 6 methods ready for each controller.

  1. list
  2. get
  3. insert
  4. update
  5. delete
  6. bulkSave

Find them in

  • BE: {YourMicroserviceName}.API.{YourTableName}Controller.cs
  • UI: views/Routes/{YourTableName}/{YourTableName}PageConfig.tsx

Swagger​

We use Swagger for writing REST-based APIs.

Swagger (now the "Open API Initiative") is a framework for describing your API using a common language that everyone can understand.

enter image description here

  • Design-first users: use Swagger Codegen to generate a server stub for your API. The only thing left is to implement the server logic – and your API is ready to go live!
  • Use Swagger Codegen to generate client libraries for your API in over 40 languages.
  • Use Swagger UI to generate interactive API documentation that lets your users try out the API calls directly in the browser.
  • Use the spec to connect API-related tools to your API. For example, import the spec to SoapUI to create automated tests for your API.
  • And more! Check out the open-source and commercial tools that integrate with Swagger.

Open API 3.0​

API layer is fully compliant with Open API 3.0 specifications. So feel free to use also at a bank which needs to comply with PSD2.

Authorization of Controllers​

By default, all methods (except login) need a bearer token as JWT to be authenticated.

bearer token as JWT

Response Object of Controller/Methods​

There is a standard and generic reponse object returned for any method call. Thus, it gets easier to get familiar and integrate to UI endpoints.

PropertyType
successboolean
messagestring
errorsJSON Object Array
dataJSON Object, JSON Object Array

Successful example:

{   
"success": true,
"message": "Listed successfully",
"errors": [],
"data": [
{ "fullName": "John Doe", "profession": "Engineer"},
{ "fullName": "Jane Doe", "profession": "Doctor"}
]
}

Failed example:

{   
"success": false,
"message": "Something went wrong",
"errors": [
{
"code": "1020",
"message": "fullName cannot be null",
"stackTrace": "<Stacktrace of exception>"
}
],
"data": {}
}

Request Object of List Methods​

PropertyType
paginationJSON Object
criteriaJSON Object

Example:

{
"pagination": {
"currentPage": 0,
"maxPage": 20,
"totalRowCount": 0,
"maxRowsPerPage": 100,
"resultRowCount": 0
},
"criteria": {
"fullName": "John",
"status": 1
},
"GridCriterias":{
"sortModel":[{"propertyName": "fullName", "order": "asc"}],
"filterModel":[]
}
}