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