HTTP Verb: POST

Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity

Object: User Role

Location: available

Formats: XML, JSON

Invite a user to a portfolio.

Params

To invite a user, a data body must be provided. Data can be provided in three formats: XML, JSON and query string. To specify data type of XML or JSON add the Content-type: application/(json|xml) header to request headers. If you want to provide query string simply skip the Content-type header.

All params should be sent in the invitation namespace, e.g.:

XML

<invitation>
  <identifiers type="array">
    <identifier>member_1@domain.com</identifier>
    <identifier>member_2@domain.com</identifier>
  </identifiers>
  <role>100</role>
</invitation>

JSON

{"invitation":{"identifiers":["member_1@domain.com","member_2@domain.com"],"role":100}}

Query string

invitation[role]=100&invitation[identifiers][]=member_1@domain.com&...

Examples

For example purposes we use a JSON body

{"invitation":{"identifiers":["member_1@domain.com", "member_2@domain.com"],"role":100}}

Request XML, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"invitation":{"identifiers":["new_member@domain.com"],"role":100}}' https://_portfolio_subdomain.api.assembla.com/v1/invitations.xml

Response:

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:08:42 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://_portfolio_subdomain.breakout.tld:3000/v1/invitations
...

<?xml version="1.0" encoding="UTF-8"?>
<user-roles type="array">
  <user-role>
    <id type="integer">328</id>
    <user-id>cqKiiGWBKr4Oo-5bfBjDYC</user-id>
    <space-id>cJiq3KDNyr4PMj5bfBjDYC</space-id>
    <role>member</role>
    <status type="integer">1</status>
    <invited-time type="datetime">2013-05-27T00:30:49-05:00</invited-time>
    <agreed-time nil="true"></agreed-time>
    <title nil="true"></title>
    <invited-by-id>dd_iFeDNur4PMj5bfBjDYC</invited-by-id>
  </user-role>
  ...
</user-roles>

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"invitation":{"identifiers":["new_member@domain.com"],"role":100}}' https://_portfolio_subdomain.api.assembla.com/v1/invitations.json

Response:

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:12:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://_portfolio_subdomain.breakout.tld:3000/v1/invitations
...

[
  {
    "id": 326,
    "user_id": "cqKiiGWBKr4Oo-5bfBjDYC",
    "space_id": "cJiq3KDNyr4PMj5bfBjDYC",
    "role": "member",
    "status": 1,
    "invited_time": "2013-05-27T00:18:35-05:00",
    "agreed_time": null,
    "title": null,
    "invited_by_id": "dd_iFeDNur4PMj5bfBjDYC"
  },
  ...
]

JSON is formatted here for readability, in a real response JSON body is inline with no indentation.

Description for each field: User role object fields reference