Skip to content

Commit 4e24755

Browse files
authored
Update api.py
Added getcard and cardsbyswimlane
1 parent 7dd9bcc commit 4e24755

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

api.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
python3 api.py addcustomfieldtoboard AUTHORID BOARDID NAME TYPE SETTINGS SHOWONCARD AUTOMATICALLYONCARD SHOWLABELONMINICARD SHOWSUMATTOPOFLIST # Add Custom Field to Board
4040
python3 api.py editcustomfield BOARDID LISTID CARDID CUSTOMFIELDID NEWCUSTOMFIELDVALUE
4141
python3 api.py listattachments BOARDID # List attachments
42+
python3 api.py cardsbyswimlane BOARDID LISTID
43+
python3 api.py getcard BOARDID LISTID CARDID
4244
4345
Admin API:
4446
python3 api.py users # All users
@@ -251,6 +253,31 @@
251253
print("=== CREATE NEW USER ===\n")
252254
print(body.text)
253255
# ------- CREATE NEW USER END -----------
256+
257+
if sys.argv[1] == 'getcard':
258+
259+
# ------- LIST OF CARD START -----------
260+
boardid = sys.argv[2]
261+
listid = sys.argv[3]
262+
cardid = sys.argv[4]
263+
listone = wekanurl + apiboards + boardid + s + l + s + listid + s + cs + s + cardid
264+
headers = {'Accept': 'application/json', 'Authorization': 'Bearer {}'.format(apikey)}
265+
print("=== INFO OF ONE LIST ===\n")
266+
print("URL:", listone) # Stampa l'URL per debug
267+
try:
268+
response = requests.get(listone, headers=headers)
269+
print("=== RESPONSE ===\n")
270+
print("Status Code:", response.status_code) # Stampa il codice di stato per debug
271+
272+
if response.status_code == 200:
273+
data2 = response.text.replace('}', "}\n")
274+
print(data2)
275+
else:
276+
print(f"Error: {response.status_code}")
277+
print(f"Response: {response.text}")
278+
except Exception as e:
279+
print(f"Error in the GET request: {e}")
280+
# ------- LISTS OF CARD END -----------
254281

255282
if arguments == 3:
256283

@@ -293,6 +320,23 @@
293320
print(data2)
294321
# ------- INFO OF CUSTOM FIELD END -----------
295322

323+
if sys.argv[1] == 'cardsbyswimlane':
324+
# ------- RETRIEVE CARDS BY SWIMLANE ID START -----------
325+
boardid = sys.argv[2]
326+
swimlaneid = sys.argv[3]
327+
cardsbyswimlane = wekanurl + apiboards + boardid + s + sws + s + swimlaneid + s + cs
328+
headers = {'Accept': 'application/json', 'Authorization': 'Bearer {}'.format(apikey)}
329+
print("=== CARDS BY SWIMLANE ID ===\n")
330+
print("URL:", cardsbyswimlane) # Debug
331+
try:
332+
body = requests.get(cardsbyswimlane, headers=headers)
333+
print("Status Code:", body.status_code) # Debug
334+
data = body.text.replace('}', "}\n")
335+
print("Data:", data)
336+
except Exception as e:
337+
print("Error GET:", e)
338+
# ------- RETRIEVE CARDS BY SWIMLANE ID END -----------
339+
296340
if arguments == 2:
297341

298342
# ------- BOARDS LIST START -----------

0 commit comments

Comments
 (0)