Coder Social home page Coder Social logo

Custom Value API.py about wekan HOT 3 CLOSED

xator91 avatar xator91 commented on September 26, 2024
Custom Value API.py

from wekan.

Comments (3)

xet7 avatar xet7 commented on September 26, 2024

@xator91

Like something here?

https://wekan.github.io/api/v7.30/#wekan-rest-api-customfields

from wekan.

xator91 avatar xator91 commented on September 26, 2024

@xator91

Like something here?

https://wekan.github.io/api/v7.30/#wekan-rest-api-customfields

Stil missing a way to assign a custom field to a card. I can update and edit its value, but not assign

from wekan.

xator91 avatar xator91 commented on September 26, 2024

`
if sys.argv[1] == 'addcardmultiplelabel':
# ------- ADD CARD START -----------
authorid = sys.argv[2]
boardid = sys.argv[3]
swimlaneid = sys.argv[4]
listid = sys.argv[5]
cardtitle = sys.argv[6]
carddescription = sys.argv[7]
cardtolist = wekanurl + apiboards + boardid + s + l + s + listid + s + cs
# Add card
headers = {'Accept': 'application/json', 'Authorization': 'Bearer {}'.format(apikey)}
post_data = {'authorId': '{}'.format(authorid), 'title': '{}'.format(cardtitle), 'description': '{}'.format(carddescription), 'swimlaneId': '{}'.format(swimlaneid)}
body = requests.post(cardtolist, data=post_data, headers=headers)
response_json = body.json()
cardid = response_json.get('_id')
print("Card added with ID:", cardid)
# ------- ADD CARD END -----------

    # ------- ADD LABEL START -----------
    label_ids = sys.argv[8:12]
    for label_id in label_ids:
        if label_id:
            print("Processing Label ID:", label_id)
            addlabel_command = "python3 api.py addlabel {} {} {} {}".format(BOARDID, LISTID, cardid, label_id)
            subprocess.run(addlabel_command, shell=True)
            print("Label added to card:", label_id)
    # ------- ADD LABEL END -----------
    custom_fields = sys.argv[12:]
    for custom_field in custom_fields:
        if custom_field and ':' in custom_field:
            customfieldid, customfieldvalue = custom_field.split(':', 1)
            edfield = wekanurl + apiboards + BOARDID + s + l + s + LISTID + s + cs + s + cardid + s + 'customFields' + s + customfieldid
            print("Processing CustomField ID:", customfieldid)
            print("Processing CustomField Value:", customfieldvalue)
            editcustomfield_command = "python3 api.py editcustomfield {} {} {} {}".format(boardid, listid, cardid, customfieldid)
            subprocess.run(editcustomfield_command, shell=True)
            # Creare il payload per la richiesta PUT con il solo valore del campo personalizzato
            put_data = {'_id': '{}'.format(customfieldid), 'value': '{}'.format(customfieldvalue)}
            print("PUT Request JSON Data:", put_data)
            body = requests.put(edfield, json=put_data, headers=headers)
            print("PUT Request Status Code:", body.status_code)
            print("PUT Request Response:", body.text)
            print(f"Custom field {customfieldid} updated on card with value:", customfieldvalue)

`

Processing CustomField ID: Zef6syZ6EHaHaNSqY
Processing CustomField Value: 22
PUT Request JSON Data: {'_id': 'Zef6syZ6EHaHaNSqY', 'value': '22'}
PUT Request Status Code: 405
PUT Request Response:
Custom field Zef6syZ6EHaHaNSqY updated on card with value: 22

but if is not assigned, doesnt appear on card.

from wekan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.