Content
API: Create workpackage with a customfield
Added by Robert Alers about 6 years ago
Use case:
Writing a simple VBA application for importing excel files into openproject.
What works:
A post to /work_packages with basis auth and the following JSON body:
{ "subject": "the subject", "description": { "raw": "the description" }, "startDate": "2018-09-29" }
This works perfectly, although when I try to push a custom field, like so:
{ "subject": "the subject", "description": { "raw": "the description" }, "customField8": "CustomField TEST", "startDate": "2018-09-29" }
The custom field stays 'null'. Data type for this specific field is as follows:
"customField8": {
"type": "String",
"name": "Source",
"required": false,
"hasDefault": false,
"writable": true,
"visibility": "default"
},
What am i missing?
Thanks in advance!
Replies (11)
Hi Robert,
i've done something very similar (get, create and edit workpackages with any kind of attributes), I would like to share with you.
Whats missing is some refacotring and claning up some hardcoded stuff, that was meant for testing. So, please give me a weekend or something.
But anyway, what response do you get?
Btw.: I would highly recommend this JsonParser, if you are familiar with dictionaries and collections in Excel: https://github.com/VBA-tools/VBA-JSON
Best Regards
Bernd
Hi Bernd,
Thank you for the reply!
I get the standard response: 201 - Created with a list of all fields, note that the customField8 stays NULL.
Thanks for the tip! I already used the JsonParser module in my current project. Are you writing an excel addon by any chance? This would be awesome for people migrating to the OpenProject platform.
Love to hear if you can resolve this issue!
Regards,
Robert
Hi Robert,
creating a addon out of my *.xlsm would make sense. Let me think about... But you will get the Excel-Tool anyway.
Hm, do you use the response from form validation for creating your body?
Best regards
Bernd
Hi Bernd,
I did use the form as base..
Did you made any progress? something you think I can try? I am at my wits end here :-)
Regards,
Robert
Hi Robert,
it's still not finished, but i've uploaded my Excel-file to github: https://github.com/opf/OpenProjectExcel
Hopefully it works for you.
Please let me know, if you're not able to figure out, how it works.
I will make a Addin out of this, but not now.
Best regards
Bernd
Hi Bernd,
Very well done! My deepest thanks for all the work you put in!
I hope I have time this week to play with this, and squash some bugs (It gives me a lot of errors, but this tends to be the case with VBA :-) )
Will get back to you, and maybe I have I fixed the customfield problem by then.
Thanks again,
Robert
Hi Robert,
thanks for your response!
I have no problem with any kind of customfield. So it should work for you, after figuring out, whats the issue regarding VBA.
Can you please give me report of the bugs you get, including Operating System, Excel Version ect.? I shouldn't be a problem to make the Excel stable in any situation. Theres nothing special inside. I just have to know the situation.
Best Regards
Bernd
Hi @Bernd and @Robert,
I just created a public project for you guys here:
https://community.openproject.com/projects/excel-sync/work_packages
This might help you to track your activities.
Best
Niels
Thanks, Niels! We'll surely make use of this.
@Robert: I recently added the implemented librarys in github: Visual Basic For Applications, Microsoft Excel 16.0 Object Library, Microsoft Forms 2.0 Object Library, Microsoft Scripting Runtime, Microsoft WinHTTP Services, version 5.1. Maybe you're missing some of theese. If so, please let me know. I don't need all of them at all.
Thanks Bernd and Niels!
I checked al the references you listed, same story. (Even the version numbers check out)
I used the public project for listing the first bugs I got, and will try debug them myself. Although my VBA skills are a hell of a lot less then yours i'm afraid ;-)
@Robert Did some debugging. Please check the actual version on github and our project.
@Niels I can not assign Robert. Additionaly the status test or something would be helpful.
Best Regards
Bernd