6. API endpoints - Tracking Type 

Page / - last modified by Achraf El Kari on 2021/11/23 11:46 

Tracking Type 
last modified by Achraf El Kari
on 2021/11/23 11:46

Table of Contents
Introduction
Endpoints
Errors

Contents
•	Introduction
•	Endpoints
•	Errors
•	iXPath Endpoints v3
Introduction
We will go through all endpoints needed to manage the Tracking type entity.
Endpoints
PS: For all those endpoints, the env params are mandatory on the header, otherwise you got an error 400 (BAD PARAMS).
URL [method]	Description	Input example	Output example	
/rest/trackingType [GET]
hedear : Authorization + env => Mandatory
 	get all tracking Types of the giving environment ==> 
order, orderLine...	(no input required)	TrackingTypes.json	
/rest/trackingType [POST]	Insert or update new TrackingType
If the trackingType already exists, then it will be updated.
PS1 : iXPath will take in consideration the environment given at the header while inserting and updating.
PS2 : iXPath v3 is case sensitive.	{
  "alias":"order",   
  "label":{
     "fr":"Commande",
     "en":"Order"
   },
  "dataTypes":[
      {
        "alias":"orderNumber",
        "label":{
           "fr":"Numéro de commande",
           "en":"Order Number"
         },
        "type":"NUMBER",
        "size":10,
        "mandatory":true,
        "isList":false
      },
      {
        "alias":"orderLine",
        "label":{
           "fr":"Ligne de commande",
           "en":"Order Lines"
         },
        "type":"TRACKING",
        "trackingType":"orderLine",
        "mandatory":true,
        "isList":false
      }
   ]
}	{
   "timestamp": 1620217014704,
   "status": "200",
   "data": [
        {
           "date": "Tue May 04 16:37:49 GMT+01:00 2021",
           "current": "true",
           "author": "person1232",
           "id": "11e8707eb50e25c00a62e4efedb5f6071ec7e27e",
           "message": "version 2"
        },
        {
           "date": "Tue May 04 13:28:12 GMT+01:00 2021",
           "current": "false",
           "author": "person1",
           "id": "4b64d02451f47d9cb91d08faa986c941deef0f5c",
           "message": "version 1"
        }
    ]
}	
/rest/git/commit [POST]	commit changes in files with a message	{
"files":
[
{"fileName" : "newFile.xml"},
{"fileName" : "/dir/modifiedFile.pdf"}
],
"message": "this is a commit message"
}	it returns a String with the commit message meaning that the commit has passed successfully.
eg :
{
   "timestamp": 1620217700570,
   "status": "200",
   "data": "this is a commit message"
}  	
/rest/git/switchComit/{id}
[GET]	switch to a certain version and return the history of all commits.
NB : if there are some modified files in the current version, these files will be moved to a new directory called :
.../archive/git-{timestamp}	 
 	{
   "timestamp": 1620217014704,
   "status": "200",
   "data": [
        {
           "date": "Tue May 04 16:37:49 GMT+01:00 2021",
           "current": "false",
           "author": "person1232",
           "id": "11e8707eb50e25c00a62e4efedb5f6071ec7e27e",
           "message": "version 2"
        },
        {
           "date": "Tue May 04 13:28:12 GMT+01:00 2021",
           "current": "true",
           "author": "person1",
           "id": "4b64d02451f47d9cb91d08faa986c941deef0f5c",
           "message": "version 1"
        }
    ]
}	
/rest/git/update [GET]	Integrates and pulls changes from a remote repository into the current branch.	(no input required)	it returns a success message.
eg : 
{
   "timestamp": 1620219625637,
   "status": "200",
   "data": "branch is now updated"
}	
/rest/environment/init [POST]	Clone a git repository into the directory of the current environment,
if it doesn't exist it creates a new directory and initialize the repo,
if the directory exists, the endpoint renames the directory and creates a new one and clones the repository.	(no input required)	it returns a "success" message :
eg :
{
   "timestamp": 1620229625932,
   "status": "200",
   "data": "Repository initialized successfully !"
}	
/rest/git/checkout/{branch} [POST]	switch to a certain branch	the {branch} must be replaced by the name of the branch destination.
eg : /rest/git/checkout/master
    /rest/git/checkout/develop	it returns a "success" message of checkout branch.
eg :
{
   "timestamp": 1620229625932,
   "status": "200",
   "data": "switched to branch : master"
}	
/rest/git/newbranch/{branch}
[POST]	create and switch to a new branch 	the {branch} must be replaced by the name of the branch destination.
eg :
    /rest/git/checkout/newBranch	it returns a "success" message of the branch creation.
eg :
{
   "timestamp": 1620229625932,
   "status": "200",
   "data": "new branch has been created : newBranch"
}	
/rest/git/revert [POST]	switch the modified file to the initial head version. 	 	it returns a "success" message.
eg :
{
   "timestamp": 1620229625932,
   "status": "200",
   "data": "the selected files has been synchronized to HEAD successfully !"
}	
Errors
below, you can find an example of technical and functional errors :
{
   "timestamp": 1620221672951,
   "status": "500",
   "error": "JSON file is not valid",
   "thechnicalError": "JSONObject[\"fileName\"] not found."
}
the functional error is shown with the JSON key "error", while technical error is stored in the "thechnicalError" key.