Hi Jason,
As I said, terms are managed via their parent records’ endpoints. So, for
example:
POST /subjects
{
"source": "local",
"terms":
[
{
"term": "Sausages",
"term_type": "cultural_context",
"vocabulary": "/vocabularies/1"
}
],
"vocabulary": "/vocabularies/1”
}
Will return something like:
{
"status": "Created",
"id": 4,
"lock_version": 0,
"stale": true,
"uri": "/subjects/4",
"warnings": []
}
And then, you can do:
/terms q=Saus
{
"first_page": 1,
"last_page": 1,
"this_page": 1,
"results":
[
{
"lock_version": 0,
"term": "Sausages",
"created_by": "admin",
"last_modified_by": "admin",
"create_time": "2017-02-09T23:16:24Z",
"system_mtime": "2017-02-09T23:16:24Z",
"user_mtime": "2017-02-09T23:16:24Z",
"term_type": "cultural_context",
"jsonmodel_type": "term",
"uri": "/terms/5",
"vocabulary": "/vocabularies/1"
}
]
}
And, yes, the id in the uri is the db id, so:
mysql> select id, vocab_id, term, term_type_id from term where id=5;
+----+----------+----------+--------------+
| id | vocab_id | term | term_type_id |
+----+----------+----------+--------------+
| 5 | 1 | Sausages | 1267 |
+----+----------+----------+--------------+
1 row in set (0.00 sec)
I you wanted to do bulk updates to terms you could do it via the db, or write
an endpoint to do it.
Hope that helps.
Cheers,
James
> On Feb 10, 2017, at 10:05 AM, Jason Loeffler <[email protected]> wrote:
>
> Thanks, James. Looking at the docs again, I now see my misunderstanding.
>
> term.*.uri is indeed misleading. Could be a mnemonic for the term database
> identifier (term.id <http://term.id/>) or otherwise a development artifact.
>
> So I take it 1) terms can't be updated by conventional means (i.e. the API)
> and 2) my primary alternative is to issue database queries in order to
> perform bulk updates to a set of terms?
>
> JL
>
>
> On Thu, Feb 9, 2017 at 5:40 PM, James Bullen <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi Jason,
>
> There is a GET /terms endpoint. It does a search and takes a q=.
>
> There is no GET /terms/:id - I guess this is the one that’s giving you a Not
> Found.
>
> And there is no POST /terms.
>
> Here’s the controller:
> https://github.com/archivesspace/archivesspace/blob/master/backend/app/controllers/term.rb
>
> <https://github.com/archivesspace/archivesspace/blob/master/backend/app/controllers/term.rb>
>
> Terms aren’t really first order objects (they get managed via their parent
> object), so I’m not sure why they have a uri. For example:
>
>
> /terms q=Audio
> {
> "first_page": 1,
> "last_page": 1,
> "this_page": 1,
> "results":
> [
> {
> "lock_version": 0,
> "term": "Audio",
> "created_by": "admin",
> "last_modified_by": "admin",
> "create_time": "2017-02-07T05:34:29Z",
> "system_mtime": "2017-02-07T05:34:29Z",
> "user_mtime": "2017-02-07T05:34:29Z",
> "term_type": "genre_form",
> "jsonmodel_type": "term",
> "uri": "/terms/3",
> "vocabulary": "/vocabularies/1"
> }
> ]
> }
>
> You see it has a uri (/terms/3), but that is a bit of a lie because there is
> no corresponding endpoint. There could well be a good reason for this, but
> I’m not aware of it.
>
>
> Cheers,
> James
>
>
>> On Feb 10, 2017, at 6:40 AM, Jason Loeffler <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Can anyone confirm whether the GET method for terms works? I'm getting 'Not
>> Found'. Also, is there an undocumented POST method for terms?
>>
>> Thanks.
>>
>> Jason Loeffler
>> Technology Consultant | The American Academy in Rome
>> Minor Science | Application Development & Metadata Strategy
>> Brooklyn, New York
>> [email protected] <mailto:[email protected]>
>> (347) 405-0826 <tel:(347)%20405-0826>
>> minorscience (Skype)
>>
>>
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> [email protected]
>> <mailto:[email protected]>
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>> <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>>
>>
>> !DSPAM:589cc60444364107784971!
>
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> [email protected]
> <mailto:[email protected]>
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
> <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>
>
> !DSPAM:589cf5e8158171473716713!
> _______________________________________________
> Archivesspace_Users_Group mailing list
> [email protected]
> <mailto:[email protected]>
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
> <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>
>
> !DSPAM:589cf5e8158171473716713!
_______________________________________________
Archivesspace_Users_Group mailing list
[email protected]
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group