AGIR REST API

Modified on Tue, 22 Oct at 5:56 PM

With our REST API´s you can create new processes, update data, send data to other applications in an integrated and secure way. The process of authentication is a pre-requisite before using our API’s. This authentication is a bearer token. The bearer token is obtained by following a specific procedure that involves creating an entry in the "APIKey" SQL table. 

 

To get started, you need to create an entry in the APIKey table. Here are the details of the columns in the APIKey table: 

 

  • KeyName: This column stores the name of the company. You should populate this column with the name of the respective company. 

  • KeyCode: This column stores an alphanumeric code with 40 characters. The code should only contain alphanumeric characters and no special characters. This will be your bearer token. 

  • KeyAPI: This column stores the characters "Agir." This value is a constant and should be the same for all entries in the table. 

 

The request must include the bearer token in the "Authorization" header of their API requests. The header should follow the format: "Bearer [token]" where [token] represents the extracted bearer token value which is the “KeyCode”. 

 

  

 

Ready to Use API´s

 

POST wkf_val  

This endpoint fills information to a record.

Example: define a supplier VAT Number

 

Parameters: 

id (INT): ID of Agir record 

fields (json): Key corresponds to field name and value corresponds to the value that you want to insert. 


Example: 

{ 

    id:23381, 

    fields:{ 

        NameOfContact:"Peter Silva", 

        EmailOfContact:"petersilva@iqa.pt", 

        DateOfOcurrance:"06/06/2023" 

    } 

} 

 

  

 

POST agir_table_insert 

This endpoint inserts data on a Agir table

Example: add information about Users for training

 

Parameters: 

table (String): Name of the SQL table that you wish to insert the data in.

data (JSON Array): An array of JSON objects. Each JSON object should contain the a combination of property which should be the name of the column in the table that you wish to insert data in and the value which should be the value that you wish to insert.

Note: In the case of inserting data of a table within a record the first property of the JSON should be "EstruturaID" and the value should be a string or a int value of the record that you wish to insert the data in.


Dates should be inserted in string with the following format DD/MM/YYYY



Example: 



{"table":"TrainingInformation","data":[

{"EstruturaID":"5974","NameOfTrainee":"Peter Silva" , "TrainingType" : "IT" , "Remarks":"Need extra training","Data":"31/11/2023"},


{"EstruturaID":"5974","NameOfTrainee: "João Tabarez","TrainingType": "IT" ,"Remarks":"To be done by the end of the month","Data":"01/01/2000"}]} 



 

GET wkf_val  

This endpoint retrieves information from a record. A json object will be returned where the key is the name of the field and the value is the correspondent value. 

Example: Get a supplier VAT Number

 

Parameters: 

id (INT): ID of Agir record 

fields (String Array, OPTIONAL) : Names of fields, if this parameter is not added all values from record will be returned 


Example: 

{ 

    id:23381, 

    fields:["NameOfContact","EmailOfContact","DateOfOcurrance"] 

} 

 

  



POST doc_acknowledge  

With this endpoint is possible to set a document acknowledgment. For more information regarding this feature please read our tutorial on Reading acknowledgment request  

Example: Set document X as acknowledged by user Y

 

Parameters: 

userID (INT): ID of Agir user, this is optional if instead of id you provide the parameter “username” 

username (string): Agir username, this is optional if an userID was provided 

documentID (INT): ID of the document in Agir, this is optional if you provide the parameter “code” 

code (string): Code of the document in Agir, this is optional if an documentID was provided 

 

Example: 

{ 

    userID:148, 

    username:"pedrosilva", 

    documentID:2601, 

    code:"Desp. Aut-28" 

} 

 

  

POST wkf_new  

With this endpoint is possible to create Agir workflow records.  

Example: Create a new customer complaint

 


Parameters: 

wkf  (INT): ID of Agir workflow 

inter (INT Array): An array of Agir users ID, this value will dictate which users will receive the workflow task 

title (string): Title of the new record 

fields (json): Key corresponds to field name and value corresponds to the value that you want to insert. 

 

Example: 

 

{ 

    wkf:278, 

    inter:[148], 

    title:"This is an API test", 

    fields:{ 

        NameOfContact:"Peter Silva", 

        EmailOfContact:"petersilva@iqa.pt", 

        DateOfOcurrance:"06/06/2023" 

    } 

} 

  

POST wkf_move  

https://yourdomain/api/agir/wkf_move 

With this endpoint is possible to move Agir workflow records to a different status and step.  

Example: move the workflow’s status to “Underway”

 

 

Parameters: 

id  (INT): ID of Agir workflow

status (INT): ID of the desired workflow status (WARNING: the status’ id must correspond to one of the workflow’s status. Inserting another status will result in errors)

inter (INT Array): An array of Agir users ID, this value will dictate which users will receive the workflow task (WARNING: if moving to a final status, SKIP this parameter entirely)

justification (string): Text describing the reason why the status was moved for workflow history purposes

 

Example: 

 


{                                                                                               

    ”id”:26497,

 "status”: 59,

    ”inter”:[172], 

    ”justification”:"ThisisanAPItest",

}



POST sql_view  

With this endpoint is possible to get the information from any Agir SQL view, this is useful to get workflow information in mass as well as any specific information that might be important. The creation of the view is usually done by IQA 

Example: Total number of complaints from last year


Parameters: 

viewname  (JSON): The key should be “viewname” and the value should be the view name in string. Please contact us if you need a specific view or if the current view does not return all the required information. 

 

Example: 

{viewname:"WKF_ActionPlan"} 

 




POST  wkf_doc_send

https://yourdomain/api/agir/wkf_doc_send

This endpoint allows you to send a document contained in a form (document object) to another instance of AGIR, or the same one. This endpoint does not apply to document attachements.


Example: Send the PDF of a Purchase Order from one Workflow to another Supplier File Workflow, within the same AGIR instance or another instance accessible via the Internet.

 

Parameters: 

  • id (INT): ID of Agir source record 
  • Field ID (string) : ID of Agir source record field
  • URL (string) : Agir URL target
  • id (INT): ID of Agir target record 
  • Field ID (string) : ID of Agir target record field


 { 

"sourceId": "21381",
"sourceField": "ComprovativoFatura",
"targetUrl": "https://delta.myagir.pt",
"targetId": "3124",
"targetField": "ComprovativoFatura"
 }
 






Customized API´s


In addition to the ready-to-use native APIs described above, during the implementation of AGIR we can develop new APIs for specific uses and scopes. This is an activity that we typically develop during the design and implementation phases of our projects. If necessary, please contact our technical team. Together, we will be able to develop the integration model that best serves  your organization.









Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article