Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time


Exploring basic rules

Let's try exploring the claimRights endpoint:

.. literalinclude:: tutorial/asset-listing.http
   :language: javascript

Just invoking it reveals empty set.

Now let's attempt creating some claimRights:

.. literalinclude:: tutorial/asset-post-attempt.http
   :language: javascript

Error states that the only accepted Content-Type is application/json.

Let's satisfy the Content-type requirement:

.. literalinclude:: tutorial/asset-post-attempt-json.http
   :language: javascript

Error states that no data has been found in JSON body.

.. index:: claimRight

Creating asset

Let's create claim right with the minimal (only required) data set:

.. literalinclude:: tutorial/asset-post-2pc.http
   :language: javascript

.. literalinclude:: tutorial/asset-patch-2pc.http
   :language: javascript

Success! Now we can see that new object was created. Response code is 201 and Location response header reports the location of the created object. The body of response reveals the information about the created claim right: its internal id (that matches the Location segment), its official assetID and dateModified datestamp stating the moment in time when it was last modified. Pay attention to the assetType. Note that the object is created with pending status.

Let's access the URL of the created object (the Location header of the response):

.. literalinclude:: tutorial/blank-asset-view.http
   :language: javascript

We can see the same response we got after creating asset.

Let's see what listing of claim rights reveals us:

.. literalinclude:: tutorial/initial-asset-listing.http
   :language: javascript

We do see the internal id of the claim right and its dateModified datestamp.

The previous claim right contained only required fields. Let's try creating another one with more data (status created):

.. literalinclude:: tutorial/create-second-asset.http
   :language: javascript

And again we have 201 Created response code, Location header and body with extra id, assetID, and dateModified properties.

Let's check what asset registry contains:

.. literalinclude:: tutorial/listing-with-some-assets.http
   :language: javascript

And indeed we have 2 objects now.

Modifying Claim Right

Let's update claim right description:

.. literalinclude:: tutorial/patch-asset.http
   :language: javascript

We see the added properies have merged with existing data. Additionally, the dateModified property was updated to reflect the last modification datestamp.

Checking the listing again reflects the new modification date:

.. literalinclude:: tutorial/asset-listing-after-patch.http
   :language: javascript

Deleting Claim Right

Let's delete it:

.. literalinclude:: tutorial/delete-asset.http
   :language: javascript

Integration with lots

Assume we attached assets to lot:

.. literalinclude:: tutorial/attached-to-lot-asset-view-second.http
   :language: javascript

Let`s change lot status to recomposed.

When bot finds such a lot, it turns status of the assets being attached to that lot to pending.

.. literalinclude:: tutorial/deattached-from-lot-asset-view.http
   :language: javascript

.. literalinclude:: tutorial/attached-to-lot-asset-view.http
   :language: javascript

.. literalinclude:: tutorial/detached-from-lot-asset-view.http
   :language: javascript

.. literalinclude:: tutorial/complete-asset-view.http
      :language: javascript