Wiki source code of Tracking Type
Version 7.3 by Achraf El Kari on 2021/11/23 11:35
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{box cssClass="floatinginfobox" title="**Contents**"}} |
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
![]() |
1.2 | 5 | = Introduction = |
![]() |
1.1 | 6 | |
![]() |
7.1 | 7 | We will go through all endpoints needed to manage the Tracking type entity. |
![]() |
1.1 | 8 | |
![]() |
1.4 | 9 | = Endpoints = |
10 | |||
![]() |
7.3 | 11 | **PS :** __//For all those endpoints, the env params is andatory on the header, otherwise you got an error 400 (BAD PARAMS).//__ |
12 | |||
13 | |||
![]() |
7.2 | 14 | |(% style="width:166px" %)**URL [method]**|(% style="width:238px" %)**Description**|(% style="width:599px" %)**Input example**|(% style="width:449px" %)**Output example** |
15 | |(% style="width:166px" %)((( | ||
16 | /rest/trackingType [GET] | ||
17 | |||
18 | |||
19 | hedear : Authorization + env => Mandatory | ||
![]() |
7.3 | 20 | \\PS :** If the env does not exist on the header, you got an error 400 (bad params)** |
![]() |
7.2 | 21 | )))|(% style="width:238px" %)get all tracking Type of the giving environment|(% style="width:599px" %)(no input required)|(% style="width:449px" %){{code language="JSON"}}{ |
![]() |
1.7 | 22 | "timestamp": 1620216790744, |
23 | "status": "200", | ||
24 | "data": [ | ||
25 | { | ||
26 | "fileName": "FileToF.txt", | ||
27 | "status": "Untracked" | ||
28 | }, | ||
29 | { | ||
30 | "fileName": "newfile.txt", | ||
31 | "status": "Modified" | ||
32 | } | ||
33 | ] | ||
34 | }{{/code}} | ||
![]() |
7.2 | 35 | |(% style="width:166px" %)/rest/git/history [GET]|(% style="width:238px" %)get all commits history, with their IDs ,authors ,messages, dates and if considired as current version or not |(% style="width:599px" %)(no input required)|(% style="width:449px" %){{code language="JSON"}}{ |
![]() |
1.8 | 36 | "timestamp": 1620217014704, |
37 | "status": "200", | ||
38 | "data": [ | ||
39 | { | ||
40 | "date": "Tue May 04 16:37:49 GMT+01:00 2021", | ||
41 | "current": "true", | ||
42 | "author": "person1232", | ||
43 | "id": "11e8707eb50e25c00a62e4efedb5f6071ec7e27e", | ||
44 | "message": "version 2" | ||
45 | }, | ||
46 | { | ||
47 | "date": "Tue May 04 13:28:12 GMT+01:00 2021", | ||
48 | "current": "false", | ||
49 | "author": "person1", | ||
50 | "id": "4b64d02451f47d9cb91d08faa986c941deef0f5c", | ||
51 | "message": "version 1" | ||
52 | } | ||
53 | ] | ||
54 | }{{/code}} | ||
![]() |
7.2 | 55 | |(% style="width:166px" %)/rest/git/commit [POST]|(% style="width:238px" %)commit changes in files with a message|(% style="width:599px" %){{code language="JSON"}}{ |
![]() |
1.10 | 56 | "files": |
57 | [ | ||
58 | {"fileName" : "newFile.xml"}, | ||
59 | {"fileName" : "/dir/modifiedFile.pdf"} | ||
60 | ], | ||
61 | "message": "this is a commit message" | ||
![]() |
1.13 | 62 | }{{/code}}|(% style="width:449px" %)((( |
![]() |
1.10 | 63 | it returns a String with the commit message meaning that the commit has passed successfully. |
![]() |
1.4 | 64 | |
![]() |
1.10 | 65 | eg : |
66 | |||
![]() |
1.11 | 67 | {{code language="JSON"}}{ |
68 | "timestamp": 1620217700570, | ||
69 | "status": "200", | ||
70 | "data": "this is a commit message" | ||
71 | }{{/code}} | ||
![]() |
1.10 | 72 | ))) |
![]() |
1.13 | 73 | |(% style="width:166px" %)((( |
74 | /rest/git/switchComit/{id} | ||
![]() |
1.10 | 75 | |
![]() |
1.13 | 76 | [GET] |
![]() |
7.2 | 77 | )))|(% style="width:238px" %)((( |
![]() |
1.15 | 78 | switch to a certain version and return the history of all commits. |
79 | |||
![]() |
1.26 | 80 | **__NB __**: if there are some modified files in the current version, these files will be moved to a new directory called : |
![]() |
1.16 | 81 | |
82 | .../archive/git-{timestamp} | ||
![]() |
7.2 | 83 | )))|(% style="width:599px" %)((( |
![]() |
1.14 | 84 | the {id} in the URL should be replaced by the id of the wanted commit. |
![]() |
1.13 | 85 | |
![]() |
1.14 | 86 | eg : |
87 | |||
88 | rest/git/switchComit/4b64d02451f47d9cb91d08faa986c941deef0f5c | ||
![]() |
1.17 | 89 | |
90 | |||
![]() |
1.30 | 91 | )))|(% style="width:449px" %)((( |
92 | {{code language="JSON"}} | ||
93 | { | ||
![]() |
1.15 | 94 | "timestamp": 1620217014704, |
95 | "status": "200", | ||
96 | "data": [ | ||
97 | { | ||
98 | "date": "Tue May 04 16:37:49 GMT+01:00 2021", | ||
99 | "current": "false", | ||
100 | "author": "person1232", | ||
101 | "id": "11e8707eb50e25c00a62e4efedb5f6071ec7e27e", | ||
102 | "message": "version 2" | ||
103 | }, | ||
104 | { | ||
105 | "date": "Tue May 04 13:28:12 GMT+01:00 2021", | ||
106 | "current": "true", | ||
107 | "author": "person1", | ||
108 | "id": "4b64d02451f47d9cb91d08faa986c941deef0f5c", | ||
109 | "message": "version 1" | ||
110 | } | ||
111 | ] | ||
![]() |
1.30 | 112 | } |
113 | {{/code}} | ||
114 | ))) | ||
![]() |
7.2 | 115 | |(% style="width:166px" %)/rest/git/update [GET]|(% style="width:238px" %)((( |
![]() |
1.25 | 116 | Integrates and pulls changes from a remote repository into the current branch. |
![]() |
7.2 | 117 | )))|(% style="width:599px" %)(no input required)|(% style="width:449px" %)((( |
![]() |
1.26 | 118 | it returns a success message. |
![]() |
1.14 | 119 | |
![]() |
1.26 | 120 | eg : |
121 | |||
122 | {{code language="JSON"}} | ||
123 | { | ||
124 | "timestamp": 1620219625637, | ||
125 | "status": "200", | ||
126 | "data": "branch is now updated" | ||
127 | } | ||
128 | {{/code}} | ||
129 | ))) | ||
![]() |
7.2 | 130 | |(% style="width:166px" %)/rest/environment/init [POST]|(% style="width:238px" %)((( |
![]() |
1.28 | 131 | Clone a git repository into the directory of the current environment, |
![]() |
1.26 | 132 | |
![]() |
1.29 | 133 | if it doesn't exist it creates a new directory and initialize the repo, |
![]() |
1.28 | 134 | |
![]() |
5.4 | 135 | if the directory exists, the endpoint renames the directory and creates a new one and clones the repository. |
![]() |
7.2 | 136 | )))|(% style="width:599px" %)(no input required)|(% style="width:449px" %)((( |
![]() |
1.29 | 137 | it returns a "success" message : |
138 | |||
139 | eg : | ||
140 | |||
![]() |
1.30 | 141 | {{code language="JSON"}} |
142 | { | ||
143 | "timestamp": 1620229625932, | ||
144 | "status": "200", | ||
![]() |
5.2 | 145 | "data": "Repository initialized successfully !" |
![]() |
1.30 | 146 | } |
147 | {{/code}} | ||
![]() |
1.29 | 148 | ))) |
![]() |
7.2 | 149 | |(% style="width:166px" %)/rest/git/checkout/{branch} [POST]|(% style="width:238px" %)switch to a certain branch|(% style="width:599px" %)((( |
![]() |
4.1 | 150 | the {branch} must be replaced by the name of the branch destination. |
![]() |
1.29 | 151 | |
![]() |
4.1 | 152 | eg : /rest/git/checkout/master |
153 | |||
154 | /rest/git/checkout/develop | ||
155 | )))|(% style="width:449px" %)((( | ||
156 | it returns a "success" message of checkout branch. | ||
157 | |||
158 | eg : | ||
159 | |||
160 | {{code language="JSON"}} | ||
161 | { | ||
162 | "timestamp": 1620229625932, | ||
163 | "status": "200", | ||
164 | "data": "switched to branch : master" | ||
165 | } | ||
166 | {{/code}} | ||
167 | ))) | ||
168 | |(% style="width:166px" %)((( | ||
169 | /rest/git/newbranch/{branch} | ||
170 | |||
171 | [POST] | ||
![]() |
7.2 | 172 | )))|(% style="width:238px" %)create and switch to a new branch |(% style="width:599px" %)((( |
![]() |
4.1 | 173 | the {branch} must be replaced by the name of the branch destination. |
174 | |||
175 | eg : | ||
176 | |||
177 | /rest/git/checkout/newBranch | ||
178 | )))|(% style="width:449px" %)((( | ||
179 | it returns a "success" message of the branch creation. | ||
180 | |||
181 | eg : | ||
182 | |||
183 | {{code language="JSON"}} | ||
184 | { | ||
185 | "timestamp": 1620229625932, | ||
186 | "status": "200", | ||
187 | "data": "new branch has been created : newBranch" | ||
188 | } | ||
189 | {{/code}} | ||
190 | ))) | ||
![]() |
7.2 | 191 | |(% style="width:166px" %)/rest/git/revert [POST]|(% style="width:238px" %)switch the modified file to the initial head version. |(% style="width:599px" %){{code language="JSON"}}{ |
![]() |
5.2 | 192 | "files": |
193 | [ | ||
194 | {"fileName" : "newFile.xml"}, | ||
195 | {"fileName" : "/dir/modifiedFile.pdf"} | ||
196 | ] | ||
197 | }{{/code}}|(% style="width:449px" %)((( | ||
198 | it returns a "success" message. | ||
![]() |
4.1 | 199 | |
![]() |
5.2 | 200 | eg : |
201 | |||
202 | {{code language="JSON"}} | ||
203 | { | ||
204 | "timestamp": 1620229625932, | ||
205 | "status": "200", | ||
206 | "data": "the selected files has been synchronized to HEAD successfully !" | ||
207 | } | ||
208 | {{/code}} | ||
209 | ))) | ||
210 | |||
![]() |
5.1 | 211 | = Errors = |
212 | |||
213 | below, you can find an example of technical and functional errors : | ||
214 | |||
215 | {{code language="JSON"}} | ||
216 | { | ||
217 | "timestamp": 1620221672951, | ||
218 | "status": "500", | ||
219 | "error": "JSON file is not valid", | ||
220 | "thechnicalError": "JSONObject[\"fileName\"] not found." | ||
221 | } | ||
222 | {{/code}} | ||
223 | |||
224 | the functional error is shown with the JSON key "error", while technical error is stored in the "thechnicalError" key. | ||
225 | |||
226 | |||
![]() |
3.1 | 227 | == == |