Top Menu

Jump to content
  • OpenProject
    • View all projects
Home
    • Work packages
    • News
    • Getting started
    • Introduction video
    • Welcome to OpenProject

      Get an overview

      Get a quick overview of project management and team collaboration with OpenProject.

    • Help and support
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional support

    • Additional resources
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Create a new account
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
  • Roadmap
  • Work packages
  • You are here:Forums
You are here:
  • Forums
  • Development

Content

GravatarAPI: Create workpackage with a customfield

Added by Robert Alers 4 months 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)

Gravatar RE: API: Create workpackage with a customfield - Added by Bernd Petraus 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Robert Alers 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Bernd Petraus 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Robert Alers 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Bernd Petraus 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Robert Alers 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Bernd Petraus 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Niels Lindenthal 4 months ago

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

Gravatar RE: API: Create workpackage with a customfield - Added by Bernd Petraus 4 months ago

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.

Gravatar RE: API: Create workpackage with a customfield - Added by Robert Alers 4 months ago

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 ;-)

Gravatar RE: API: Create workpackage with a customfield - Added by Bernd Petraus 4 months ago

@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

  • (1 - 11/11)
Loading...