MXS-1220: Fix resource self links
The top level resource self links pointed to the collection instead of the resource itself. The individual resoures now also have a links field that contains the self link to the resource. This should make navigation of the API easier as all objects have valid links in them.
This commit is contained in:
@ -131,3 +131,17 @@ json_t* mxs_json_pointer(json_t* json, const char* json_ptr)
|
||||
{
|
||||
return mxs_json_pointer_internal(json, json_ptr);
|
||||
}
|
||||
|
||||
json_t* mxs_json_self_link(const char* host, const char* path, const char* id)
|
||||
{
|
||||
json_t* links = json_object();
|
||||
|
||||
string self = host;
|
||||
self += "/";
|
||||
self += path;
|
||||
self += "/";
|
||||
self += id;
|
||||
json_object_set_new(links, CN_SELF, json_string(self.c_str()));
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user