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