[rt-users] REST API for Assets

Stephen Switzer steve at sbsroc.com
Wed Dec 7 00:34:57 EST 2016


Hello!
    I also need a REST api for assets, so I decided to take a stab at 
writing one myself. The files are here:
https://github.com/sbsroc/rt/tree/master/share/html/REST/1.0/Forms/asset

    This is my first contribution to RT. To install and test, place the 
files default and links into a new directory: 
/opt/rt4/share/html/REST/1.0/Forms/asset/

Then run:
rm -Rf /opt/rt4/var/mason_data/obj/*; service apache2 reload

I have working asset "show", "new" and updates. It used the same format 
as tickets:

$ curl 
'http://localhost/REST/1.0/asset/1/show?user=xxxxxxx&pass=xxxxxxx'
RT/4.4.1 200 Ok

id: asset/1
Name: testing
Description: The test description is here
Catalog: 1
Status: allocated
Created: 2016-12-06 02:25:17
LastUpdated: 2016-12-07 04:05:57
Owner: myuser

HeldBy: user1 at example.com, user3 at example.com,
         user2 at example.com

Contacts: user1 at example.com, user2 at example.com
CF.{NCentralAssetID}: 34512

Custom fields are working, links work (show only) and updates work 
(mostly). I'm currently having trouble with the Contacts and HeldBy 
fields not removing entries for users that are no longer on the list 
when posted. I get an error from RT::Record::Role::Roles, when it's 
clearly listed when I query. Even more odd, the first time I try to 
remove a member, it acts without error. It's only on the second attempt 
that it shows an error. This suggested that maybe it's removing 
*something*, but not all. Appears to be a bug in other PMs.

If this helps someone as-is, then great! If others can contribute, I 
welcome it.
Anyone know if our pull request should go against master when we're 
done?

Anyone willing to trust the code? LOL

Steve


On 2016-12-04 5:38 pm, Bart Bunting wrote:
> Josh,
> 
> I may be able to get our company to contribute something, although I'm
> afraid it wouldn't be too much.
> 
> We are tossing up between updating owr own existing solution or using
> RT to manage assets.
> 
> Given the lack of an API it makes RT integration with our customer  
> portal
> problematic.  This is likely to push us away from RT and to just write
> our own specific implementation.
> 
> If there is a commitment from Bestpractical to get the API implemented
> and funds were the only issue we would consider how we could help.
> 
> 
> Kind regards
> 
> Bart
> 
> Josh Tackitt <tackittj at reed.edu> writes:
> 
>> Hi Bart,
>> 
>> Unfortunately there is no REST API for Assets.  I've heard rumors that
>> maybe they're working on it but pretty sure I've not seen anything 
>> official.
>> 
>> Is anyone out there interested in combining funds to pay for the
>> development of this much needed feature?  I'm sure we could convince
>> BestPractical to roll it into 'core' so that everyone would benefit.
>> 
>> Best,
>> Josh
>> 
>> On Wed, Nov 23, 2016 at 3:26 PM, Bart Bunting 
>> <bart.bunting at ursys.com.au>
>> wrote:
>> 
>>> Hi,
>>> 
>>> Is there a REST API for assets in RT?
>>> 
>>> I can't find any documentation for it.
>>> 
>>> Can anyone shed any light on if it exists or is in the works?
>>> 
>>> 
>>> Kind regards
>>> Bart
>>> --
>>> 
>>> Bart Bunting - URSYS
>>> PH: 02 87452811
>>> Mbl: 0409560005
>>> ---------
>>> RT 4.4 and RTIR training sessions, and a new workshop day!
>>> https://bestpractical.com/training
>>> * Los Angeles - January 9-11 2017
>>> 
>> 
>> 
>> 
>> --
>> Reed College
>> Computer Hardware Services
>> ETC 114
>> 503-788-6661
> Bart



More information about the rt-users mailing list