I'm submitting a
Current Behaviour:
hydrus will support treating collections as a resource once PR HTTP-APIs/hydrus#488 gets merged.
This will bring in some changes to the endpoints at which hydrus is serving data.
Those changes need to be added to agent appropriately.
Expected Behaviour:
Brief description of major changes to the endpoints:
(Note: For below discussion, CommandCollection is a collection class, Command would be non-collection class / parsed class. The meaning of non-collection class would be any class which will not act as a 'collection' of items.)
- GET on
/collection/
Example endpoint: /CommandCollection/
This fetches the data from the 'CommandCollection' table.
Example response:
Will return a list of collections.
{
"@context": "/serverapi/contexts/CommandCollection.jsonld",
"@id": "/serverapi/CommandCollection/",
"@type": "CommandCollection",
"hydra:totalItems": 3,
"hydra:view": {
"@id": "/serverapi/CommandCollection?page=1",
"@type": "hydra:PartialCollectionView",
"hydra:first": "/serverapi/CommandCollection?page=1",
"hydra:last": "/serverapi/CommandCollection?page=1"
},
"members": [
{
"@id": "/serverapi/CommandCollection/7d2cc88f-388a-43f1-80fc-0c2184de4784",
"@type": "CommandCollection"
},
{
"@id": "/serverapi/CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412",
"@type": "CommandCollection"
},
{
"@id": "/serverapi/CommandCollection/c2e10f88-d205-41e7-aa61-338afd64f657",
"@type": "CommandCollection"
}
]
}
- PUT on
/collection/
Example endpoint: /CommandCollection/
The request body should have the list of ids of class instances which would be grouped into a collection.
For eg,
{
"@type": "CommandCollection",
"members": ["aaaaa",
"bbbbb",
"ccccc"]
}
In the above example, 'aaaaaa', 'bbbbb' and 'ccccc' are the ids(primary key) of the instances in Command table.
This adds data in the 'CommandCollection' table.
Example response:
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@type": "Status",
"description": "Object with ID 50ed3b68-9437-4c68-93d4-b67013b9d412 successfully added",
"statusCode": 201,
"title": "Object successfully added."
}
NOTE: The id returned is actually the value of the collection_id column in the table, not the primary key id.
3) GET on /collection/id
Example endpoint: /CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412
Note: The id is corresponding to the collection_id column in the CommandCollection table, not the primary key id.
Example response:
Will return all the members belonging to the collection with given collection_id.
{
"@context": "/serverapi/contexts/CommandCollection.jsonld",
"@id": "/serverapi/CommandCollectionCollection/50ed3b68-9437-4c68-93d4-b67013b9d412",
"@type": "CommandCollection",
"members": [
{
"@id": "/serverapi/Command/aaaaaa",
"@type": "Command"
},
{
"@id": "/serverapi/Command/bbbbbb",
"@type": "Command"
},
{
"@id": "/serverapi/Command/cccccc",
"@type": "Command"
}
]
}
- POST on
/collection/id
Example endpoint: /CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412
The request body should have the list of members to be updated for the given collection.
For eg,
{
"@type": "CommandCollection",
"members": ["ddd",
"eee",
"fff"]
}
Note: The id is corresponding to the collection_id column in the CommandCollection table, not the primary key id.
Example response:
Will update all the members belonging to the collection with given collection_id with the members given in the request body.
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@type": "Status",
"description": "Object with ID 50ed3b68-9437-4c68-93d4-b67013b9d412 successfully updated",
"statusCode": 200,
"title": "Object updated"
}
- DELETE on
/collection/id
Example endpoint: /CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412
Note: The id is corresponding to the collection_id column in the CommandCollection table, not the primary key id.
Example response:
Will delete that collection from the table.
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@type": "Status",
"description": "Object with ID 50ed3b68-9437-4c68-93d4-b67013b9d412 successfully deleted",
"statusCode": 200,
"title": "Object successfully deleted."
}
- GET, PUT, POST and DELETE on any
/non-collection-class
Example endpoint: /Command/ or /Area
NOTE: All of these will have the same behaviour as what would have happened before on /CommandCollection/ endpoint
I'm submitting a
Current Behaviour:
hydruswill support treating collections as a resource once PR HTTP-APIs/hydrus#488 gets merged.This will bring in some changes to the endpoints at which
hydrusis serving data.Those changes need to be added to
agentappropriately.Expected Behaviour:
Brief description of major changes to the endpoints:
(Note: For below discussion,
CommandCollectionis a collection class,Commandwould be non-collection class / parsed class. The meaning of non-collection class would be any class which will not act as a 'collection' of items.)/collection/Example endpoint:
/CommandCollection/This fetches the data from the 'CommandCollection' table.
Example response:
Will return a list of collections.
{ "@context": "/serverapi/contexts/CommandCollection.jsonld", "@id": "/serverapi/CommandCollection/", "@type": "CommandCollection", "hydra:totalItems": 3, "hydra:view": { "@id": "/serverapi/CommandCollection?page=1", "@type": "hydra:PartialCollectionView", "hydra:first": "/serverapi/CommandCollection?page=1", "hydra:last": "/serverapi/CommandCollection?page=1" }, "members": [ { "@id": "/serverapi/CommandCollection/7d2cc88f-388a-43f1-80fc-0c2184de4784", "@type": "CommandCollection" }, { "@id": "/serverapi/CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412", "@type": "CommandCollection" }, { "@id": "/serverapi/CommandCollection/c2e10f88-d205-41e7-aa61-338afd64f657", "@type": "CommandCollection" } ] }/collection/Example endpoint:
/CommandCollection/The request body should have the list of ids of class instances which would be grouped into a collection.
For eg,
{ "@type": "CommandCollection", "members": ["aaaaa", "bbbbb", "ccccc"] }In the above example, 'aaaaaa', 'bbbbb' and 'ccccc' are the
ids(primary key) of the instances inCommandtable.This adds data in the 'CommandCollection' table.
Example response:
{ "@context": "http://www.w3.org/ns/hydra/context.jsonld", "@type": "Status", "description": "Object with ID 50ed3b68-9437-4c68-93d4-b67013b9d412 successfully added", "statusCode": 201, "title": "Object successfully added." }NOTE: The
idreturned is actually the value of thecollection_idcolumn in the table, not the primary keyid.3) GET on
/collection/idExample endpoint:
/CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412Note: The
idis corresponding to thecollection_idcolumn in theCommandCollectiontable, not the primary keyid.Example response:
Will return all the members belonging to the collection with given
collection_id.{ "@context": "/serverapi/contexts/CommandCollection.jsonld", "@id": "/serverapi/CommandCollectionCollection/50ed3b68-9437-4c68-93d4-b67013b9d412", "@type": "CommandCollection", "members": [ { "@id": "/serverapi/Command/aaaaaa", "@type": "Command" }, { "@id": "/serverapi/Command/bbbbbb", "@type": "Command" }, { "@id": "/serverapi/Command/cccccc", "@type": "Command" } ] }/collection/idExample endpoint:
/CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412The request body should have the list of members to be updated for the given collection.
For eg,
{ "@type": "CommandCollection", "members": ["ddd", "eee", "fff"] }Note: The
idis corresponding to thecollection_idcolumn in theCommandCollectiontable, not the primary keyid.Example response:
Will update all the members belonging to the collection with given
collection_idwith the members given in the request body.{ "@context": "http://www.w3.org/ns/hydra/context.jsonld", "@type": "Status", "description": "Object with ID 50ed3b68-9437-4c68-93d4-b67013b9d412 successfully updated", "statusCode": 200, "title": "Object updated" }/collection/idExample endpoint:
/CommandCollection/50ed3b68-9437-4c68-93d4-b67013b9d412Note: The
idis corresponding to thecollection_idcolumn in theCommandCollectiontable, not the primary keyid.Example response:
Will delete that collection from the table.
{ "@context": "http://www.w3.org/ns/hydra/context.jsonld", "@type": "Status", "description": "Object with ID 50ed3b68-9437-4c68-93d4-b67013b9d412 successfully deleted", "statusCode": 200, "title": "Object successfully deleted." }/non-collection-classExample endpoint:
/Command/or/AreaNOTE: All of these will have the same behaviour as what would have happened before on
/CommandCollection/endpoint