PMR2 / pmr2.json

PMR2 JSON core and api
0 stars 0 forks source link

Expiring (or deleting) workspaces #2

Closed dbrnz closed 8 years ago

dbrnz commented 8 years ago

Within a web-browser, the "Advanced" option (available under the right hand pulldown of a workspace's view: /content_status_history) allows for an expiration date to be assigned to a workspace. Setting an expiry date in the past effectively deletes the workspace as it no longer appears in "My Workspaces".

Can this be done with the PMR web service? Documentation at http://aucklandphysiomerepository.readthedocs.io/en/latest/webservice.html suggests to first obtain a template and then use this information to construct a form to submit. However attempts to get a template result in a 403 response:

GET /workspace/334/content_status_history HTTP/1.1
Accept: application/vnd.physiome.pmr2.json.1
Accept-Encoding: identity
Authorization: OAuth oauth_consumer_key="9uuENvnELA1cdoy7WhFg4Gsq",oauth_nonce="14665109751391618115",oauth_signature="q%2Fvuzf9H78WWiCDHxQiC9xMVmfc%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1466510975",oauth_token="ExW1gGESfhX0P167DbQC0h_r",oauth_version="1.0"
Connection: Keep-Alive
Accept-Language: en-NZ,*
User-Agent: Mozilla/5.0
Host: models.physiomeproject.org

HTTP/1.1 403 Forbidden
Date: Tue, 21 Jun 2016 12:09:36 GMT
Server: Zope/(2.13.23, python 2.7.3, linux2) ZServer/1.1
Content-Length: 8809
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Content-Type: text/html;charset=utf-8
X-Ua-Compatible: IE=edge,chrome=1
Content-Language: en-nz
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

          .
          .
          .

<h1 class="documentFirstHeading">
  We...re sorry, but there seems to be an error...
</h1>
<div id="content-core">
  <p>
    The error has been logged as entry number
    <code>1466510976.670.319318636512</code>.
  </p>
  <p>
    If you need to report this to the
    <span> <a href="https://models.physiomeproject.org/contact-info">Site Administration</a></span>,
    please include this entry number in your message.
  </p>
</div>

What is the recommended way to remove unwanted workspaces?

metatoaster commented 8 years ago

This is due to invalid permission as the client at hand does not have permission at all as stated in by the 403 error code in the HTTP header (as I believe you were using the OAuth method). Also this operation is also not enabled due to it not being supported in the production instance, and that default content forms (basically anything not directly linked/exported by the webservice) is considered not supported by this package. Unfortunately this is not a feature that will be provided by this package at all.