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