Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Development
  1. OpenProject
  2. Forums
  3. Development
  4. API: Unable to create membership

API: Unable to create membership

Added by Xavi M. about 5 years ago

Dear,

I have projects and users but I can't create a membership between a project and a user by using API request.

Here is an attemptĀ 

curl -s -H "Content-Type: application/json" \
 --data-urlencode 'filters=[{"project":{"operator":"=","values":["10"]}}]' \
-d '{"_links":{"principal":{"name":"4"},"principal":{"name":"4"},"roles":{"name":"4"}}}'  \
-u apikey:$API_KEY \
-X POST 'http://192.168.1.21:8080/openproject/api/v3/memberships?'  | jq  .

Here is the answer:

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",
  "message": "The request could not be parsed as JSON.",
  "_embedded": {
    "details": {
      "parseError": "expected false () at line 1, column 2"
    }
  }
}

I do not understand the answer as my json is correct (validated by a json validator)

Can you give me a hint to resolve my issue ? (or an example)

I am using OpenProject 10.4.1

Thanks a lot

Kind regards

Xerviami


Loading...