HingX.org API

Revision 2, November 30, 2012

Revision History Date Revision Number Comments August 21, 2012 1 Phase 1 API Specification November 30, 2012 2 Phase 2 API Specification

Contents

Preface ...... 4 Calling Convention ...... 4 Authentication and Authorization ...... 4

User Functions ...... 5 Login (GET, POST) ...... 5 View (GET, POST) ...... 5 Find (GET, POST) ...... 6 Register (POST) ...... 7 Edit (POST) ...... 8 AddToGroup (POST) ...... 9 RemoveFromGroup (POST) ...... 9

Group Functions ...... 10 Create (POST) ...... 10 View (GET, POST) ...... 11 Edit (POST) ...... 12 Find (GET, POST) ...... 13 AssignRoleToMember (POST) ...... 14 RemoveRoleFromMember (POST) ...... 15

Resource Functions ...... 16 Create (POST) ...... 16 Edit (POST) ...... 19 GetDetails (GET, POST) ...... 22 Find (GET, POST) ...... 23 AddToFolder (POST) ...... 26 RemoveFromFolder (POST) ...... 27 ChangeOwner (POST) ...... 27 Delete (POST)...... 28 GetSecurity (GET, POST) ...... 28 SetSecurity (POST) ...... 29 CommunityFeedback (POST) ...... 30 Field Functions ...... 31 GetOntology (GET, POST) ...... 31 GetFieldsExt (GET, POST) ...... 31

Folder Functions ...... 32 List (GET, POST) ...... 32 Create (POST) ...... 33 Delete (DELETE) ...... 34 Download (GET, POST) ...... 34 Move (POST) ...... 37 Copy (POST) ...... 38

Appendix 1 – Supported Country Names ...... 39

Appendix 2 – Supported Time Zones ...... 42

Preface

Calling Convention The API is located at http://hingx.org/Api (or http://hingx.org/API) root. Each functional section (User, Group, Resource, etc.) is represented by another level under the API root (e.g. http://hingx.org/Api/User) and the corresponding function is another level below that (e.g. http://hingx.org/Api/User/Login). The API expects the input to be provided in the format understood by ASP.NET 4.0 MVC 3 framework, which is one of the following:

1. HTTP GET 2. HTTP POST with application/x-www-form-urlencoded encoding 3. HTTP POST with application/json encoding 4. HTTP PUT 5. HTTP DELETE

The output of all API functions always uses application/json encoding. Depending on the specific function, the output is either one standard “result” object, or a collection of standard “result” objects. The standard “result” object is a data wrapper that in addition to the payload also provides the status of the operation.

Standard “result” object Result := { Success: boolean, StatusCode: int, StatusDescription: string, Data: {}, } Field Example Description Success true A Boolean value that indicates success (true) or failure (false) of the operation. Examine the value of the StatusCode field to determine the exact nature of the failure. StatusCode 0 A numeric code indicating the final status of the operation. The set of possible return values varies from function to function. Some error codes are the same across all functions. Value of 0 (zero) is an indication of “success”; non-zero values are an indication of “failure”. StatusDescription OK A textual explanation of the StatusCode. Data The payload. Empty if the corresponding API function was unable to process the request.

Authentication and Authorization Many API functions require a valid HingX.org user account to perform their operations. Other API functions take an optional parameter specifying the user account information, and depending on the provided credentials their output may change. User Functions In this section you will find functions that pertain to user accounts, user profile management and group membership. Also, user authentication function is described in the scope of this section.

Login (GET, POST) Validates the input username/password pair and issues a token that may be used to call APIs where user authentication information is either required or optional.

Request parameters Parameter Data Type Example Description username string “John.Doe” (required) The name of the user to authenticate. password string “Password123!” (required) The password of the user to authenticate.

Response

Result Codes Code Explanation 0 Success 10 Invalid username or password

“Data” object The payload contains a string that can be used as a value for “token” parameters.

Data := string;

View (GET, POST) Retrieves information about the specified user. Requires authentication.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. userId GUID BAB98633-9DFA- The User ID to retrieve information for. If this 4C7A-A7C2- parameter is omitted, the user corresponding to the 1BF53C3427D9 authentication token will be used instead.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 3 Invalid value of user ID parameter

“Data” object Data := UserProfile; UserProfile := { FirstName: string, LastName: string, WebSite: string, TimeZone: string, AboutMe: string, ImWorkingAt: string, MyTitleIs: string, Country: string, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image Expertise: FieldValues, Interests: FieldValues, }; FieldValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }];

Find (GET, POST) Finds one or more users using the specified search criteria. Requires authentication.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. searchString string “John Doe” Found user profiles must conform to this free-text search parameter. expertise int array {1, 23, 45} Found user profiles must be associated with at least one “expertise” field value ID specified. interest int array {2, 34} Found user profiles must be associated with at least one “interest” field value ID specified. If none of the optional parameters is specified, the result will list all active users. Invalid Field ID values are ignored.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token

“Data” object Data := [ UserProfile ]; UserProfile := { FirstName: string, LastName: string, WebSite: string, TimeZone: string, AboutMe: string, ImWorkingAt: string, MyTitleIs: string, Country: string, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image Expertise: FieldValues, Interests: FieldValues, }; FieldValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }];

Register (POST) Creates a new user account in HingX with basic information and places it into the “General Public” user group with Consumer user role privileges. However, if user group information is specified, a new user group is created and the new user account is associated with the newly created user group with User Group Administrator and Consumer user role privileges; in this case, the new user does not become a member of the “General Public” user group.

Request parameters Parameter Data Example Description Type userName string “John.Doe” (required) The new user account name. email string “[email protected]” (required) An e-mail address to associate with the new user account. This address is used to recover a forgotten account password, as well as to receive notifications about various events in HingX Registry. password string “Password123!” (required) The user account password. The minimum password length is 6 characters. firstName string “John” (required) User’s first name. lastName string “Doe” (required) User’s last name. groupName string “John’s Group” A new user group name. groupDescription string “Colleagues of (must be specified in groupName is specified) A John Doe” description for the new group.

Response

Result Codes Code Explanation 0 Success 3 Invalid parameter 4 Unable to create a new user account record

“Data” object The payload contains a GUID for the newly created user.

Data := string;

Edit (POST) Updates the profile of the user identified by the authentication token with the specified information. Provided information effectively overwrites the user profile stored in the database, therefore if it is desirable to perform a partial update on a specific user profile, it may be desirable to work off the existing profile by obtaining it via /User/View API function.

Request parameters Parameter Data Example Description Type token string (required) An authentication token obtained from /User/Login function. firstName string “John” (required) User’s first name. lastName string “Doe” (required) User’s last name. email string “[email protected]” (required) An e-mail address to associate with the user account. This address is used to recover a forgotten account password, as well as to receive notifications about various events in HingX Registry. webSite string “host.com” A web site that provides more information about the user. aboutMe multi-line Additional details about themselves members text want to share with HingX community. country string “United States” The country of residence of the HingX member. See Appendix 1 – Supported Country Names for the list of supported country names. Value not on the list are ignored. timeZone string “(UTC-08:00) A descriptor. See Appendix 2 – Pacific Time (US & Supported Time Zones for the list of supported Canada)” time zone names. Values not on the list are recorded, but will cause date & time display in server local format. imWorkingAt string A name of a company the HingX member is currently working at. myTitleIs string A job title of the HingX member at their current place of employment picture string BASE-64 encoded JPEG image to set as the user profile picture. expertise int array A list of Field Value IDs that describe HingX member expertise. interest int array A list of Field Value IDs that describe member’s interests. emailNotification Boolean Enable/disable e-mail notifications. Has no effect on the password reset requests. If a value for an optional parameter is omitted, the present value in the user profile remains unchanged. Expertise and interest parameters must reference Field Value IDs from one of the following Fields: Tag, Audience, Health Process Domain, EHealth Infostructure, ICT Infrastructure. Value IDs pertaining to other Fields are ignored.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication 3 Invalid parameter 4 Unable to commit changes to the database

“Data” object The payload is empty.

AddToGroup (POST) Adds the specified user to the specified group and assigns the default user more roles to the user in this group, call GroupProfile := { GroupID: int, Name: string, Description: string, WebSite: string, Type: string, Tags: FieldValues, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image }; FieldValues := [{ Value: string, ValueID: int, FieldID: int, FieldName: string, }]; AssignRoleToMember (POST) function. The user identified by the authentication token must have permission to grant or revoke membership in the specified group. If the specified user is already a member of the specified group, nothing happens.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. userID GUID (required) UID of the user to add to the user group. groupID int 1 (required) ID of the group to add the user into.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user identified by the authentication token doesn’t have permission to grant or revoke membership in the specified group 3 Invalid parameter

“Data” object The payload is empty.

RemoveFromGroup (POST) Removes the specified user from the specified user group. The user identified by the authentication token must have permission to grant or revoke membership in the specified group. If the specified user is not a member of the specified group, nothing happens.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. userID GUID (required) UID of the user to remove from the user group. groupID int 1 (required) ID of the group to remove the user from.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user identified by the authentication token doesn’t have permission to grant or revoke membership in the specified group 3 Invalid parameter

“Data” object The payload is empty.

Group Functions In this section you will find functions that pertain to group accounts, group profile management and user roles within groups.

Create (POST) Creates a new user group and populates its profile. The user identified by the authentication token becomes the User Group Administrator of the newly created group automatically.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. groupName string “John’s Group” (required) A name for the new group. Must be unique. aboutUs multi-line (required) A description for the new group. text webSite string “host.com” A link to a web site or page with additional information about the new user group. type string A type of the new user group, which can be one of the following:  Community  Company/Corporation  Consortium  Government Agency  Non-Profit Organization  Program/Initiative  Project Values not on the list above are ignored. fieldValues int array A list of Field Value IDs from Tag Field that pertain to the new user group. picture string BASE-64 encoded JPEG image to use as the profile logo. isActive Boolean True Makes the group active or inactive. If omitted, the new user group is created active by default.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 3 Invalid parameter

“Data” object Data := GroupProfile; GroupProfile := { GroupID: int, Name: string, Description: string, WebSite: string, Type: string, Tags: FieldValues, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image }; FieldValues := [{ Value: string, ValueID: int, FieldID: int, FieldName: string, }]; View (GET, POST) Retrieves group profile information given a group ID. Requires authentication.

Request parameters Parameter Data Type Example Description Token string (required) The authentication token obtained from /User/Login function. groupID int 1 (required) ID of the group to retrieve the profile for.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 3 Invalid value of group ID parameter

“Data” object Data := GroupProfile; GroupProfile := { GroupID: int, Name: string, Description: string, WebSite: string, Type: string, Tags: FieldValues, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image }; FieldValues := [{ Value: string, ValueID: int, FieldID: int, FieldName: string, }];

Edit (POST) Updates the profile of the specified user group. The user identified by the authentication token must have User Group Administrator role for the specified user group, or have Community Convener user role in any of the user groups in the system. Provided information effectively overwrites the group profile stored in the database, therefore if it is desirable to perform a partial update on a specific group profile, it may be desirable to work off the existing profile by obtaining it via /Group/View API function.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. groupID int 1 (required) The ID of the user group to update. groupName string “John’s Group” (required) A name for the group. Must be unique. aboutUs multi-line (required) A description for the group. text webSite string “host.com” A link to a web site or page with additional information about the user group. type string A type of the user group, which can be one of the following:  Community  Company/Corporation  Consortium  Government Agency  Non-Profit Organization  Program/Initiative  Project Values not on the list above are ignored. fieldValues int array A list of Field Value IDs from Tag Field that pertain to the user group. picture string BASE-64 encoded JPEG image to use as the profile logo. isActive Boolean True Makes the group active or inactive. If a value for an optional parameter is omitted, the present value in the user group profile remains unchanged.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied; the user identified by the authentication token does not have the User Group Administrator user role for the specified group, and doesn’t have the Community Convener user role. 3 Invalid parameter

“Data” object Data := GroupProfile; GroupProfile := { GroupID: int, Name: string, Description: string, WebSite: string, Type: string, Tags: FieldValues, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image }; FieldValues := [{ Value: string, ValueID: int, FieldID: int, FieldName: string, }]; Find (GET, POST) Finds one or more groups using the specified search criteria. Requires authentication.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. searchString string “Community” Found group profiles must conform to this free-text search parameter. fieldValues int array {1, 2, 3} Found group profiles must be associated with at least one Tag field value ID specified.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token

“Data” object Data := [ GroupProfile ]; GroupProfile := { GroupID: int, Name: string, Description: string, WebSite: string, Type: string, Tags: FieldValues, IsActive: boolean, Picture: string, // BASE64 encoded JPEG image }; FieldValues := [{ Value: string, ValueID: int, FieldID: int, FieldName: string, }];

AssignRoleToMember (POST) Assigns the specified user another role in the specified group; the user must be already a member of the specified user group. The user identified by the authentication token must have the User Group Administrator user role within the specified user group, or participate in the Community Convener user role.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. userID GUID (required) UID of the user to change privileges for. groupID int 1 (required) The ID of the user group the specified user is a member of. userRole int 4 (required) An identifier of the privilege to assign to the user. The following privileges are recognized: Identifier Name 1 Community Convener 2 Consumer 4 Curator 5 Metadata Curator 7 User Group Administrator

The user identified by the authenticated token must have Community Convener role (in any user group) in order to assign Community Convener role to other users. The user identified by the authenticated token must have Metadata Curator or Community Convener role (in any user group) in order to assign Metadata Curator role to other users.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied for one of the following reasons:  The user identified by the authentication token does not have the User Group Administrator user role in the specified group, and does not have the Community Convener user role.  The user is not authorized to assign the specified user role. 3 Invalid parameter; this error code is returned when the specified user is not a current member of the specified user group.

“Data” object The payload is empty.

RemoveRoleFromMember (POST) Removes the specified user role from the specified user in the specified user group. The user identified by the authentication token must have the User Group Administrator user role within the specified user group, or participate in the Community Convener user role.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. userID GUID (required) UID of the user to change privileges for. groupID int 1 (required) The ID of the user group the specified user is a member of. userRole int 4 (required) An identifier of the privilege to remove from the user. The following privileges are recognized: Identifier Name 1 Community Convener 2 Consumer 4 Curator 5 Metadata Curator 7 User Group Administrator

The user identified by the authenticated token must have Community Convener role (in any user group) in order to remove Community Convener role from other users. The user identified by the authenticated token must have Metadata Curator or Community Convener role (in any user group) in order to remove Metadata Curator role from other users.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied for one of the following reasons:  The user identified by the authentication token does not have the User Group Administrator user role in the specified group, and does not have the Community Convener user role.  The user is not authorized to assign the specified user role. 3 Invalid parameter; this error code is returned when the specified user is not a current member of the specified user group.

“Data” object The payload is empty.

Resource Functions In this section you will find functions that pertain to resource information retrieval, updates, security and ownership management. Additionally, functions for adding and removing Resources to and from Folders are provided.

Create (POST) Create a new Resource using the specified parameters. Authentication is required.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceVisibility int 0 (required) visibility of the new Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal fieldValues FieldValue array (required) one or more field values; value for the Title field must be specified. relations ResourceRelation Relationships with other (already registered) array Resources fields Field array (required) HingX metadata (an ontology of Fields) updated from the baseline originalFields to contain information necessary to create the new Resource originalFields Field array (required) HingX metadata (an ontology of Fields) used as a baseline for Resource creation answers Answer Choices controlling the API behavior The user identified by the authentication token will become the owner of the newly created Resource.

The value for originalFields parameter (and the initial value fields parameter) is obtained by calling GetFieldsExt (GET, POST) API function. See comments for Edit (POST) function for more information about saving Resources in HingX Registry.

FieldValue := { FieldValueID : int, // A unique ID of a Field Value // within the context of a // Resource. New Field Values must // have zero or negative unique // IDs. FieldID : int, // An ID referencing an entry from // fields array // (e.g. fields[n].FieldID) ValueID : int, // An ID referencing a “list” value // from fields array // (e.g. fields[n].Values[m].ValueID) Value : string, // Text value corresponding to a non- // “list” Field }; Field := { FieldID : int, // A unique ID of a Field. New Fields // must have negative unique IDs (so they // can be properly referenced) Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one // 1 - many Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, }; Answer := { SelectGroupID : int, QuestionID : string, Conflicts: [ AnswerConflict ], }; AnswerConflict := { ConflictID : int, AnswerID : int, };

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value 4 General failure 12 The API requires additional information to successfully process the request; examine the Data object to determine the nature of the additional information, and resubmit the same request with additional information.

“Data” object If StatusCode=0, the Data object is the new Resource ID.

If StatusCode=12, the Data object is as follows:

Data := { Type : string, Message : string }; By examining the value assigned to Type, it is possible to identify the nature of the “question” and therefore what additional fields within the Data object may be present.

Type Explanation 0 A resource with the same Title already exists; if creating another resource with the same Title is, in fact, the intended action, set answer.QuestionID to “Q07” and resubmit the request. Data := { Type : string, // “0” Message : string, QuestionID : string, // “Q07” }; 1 The currently selected group for the user does not have enough permissions to complete the operation; select one of the groups from the GroupIDs list, and resubmit the request with answer.SelectGroupID set. Data := { Type : string, // “1” Message : string, GroupIDs : [ int ], }; 3 The currently selected group for the user is different from the user’s primary group; confirm that the user indeed intends to continue this operation in the context of a group other than their primary group, and resubmit the request with answer.SelectGroupID set to the ID of either current of primary group. Data := { Type : string, // “3” Message : string, CurrentGroupID : int, PrimaryGroupID : int, };

Edit (POST) Update an existing Resource with the provided information. Authentication is required.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceVisibility int 0 (required) visibility of the new Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal fieldValues FieldValue array (required) one or more field values; value for the Title field must be specified. originalFieldValues FieldValue array (required) the baseline for Resource field values modifications (only the “delta” between fieldValues and originalFieldValues will be processed). relations ResourceRelation Relationships with other (already registered) array Resources originalRelations ResourceRelation The baseline for Resource relationships array modification (only the “delta” between relations and originalRelations will be processed). fields Field array (required) HingX metadata (an ontology of Fields) updated from the baseline originalFields to contain information necessary to create the new Resource originalFields Field array (required) HingX metadata (an ontology of Fields) used as a baseline for Resource creation (only the “delta” between fields and originalFields will be processed). answers Answer Choices controlling the API behavior The user identified by the authentication token must have permission to edit the Resource. Furthermore, only the owners of the Resource can update Title, Abstract and Resource Location Fields. The value for originalFields parameter (and the initial value fields parameter) is obtained by calling GetFieldsExt (GET, POST) API function.

Due to concurrent nature of Resource changes handled by HingX Registry, Resource Create and Edit functions generally require pairs of certain parameters: fields and originalFields, relations and originalRelations, fieldValues and originalFieldValues. HingX server evaluates the parameter pair and extracts the “delta” between the provided sets of objects; this “delta” encompasses only those items (e.g. Fields, Relations, Field Values, etc.) that have actually changed (were added, updated or removed).

FieldValue := { FieldValueID : int, // A unique ID of a Field Value // within the context of a // Resource. New Field Values must // have zero or negative unique // IDs. FieldID : int, // An ID referencing an entry from // fields array // (e.g. fields[n].FieldID) ValueID : int, // An ID referencing a “list” value // from fields array // (e.g. fields[n].Values[m].ValueID) Value : string, // Text value corresponding to a non- // “list” Field }; Field := { FieldID : int, // A unique ID of a Field. New Fields // must have negative unique IDs (so they // can be properly referenced) Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one // 1 - many Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, }; Answer := { SelectGroupID : int, QuestionID : string, Conflicts: [ AnswerConflict ], }; AnswerConflict := { ConflictID : int, AnswerID : int, // Conflict resolution instruction: // 0 – use “my value” // 1 – use “current value” };

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value 4 General failure 12 The API requires additional information to successfully process the request; examine the Data object to determine the nature of the additional information, and resubmit the same request with additional information.

“Data” object If StatusCode=0, the Data object is the new Resource ID.

If StatusCode=12, the Data object is as follows:

Data := { Type : string, Message : string }; By examining the value assigned to Type, it is possible to identify the nature of the “question” and therefore what additional fields within the Data object may be present.

Type Explanation 0 A resource with the same Title already exists; if creating another resource with the same Title is, in fact, the intended action, set answer.QuestionID to “Q07” and resubmit the request. Data := { Type : string, // “0” Message : string, QuestionID : string, // “Q07” }; 1 The currently selected group for the user does not have enough permissions to complete the operation; select one of the groups from the GroupIDs list, and resubmit the request with answer.SelectGroupID set. Data := { Type : string, // “1” Message : string, GroupIDs : [ int ], }; 2 Concurrent changes to the Resource were detected; examine the conflicts, change contents of fieldValues and/or fields parameters and/or initialize answer.Conflicts array before resubmitting the request. Data := { Type : string, // “2” Message : string, Conflicts : [ Conflict ], }; Conflict := { ConflictID : int, MyValue : string, CurrentValue : string, AttributeName : string, }; 3 The currently selected group for the user is different from the user’s primary group; confirm that the user indeed intends to continue this operation in the context of a group other than their primary group, and resubmit the request with answer.SelectGroupID set to the ID of either current of primary group. Data := { Type : string, // “3” Message : string, CurrentGroupID : int, PrimaryGroupID : int, };

GetDetails (GET, POST) Retrieves full descriptions of one or more Resources. Authentication is optional.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceIDs int array {1, 23, 44} (required) One or more resource IDs. The authentication token is required only to access restricted resources or protected resource location fields.

Response The result is an array of Result objects, where each entry corresponds to an entry in resourceIDs array, and the Data payload contains a Resource Description. When called with an empty resourceIDs array, the output is also an empty array.

If an authentication token is specified, and its value happens to be invalid, a single entry is returned with StatusCode=1 (Invalid authentication token).

If an unexpected runtime error occurs, the returned array may contain fewer elements than the input resourceIDs array. The last entry of the output array will have StatusCode=4 (General failure).

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid value of the specified resource ID 4 General failure “Data” object Data := Resource; Resource := { ResourceID: int, Metadata: FieldValues, Visibility: int, // 0 – unrestricted, 1 – restricted, // 2 – private, 3 – personal. Alias: string, CommunityFeedbackStatistics: Feedback, CommunityFeedbackDetails: FeedbackDetails, Modify: Modify, UsageStatistics: Statistics }; FieldValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }]; Feedback := { Like: int, // Number of HingX members who like the Resource Use: int, // Number of HingX members who use the Resource Follow: int, // Number of HingX members who follow the Resource }; FeedbackDetails := { Like: FeedbackUsers, // HingX members who like the Resource Use: FeedbackUsers, // HingX members who use the Resource Follow: FeedbackUsers, // HingX members who follow the Resource }; FeedbackUsers := [{ UserName: string, FeedbackOn: date, // UTC }]; Modify := { CreatedOn: date, // UTC CreatedByUser: string, CreatedByUserID: GUID, CreatedByGroup: string, CreatedByGroupID: int, ModifiedOn: date, // UTC ModifiedByUser: string, ModifiedByUserID: GUID, ModifiedByGroup: string, ModifiedByGroupID: int, }; Statistics := { Views: int, // Number of times the Resource was viewed Downloads: int, // Number of times the Resource was downloaded };

Find (GET, POST) Finds Resources conforming to the specified criteria. Authentication is optional. The layout of output objects is configurable. Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. searchString string “Strategic Found Resources must satisfy these free-text search Plan” criteria, when specified. fieldValues int array {1, 23, 56} Found Resources must reference the specified Field Values. Values from different Fields are introduced into the search condition via AND operator. Multiple Values from the same Field are introduced into the search condition via OR operator. users GUID array Found Resources must have been created or last modified by at least one of the users specified by User ID. groups int array Found Resources must have been created or last modified by at least one of the groups specified by Group ID. fieldsReturn int array Additional dynamic metadata fields to return for the active result page, when requested. The list of Field IDs can be obtained using GetOntology function. Important: this parameter is ignored unless outputPreference has 0x40 flag set. outputPreference int Additional static metadata fields to return for the active results page, when requested. This is a bitmask field with following bits available: 0x01 – include information about creation and last modification of the Resource, 0x02 – include Resource visibility, 0x04 – include Resource Alias, 0x08 – include views and downloads statistics, 0x10 – include community feedback statistics and details; the latter is available only when a valid authentication token is provided, 0x20 – include Resource dynamic metadata in accordance with the fieldsReturn parameter; if fieldsReturn parameter is omitted, all dynamic metadata Fields are returned. sortBy int 0 Output result sort mode: 0 (default) – by relevancy, 1 – by Resource Title (A-Z), 2 – by Resource Title (Z-A), 3 – by Resource Abstract (A-Z), 4 – by Last Modified Date (newest first), 5 – by number of Followers (most followed first), 6 – by number of Uses (most used first), 7 – by number of Likes (most liked first), 8 – by number of views (most viewed first), 9 – by number of downloads (most downloaded first). page int 6 Output page for which the extended information is returned, 1-based. maxItemsPerPage int 100 The number of items per output page, must be greater than 0. The authentication token is required only to access restricted resources or protected resource location fields. If no filters are specified (searchString, fieldValues, users and groups), the result contains information about all Resources visible to general public, or to the user represented by the authentication token (when provided).

Additional Information and Paging

By default, only Resource IDs are returned. Using Create (POST) Create a new Resource using the specified parameters. Authentication is required.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceVisibility int 0 (required) visibility of the new Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal fieldValues FieldValue array (required) one or more field values; value for the Title field must be specified. relations ResourceRelation Relationships with other (already registered) array Resources fields Field array (required) HingX metadata (an ontology of Fields) updated from the baseline originalFields to contain information necessary to create the new Resource originalFields Field array (required) HingX metadata (an ontology of Fields) used as a baseline for Resource creation answers Answer Choices controlling the API behavior The user identified by the authentication token will become the owner of the newly created Resource.

The value for originalFields parameter (and the initial value fields parameter) is obtained by calling GetFieldsExt (GET, POST) API function. See comments for Edit (POST) function for more information about saving Resources in HingX Registry.

FieldValue := { FieldValueID : int, // A unique ID of a Field Value // within the context of a // Resource. New Field Values must // have zero or negative unique // IDs. FieldID : int, // An ID referencing an entry from // fields array // (e.g. fields[n].FieldID) ValueID : int, // An ID referencing a “list” value // from fields array // (e.g. fields[n].Values[m].ValueID) Value : string, // Text value corresponding to a non- // “list” Field }; Field := { FieldID : int, // A unique ID of a Field. New Fields // must have negative unique IDs (so they // can be properly referenced) Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one // 1 - many Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, }; Answer := { SelectGroupID : int, QuestionID : string, Conflicts: [ AnswerConflict ], }; AnswerConflict := { ConflictID : int, AnswerID : int, };

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value 4 General failure 12 The API requires additional information to successfully process the request; examine the Data object to determine the nature of the additional information, and resubmit the same request with additional information. “Data” object If StatusCode=0, the Data object is the new Resource ID.

If StatusCode=12, the Data object is as follows:

Data := { Type : string, Message : string }; By examining the value assigned to Type, it is possible to identify the nature of the “question” and therefore what additional fields within the Data object may be present.

Type Explanation 0 A resource with the same Title already exists; if creating another resource with the same Title is, in fact, the intended action, set answer.QuestionID to “Q07” and resubmit the request. Data := { Type : string, // “0” Message : string, QuestionID : string, // “Q07” }; 1 The currently selected group for the user does not have enough permissions to complete the operation; select one of the groups from the GroupIDs list, and resubmit the request with answer.SelectGroupID set. Data := { Type : string, // “1” Message : string, GroupIDs : [ int ], }; 3 The currently selected group for the user is different from the user’s primary group; confirm that the user indeed intends to continue this operation in the context of a group other than their primary group, and resubmit the request with answer.SelectGroupID set to the ID of either current of primary group. Data := { Type : string, // “3” Message : string, CurrentGroupID : int, PrimaryGroupID : int, };

Edit (POST) Update an existing Resource with the provided information. Authentication is required.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceVisibility int 0 (required) visibility of the new Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal fieldValues FieldValue array (required) one or more field values; value for the Title field must be specified. originalFieldValues FieldValue array (required) the baseline for Resource field values modifications (only the “delta” between fieldValues and originalFieldValues will be processed). relations ResourceRelation Relationships with other (already registered) array Resources originalRelations ResourceRelation The baseline for Resource relationships array modification (only the “delta” between relations and originalRelations will be processed). fields Field array (required) HingX metadata (an ontology of Fields) updated from the baseline originalFields to contain information necessary to create the new Resource originalFields Field array (required) HingX metadata (an ontology of Fields) used as a baseline for Resource creation (only the “delta” between fields and originalFields will be processed). answers Answer Choices controlling the API behavior The user identified by the authentication token must have permission to edit the Resource. Furthermore, only the owners of the Resource can update Title, Abstract and Resource Location Fields.

The value for originalFields parameter (and the initial value fields parameter) is obtained by calling GetFieldsExt (GET, POST) API function.

Due to concurrent nature of Resource changes handled by HingX Registry, Resource Create and Edit functions generally require pairs of certain parameters: fields and originalFields, relations and originalRelations, fieldValues and originalFieldValues. HingX server evaluates the parameter pair and extracts the “delta” between the provided sets of objects; this “delta” encompasses only those items (e.g. Fields, Relations, Field Values, etc.) that have actually changed (were added, updated or removed).

FieldValue := { FieldValueID : int, // A unique ID of a Field Value // within the context of a // Resource. New Field Values must // have zero or negative unique // IDs. FieldID : int, // An ID referencing an entry from // fields array // (e.g. fields[n].FieldID) ValueID : int, // An ID referencing a “list” value // from fields array // (e.g. fields[n].Values[m].ValueID) Value : string, // Text value corresponding to a non- // “list” Field }; Field := { FieldID : int, // A unique ID of a Field. New Fields // must have negative unique IDs (so they // can be properly referenced) Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one // 1 - many Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, }; Answer := { SelectGroupID : int, QuestionID : string, Conflicts: [ AnswerConflict ], }; AnswerConflict := { ConflictID : int, AnswerID : int, // Conflict resolution instruction: // 0 – use “my value” // 1 – use “current value” };

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value 4 General failure 12 The API requires additional information to successfully process the request; examine the Data object to determine the nature of the additional information, and resubmit the same request with additional information.

“Data” object If StatusCode=0, the Data object is the new Resource ID.

If StatusCode=12, the Data object is as follows: Data := { Type : string, Message : string }; By examining the value assigned to Type, it is possible to identify the nature of the “question” and therefore what additional fields within the Data object may be present.

Type Explanation 0 A resource with the same Title already exists; if creating another resource with the same Title is, in fact, the intended action, set answer.QuestionID to “Q07” and resubmit the request. Data := { Type : string, // “0” Message : string, QuestionID : string, // “Q07” }; 1 The currently selected group for the user does not have enough permissions to complete the operation; select one of the groups from the GroupIDs list, and resubmit the request with answer.SelectGroupID set. Data := { Type : string, // “1” Message : string, GroupIDs : [ int ], }; 2 Concurrent changes to the Resource were detected; examine the conflicts, change contents of fieldValues and/or fields parameters and/or initialize answer.Conflicts array before resubmitting the request. Data := { Type : string, // “2” Message : string, Conflicts : [ Conflict ], }; Conflict := { ConflictID : int, MyValue : string, CurrentValue : string, AttributeName : string, }; 3 The currently selected group for the user is different from the user’s primary group; confirm that the user indeed intends to continue this operation in the context of a group other than their primary group, and resubmit the request with answer.SelectGroupID set to the ID of either current of primary group. Data := { Type : string, // “3” Message : string, CurrentGroupID : int, PrimaryGroupID : int, }; GetDetails function, Resource Descriptions can be retrieved for single and multiple Resource IDs at a time. To save the extra roundtrip, it is possible to search for Resources and retrieve their details at the same time. Follow this simple procedure to achieve this effect:

1. Make sure the sort order is correct (specify sortBy parameter). 2. Identify the maximum number of Resources a single page can display (specify maxItemsPerPage parameter). 3. Identify the “current” page to display (start with 1). 4. Decide what additional information to request (specify outputPreference parameter); if dynamic Metadata Fields are required (with or without fieldsReturn filter), set bit 0x20 in the outputPreference parameter. 5. If bit 0x20 of the outputPreference parameter is set, and only a subset of dynamic Metadata Fields is required, specify the relevant Field IDs in the fieldsReturn parameter.

It is important to note that unless a specific field or subset of fields was requested via a corresponding outputPreference flag, it will not be present in the output JSON – not merely the value will be null, but the field itself is not going to be generated.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token

“Data” object Data := Resource; Resource := { ResourceID: int, Metadata: FieldValues, Visibility: int, // 0 – unrestricted, 1 – restricted, // 2 – private, 3 – personal. Alias: string, CommunityFeedbackStatistics: Feedback, CommunityFeedbackDetails: FeedbackDetails, Modify: Modify, UsageStatistics: Statistics }; FieldValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }]; Feedback := { Like: int, // Number of HingX members who like the Resource Use: int, // Number of HingX members who use the Resource Follow: int, // Number of HingX members who follow the Resource }; FeedbackDetails := { Like: FeedbackUsers, // HingX members who like the Resource Use: FeedbackUsers, // HingX members who use the Resource Follow: FeedbackUsers, // HingX members who follow the Resource }; FeedbackUsers := [{ UserName: string, FeedbackOn: date, // UTC }]; Modify := { CreatedOn: date, // UTC CreatedByUser: string, CreatedByUserID: GUID, CreatedByGroup: string, CreatedByGroupID: int, ModifiedOn: date, // UTC ModifiedByUser: string, ModifiedByUserID: GUID, ModifiedByGroup: string, ModifiedByGroupID: int, }; Statistics := { Views: int, // Number of times the Resource was viewed Downloads: int, // Number of times the Resource was downloaded };

AddToFolder (POST) Adds the specified Resources to the specified Folder. Requires authentication.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. folderID int 123 (required) a Folder ID to add Resources to. resourceIDs int array {1, 23, 45} (required) one or more Resource IDs to add to the specified Folder. The user represented by the authentication token must have permissions to access the specified Folder, as well as at least have view permission to the specified Resources. Any Resources the user is not permitted to view are silently ignored.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token is not permitted to perform the operation 3 Invalid parameter value

“Data” object The payload is empty.

RemoveFromFolder (POST) Removes the specified Resources from the specified Folder. Requires authentication.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. folderID int 123 (required) a Folder ID to remove Resources from. resourceIDs int array {1, 23, 45} (required) one or more Resource IDs to remove from the specified Folder. The user represented by the authentication token must have permissions to access the specified Folder, as well as at least have view permission to the specified Resources. Any Resources the user is not permitted to view are silently ignored.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token is not permitted to perform the operation 3 Invalid parameter value

“Data” object The payload is empty.

ChangeOwner (POST) Transfers ownership of the specified Resource Description to another user group. Requires authentication.

Request parameters Parameter Data Type Example Description token String (required) The authentication token obtained from /User/Login function. resourceID int 123 (required) an identifier of a Resource to perform ownership transfer operation for. groupID Int 1 (required) the group that receives ownership of the Resource. The user represented by the authentication token must be a member of the user group which is the current owner of the Resource; furthermore, the same user must be a member of the group identified by groupID parameter.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value “Data” object The payload is empty.

Delete (POST) Removes the specified Resource from the registry. Requires authentication.

Request parameters Parameter Data Type Example Description token String (required) The authentication token obtained from /User/Login function. resourceID int 123 (required) an identifier of a Resource to perform ownership transfer operation for. The user represented by the authentication token must be a member of the user group which is the current owner of the Resource.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value

“Data” object The payload is empty.

GetSecurity (GET, POST) Retrieves the current security settings from the specified Resource. Requires authentication.

Request parameters Parameter Data Type Example Description token String (required) The authentication token obtained from /User/Login function. resourceID Int 123 (required) an identifier of a Resource to retrieve security settings for. The user represented by the authentication token must be a member of the user group which is the current owner of the Resource.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value “Data” object Data := { ResourceVisibility: int, // 0 – unrestricted, 1 – private, // 2 – restricted, 3 - personal ResourceRACL: Groups, ResourceWACL: Groups, LocationVisibility: int, // 0 – unrestricted, 1 – private, // 2 - restricted LocationRACL: Groups, }; Groups := [{ GroupID: int, Name: string, Type: string, Description: string, WebSite: string, IsActive: Boolean, Picture: string, // BASE64 encoded JPEG Tags: AttributeValues, }]; AttributeValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }];

SetSecurity (POST) Updates the security settings for the specified Resource. Requires authentication.

Request parameters Parameter Data Example Description Type token String (required) The authentication token obtained from /User/Login function. resourceID int 123 (required) an identifier of a Resource to update security settings for. resourceVisibility int 0 (required) visibility level of the Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal locationVisibility int 0 (required) visibility level of the Resource Location field: 0 – unrestricted 1 – private 2 – restricted resourceRACL int array {1, 2, 3} Identifiers of user groups that will be authorized to view the Resource resourceWACL int array {1, 2, 3} Identifiers of user groups that will be authorized to edit the Resource locationRACL int array {1, 2, 3} Identifiers of user groups that will be authorized to see the contents of Resource Location field The user represented by the authentication token must be a member of the user group which is the current owner of the Resource. Omitting value or specifying an empty array for any of resourceRACL, resourceWACL, or locationRACL parameters will clear the corresponding Access Control List in the database.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value

“Data” object The payload is empty.

CommunityFeedback (POST) Submit new or rescind previously submitted feedback for the specified resource. Requires authentication.

Request parameters Parameter Data Example Description Type token String (required) The authentication token obtained from /User/Login function. resourceID int 123 (required) an identifier of a Resource to perform feedback submission/rescission operation for. feedbackType int 0 (required) the type of the feedback: 0 – like 1 – follow 2 – use The user represented by the authentication token must have enough permissions to view the specified Resource.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value “Data” object The payload is empty.

Field Functions In this section you will find functions that pertain to HingX Repository metadata retrieval and management.

GetOntology (GET, POST) Retrieves HingX Repository metadata. Authentication is optional.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. Authentication is required to retrieve information about Private Fields.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token

“Data” object Data := FieldValues; FieldValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }];

GetFieldsExt (GET, POST) Retrieves HingX Repository metadata. Authentication is optional. Use this API function to retrieve the metadata ontology required for creating and editing Resources.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. Authentication is required to retrieve information about Private Fields.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token

“Data” object Data := [ Field ]; Field := { FieldID : int, Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” SemanticType : int, // Field semantic type: // 0 – Generic Field // 1 – Resource Title // 2 – Resource Abstract // 3 – Resource Location (URL) // 4 – Tag // 5 – Resource Type FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one (only one instance of this // Field can be associated with any // given Resource) // 1 – many (multiple instances of this // Field can be associated with any // given Resource) Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, };

Folder Functions In this section you will find functions that pertain to retrieval and management of Folders.

List (GET, POST) Retrieves a list of Folders available to the authenticated user.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. Folders associated with groups the user represented by the authentication token is a member of, as well as user’s personal folders are retrieved. Response A tree-like Folder structure is returned in a list format with children Folders referencing their parent’s FolderID in their ParentID data member.

FolderID Values Zero A well-known container that corresponds to “My Personal Folders” Negative Number A well-known container that corresponds to a group Positive Number A regular user-created folder

Result Codes Code Explanation 0 Success 1 Invalid authentication token

“Data” object Data := Folders; Folders := [{ FolderID: int, ParentID: int, Name: string, }];

Create (POST) Creates a new Folder under the specified parent Folder. Requires authentication.

Request parameters Parameter Data Type Example Description token string (required) The authentication token obtained from /User/Login function. name string “Stuff” (required) A name for the new Folder; must be unique in among the siblings of the specified parent Folder. description string “My stuff” A short description that will be attached to the newly created Folder. parentID int 345 (required) Parent Folder ID. To create a new top-level personal folder, specify 0 value. To create a new top- level group folder, specify a negative Group ID value.

Response A data object corresponding to the newly created Folder is returned upon successful completion.

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token doesn’t have a permission to work with the specified parent Folder 3 Invalid parent Folder ID 3 Folder name is missing 5 A folder with the specified name already exists in the specified parent Folder

“Data” object Data := Folder; Folder := { FolderID: int, ParentID: int, Name: string, };

Delete (DELETE) Deletes an existing Folder. Requires authentication.

Request parameters Parameter Data Type Example Description token String (required) The authentication token obtained from /User/Login function. folderID int 345 (required) An ID of the Folder to delete.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token doesn’t have a permission to work with the specified parent Folder 3 Invalid parent Folder ID

“Data” object Upon successful completion, the “data” object is empty.

Download (GET, POST) Retrieves Resources associated with the specified Folder. Requires authentication. The layout of output objects is configurable.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. folderID int 123 (required) The ID of the Folder to retrieve Resources from. fieldsReturn int array Additional dynamic metadata fields to return for the active result page, when requested. The list of Field IDs can be obtained using GetOntology function. Important: this parameter is ignored unless outputPreference has 0x40 flag set. outputPreference int 32 Additional static metadata fields to return for the active results page, when requested. This is a bitmask field with following bits available: 0x01 – include information about creation and last modification of the Resource, 0x02 – include Resource visibility, 0x04 – include Resource Alias, 0x08 – include views and downloads statistics, 0x10 – include community feedback statistics and details; the latter is available only when a valid authentication token is provided, 0x20 – include Resource dynamic metadata in accordance with the fieldsReturn parameter; if fieldsReturn parameter is omitted, all dynamic metadata Fields are returned. sortBy int 0 Output result sort mode: 0 (default) – by relevancy, 1 – by Resource Title (A-Z), 2 – by Resource Title (Z-A), 3 – by Resource Abstract (A-Z), 4 – by Last Modified Date (newest first), 5 – by number of Followers (most followed first), 6 – by number of Uses (most used first), 7 – by number of Likes (most liked first), 8 – by number of views (most viewed first), 9 – by number of downloads (most downloaded first). page int 6 Output page for which the extended information is returned, 1-based. maxItemsPerPage int 100 The number of items per output page, must be greater than 0. The authentication token is required to access the specified Folder as well as restricted resources or protected resource location fields.

Additional Information and Paging

By default, only Resource IDs are returned. Using Create (POST) Create a new Resource using the specified parameters. Authentication is required.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceVisibility int 0 (required) visibility of the new Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal fieldValues FieldValue array (required) one or more field values; value for the Title field must be specified. relations ResourceRelation Relationships with other (already registered) array Resources fields Field array (required) HingX metadata (an ontology of Fields) updated from the baseline originalFields to contain information necessary to create the new Resource originalFields Field array (required) HingX metadata (an ontology of Fields) used as a baseline for Resource creation answers Answer Choices controlling the API behavior The user identified by the authentication token will become the owner of the newly created Resource.

The value for originalFields parameter (and the initial value fields parameter) is obtained by calling GetFieldsExt (GET, POST) API function. See comments for Edit (POST) function for more information about saving Resources in HingX Registry.

FieldValue := { FieldValueID : int, // A unique ID of a Field Value // within the context of a // Resource. New Field Values must // have zero or negative unique // IDs. FieldID : int, // An ID referencing an entry from // fields array // (e.g. fields[n].FieldID) ValueID : int, // An ID referencing a “list” value // from fields array // (e.g. fields[n].Values[m].ValueID) Value : string, // Text value corresponding to a non- // “list” Field }; Field := { FieldID : int, // A unique ID of a Field. New Fields // must have negative unique IDs (so they // can be properly referenced) Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one // 1 - many Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, }; Answer := { SelectGroupID : int, QuestionID : string, Conflicts: [ AnswerConflict ], }; AnswerConflict := { ConflictID : int, AnswerID : int, };

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value 4 General failure 12 The API requires additional information to successfully process the request; examine the Data object to determine the nature of the additional information, and resubmit the same request with additional information.

“Data” object If StatusCode=0, the Data object is the new Resource ID.

If StatusCode=12, the Data object is as follows:

Data := { Type : string, Message : string }; By examining the value assigned to Type, it is possible to identify the nature of the “question” and therefore what additional fields within the Data object may be present.

Type Explanation 0 A resource with the same Title already exists; if creating another resource with the same Title is, in fact, the intended action, set answer.QuestionID to “Q07” and resubmit the request. Data := { Type : string, // “0” Message : string, QuestionID : string, // “Q07” }; 1 The currently selected group for the user does not have enough permissions to complete the operation; select one of the groups from the GroupIDs list, and resubmit the request with answer.SelectGroupID set. Data := { Type : string, // “1” Message : string, GroupIDs : [ int ], }; 3 The currently selected group for the user is different from the user’s primary group; confirm that the user indeed intends to continue this operation in the context of a group other than their primary group, and resubmit the request with answer.SelectGroupID set to the ID of either current of primary group. Data := { Type : string, // “3” Message : string, CurrentGroupID : int, PrimaryGroupID : int, };

Edit (POST) Update an existing Resource with the provided information. Authentication is required.

Request parameters Parameter Data Type Example Description token string The authentication token obtained from /User/Login function. resourceVisibility int 0 (required) visibility of the new Resource: 0 – unrestricted 1 – private 2 – restricted 3 – personal fieldValues FieldValue array (required) one or more field values; value for the Title field must be specified. originalFieldValues FieldValue array (required) the baseline for Resource field values modifications (only the “delta” between fieldValues and originalFieldValues will be processed). relations ResourceRelation Relationships with other (already registered) array Resources originalRelations ResourceRelation The baseline for Resource relationships array modification (only the “delta” between relations and originalRelations will be processed). fields Field array (required) HingX metadata (an ontology of Fields) updated from the baseline originalFields to contain information necessary to create the new Resource originalFields Field array (required) HingX metadata (an ontology of Fields) used as a baseline for Resource creation (only the “delta” between fields and originalFields will be processed). answers Answer Choices controlling the API behavior The user identified by the authentication token must have permission to edit the Resource. Furthermore, only the owners of the Resource can update Title, Abstract and Resource Location Fields. The value for originalFields parameter (and the initial value fields parameter) is obtained by calling GetFieldsExt (GET, POST) API function.

Due to concurrent nature of Resource changes handled by HingX Registry, Resource Create and Edit functions generally require pairs of certain parameters: fields and originalFields, relations and originalRelations, fieldValues and originalFieldValues. HingX server evaluates the parameter pair and extracts the “delta” between the provided sets of objects; this “delta” encompasses only those items (e.g. Fields, Relations, Field Values, etc.) that have actually changed (were added, updated or removed).

FieldValue := { FieldValueID : int, // A unique ID of a Field Value // within the context of a // Resource. New Field Values must // have zero or negative unique // IDs. FieldID : int, // An ID referencing an entry from // fields array // (e.g. fields[n].FieldID) ValueID : int, // An ID referencing a “list” value // from fields array // (e.g. fields[n].Values[m].ValueID) Value : string, // Text value corresponding to a non- // “list” Field }; Field := { FieldID : int, // A unique ID of a Field. New Fields // must have negative unique IDs (so they // can be properly referenced) Name : string, Description : string, Visibility : int, // Field visibility: // 0 – unrestricted // 1 – private // 2 - restricted Type : int, // Field value type: // 0, 1 – text // 4 – “list” FieldGroupID : int, Cardinality : int, // Field cardinality: // 0 – one // 1 - many Values : [ ListFieldValue ], }; ListFieldValue := { ValueID : int, Value : string, }; Answer := { SelectGroupID : int, QuestionID : string, Conflicts: [ AnswerConflict ], }; AnswerConflict := { ConflictID : int, AnswerID : int, // Conflict resolution instruction: // 0 – use “my value” // 1 – use “current value” };

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 Access denied 3 Invalid parameter value 4 General failure 12 The API requires additional information to successfully process the request; examine the Data object to determine the nature of the additional information, and resubmit the same request with additional information.

“Data” object If StatusCode=0, the Data object is the new Resource ID.

If StatusCode=12, the Data object is as follows:

Data := { Type : string, Message : string }; By examining the value assigned to Type, it is possible to identify the nature of the “question” and therefore what additional fields within the Data object may be present.

Type Explanation 0 A resource with the same Title already exists; if creating another resource with the same Title is, in fact, the intended action, set answer.QuestionID to “Q07” and resubmit the request. Data := { Type : string, // “0” Message : string, QuestionID : string, // “Q07” }; 1 The currently selected group for the user does not have enough permissions to complete the operation; select one of the groups from the GroupIDs list, and resubmit the request with answer.SelectGroupID set. Data := { Type : string, // “1” Message : string, GroupIDs : [ int ], }; 2 Concurrent changes to the Resource were detected; examine the conflicts, change contents of fieldValues and/or fields parameters and/or initialize answer.Conflicts array before resubmitting the request. Data := { Type : string, // “2” Message : string, Conflicts : [ Conflict ], }; Conflict := { ConflictID : int, MyValue : string, CurrentValue : string, AttributeName : string, }; 3 The currently selected group for the user is different from the user’s primary group; confirm that the user indeed intends to continue this operation in the context of a group other than their primary group, and resubmit the request with answer.SelectGroupID set to the ID of either current of primary group. Data := { Type : string, // “3” Message : string, CurrentGroupID : int, PrimaryGroupID : int, }; GetDetails function, Resource Descriptions can be retrieved for single and multiple Resource IDs at a time. To save the extra roundtrip, it is possible to get the list of Resources from the Folder and retrieve their details at the same time. Follow this simple procedure to achieve this effect:

1. Make sure the sort order is correct (specify sortBy parameter). 2. Identify the maximum number of Resources a single page can display (specify maxItemsPerPage parameter). 3. Identify the “current” page to display (start with 1). 4. Decide what additional information to request (specify outputPreference parameter); if dynamic Metadata Fields are required (with or without fieldsReturn filter), set bit 0x20 in the outputPreference parameter. 5. If bit 0x20 of the outputPreference parameter is set, and only a subset of dynamic Metadata Fields is required, specify the relevant Field IDs in the fieldsReturn parameter.

It is important to note that unless a specific field or subset of fields was requested via a corresponding outputPreference flag, it will not be present in the output JSON – not merely the value will be null, but the field itself is not going to be generated.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token is not authorized to access the specified Folder 3 The specified Folder ID is invalid

“Data” object Data := [ Resource ]; Resource := { ResourceID: int, Metadata: FieldValues, Visibility: int, // 0 – unrestricted, 1 – restricted, // 2 – private, 3 – personal. Alias: string, CommunityFeedbackStatistics: Feedback, CommunityFeedbackDetails: FeedbackDetails, Modify: Modify, UsageStatistics: Statistics }; FieldValues := [{ ValueID: int, FieldID: int, FieldName: string, Value: string, }]; Feedback := { Like: int, // Number of HingX members who like the Resource Use: int, // Number of HingX members who use the Resource Follow: int, // Number of HingX members who follow the Resource }; FeedbackDetails := { Like: FeedbackUsers, // HingX members who like the Resource Use: FeedbackUsers, // HingX members who use the Resource Follow: FeedbackUsers, // HingX members who follow the Resource }; FeedbackUsers := [{ UserName: string, FeedbackOn: date, // UTC }]; Modify := { CreatedOn: date, // UTC CreatedByUser: string, CreatedByUserID: GUID, CreatedByGroup: string, CreatedByGroupID: int, ModifiedOn: date, // UTC ModifiedByUser: string, ModifiedByUserID: GUID, ModifiedByGroup: string, ModifiedByGroupID: int, }; Statistics := { Views: int, // Number of times the Resource was viewed Downloads: int, // Number of times the Resource was downloaded };

Move (POST) Moves an existing Folder to another parent Folder. Requires authentication.

Request parameters Parameter Data Type Example Description token String (required) The authentication token obtained from /User/Login function. folderID int 345 (required) An ID of the Folder to move. parentID int 123 (required) An ID of the new parent Folder.

Response

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token doesn’t have a permission to work with the specified Folder 2 The user represented by the authentication token doesn’t have a permission to work with the specified parent Folder 3 Invalid Folder ID 3 Invalid parent Folder ID 5 The target parent Folder ID already contains a Folder with the same name 11 Unable to move the specified folder to the specified parent folder

“Data” object Upon successful completion, the “data” object is empty.

Copy (POST) Copies an existing Folder to a new parent Folder. Requires authentication.

Request parameters Parameter Data Type Example Description token String (required) The authentication token obtained from /User/Login function. folderID int 345 (required) An ID of the Folder to move. parentID int 123 (required) An ID of the new parent Folder.

Response A data object corresponding to a copy of the specified Folder is returned upon successful completion.

Result Codes Code Explanation 0 Success 1 Invalid authentication token 2 The user represented by the authentication token doesn’t have a permission to work with the specified Folder 2 The user represented by the authentication token doesn’t have a permission to work with the specified parent Folder 3 Invalid Folder ID 3 Invalid parent Folder ID 5 The target parent Folder ID already contains a Folder with the same name 11 Unable to copy the specified folder to the specified parent folder “Data” object Data := Folder; Folder := { FolderID: int, ParentID: int, Name: string, };

Appendix 1 – Supported Country Names Country Name Central African Republic Afghanistan Chad Akrotiri Chile Albania China Algeria Christmas Island American Samoa Clipperton Island Andorra Cocos (Keeling) Islands Angola Colombia Anguilla Comoros Antarctica Congo, Democratic Republic of the Antigua and Barbuda Congo, Republic of the Argentina Cook Islands Armenia Coral Sea Islands Aruba Costa Rica Ashmore and Cartier Islands Cote d'Ivoire Australia Croatia Austria Cuba Azerbaijan Cyprus Bahamas, The Czech Republic Bahrain Denmark Bangladesh Dhekelia Barbados Djibouti Bassas da India Dominica Belarus Dominican Republic Belgium Ecuador Belize Benin El Salvador Bermuda Equatorial Guinea Bhutan Eritrea Bolivia Estonia Bosnia and Herzegovina Ethiopia Botswana Europa Island Bouvet Island Falkland Islands (Islas Malvinas) Brazil Faroe Islands British Indian Ocean Territory Fiji British Virgin Islands Finland Brunei France Bulgaria French Guiana Burkina Faso French Polynesia Burma French Southern and Antarctic Lands Burundi Gabon Cambodia Gambia, The Cameroon Gaza Strip Canada Georgia Cape Verde Germany Cayman Islands Ghana Gibraltar Luxembourg Glorioso Islands Macau Greece Macedonia Greenland Madagascar Grenada Malawi Guadeloupe Malaysia Guam Maldives Guatemala Mali Guernsey Malta Guinea Marshall Islands Guinea-Bissau Martinique Guyana Mauritania Haiti Mauritius Heard Island and McDonald Islands Mayotte Holy See (Vatican City) Mexico Honduras Micronesia, Federated States of Hong Kong Moldova Hungary Monaco Iceland Mongolia India Montserrat Indonesia Morocco Iran Mozambique Iraq Namibia Ireland Nauru Isle of Man Navassa Island Nepal Italy Netherlands Jamaica Netherlands Antilles Jan Mayen New Caledonia Japan New Zealand Jersey Nicaragua Niger Juan de Nova Island Nigeria Kazakhstan Niue Kenya Norfolk Island Kiribati Northern Mariana Islands Korea, North Norway Korea, South Oman Kuwait Pakistan Kyrgyzstan Palau Laos Panama Latvia Papua New Guinea Paracel Islands Lesotho Paraguay Liberia Peru Libya Philippines Liechtenstein Pitcairn Islands Lithuania Poland Portugal Taiwan Puerto Rico Tajikistan Qatar Tanzania Reunion Thailand Romania Timor-Leste Russia Togo Rwanda Tokelau Saint Helena Tonga Saint Kitts and Nevis Trinidad and Tobago Saint Lucia Tromelin Island Saint Pierre and Miquelon Tunisia Saint Vincent and the Grenadines Turkey Samoa Turkmenistan San Marino Turks and Caicos Islands Sao Tome and Principe Tuvalu Saudi Arabia Uganda Senegal Ukraine Serbia and Montenegro United Arab Emirates Seychelles United Kingdom Sierra Leone United States Singapore Uruguay Slovakia Uzbekistan Slovenia Vanuatu Solomon Islands Venezuela Somalia Vietnam South Africa Virgin Islands South Georgia and the South Sandwich Islands Wake Island Spain Wallis and Futuna Spratly Islands West Bank Western Sahara Sudan Yemen Suriname Zambia Svalbard Zimbabwe Swaziland Sweden Switzerland

Appendix 2 – Supported Time Zones Name Description Morocco Standard Time (UTC) Casablanca UTC (UTC) Coordinated Universal Time GMT Standard Time (UTC) Dublin, Edinburgh, Lisbon, London Greenwich Standard Time (UTC) Monrovia, Reykjavik W. Europe Standard Time (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna Central Europe Standard Time (UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague Romance Standard Time (UTC+01:00) Brussels, Copenhagen, Madrid, Paris Central European Standard Time (UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb W. Central Africa Standard Time (UTC+01:00) West Central Africa Namibia Standard Time (UTC+01:00) Windhoek Jordan Standard Time (UTC+02:00) Amman GTB Standard Time (UTC+02:00) , Bucharest Middle East Standard Time (UTC+02:00) Beirut Egypt Standard Time (UTC+02:00) Syria Standard Time (UTC+02:00) Damascus E. Europe Standard Time (UTC+02:00) E. Europe South Africa Standard Time (UTC+02:00) Harare, Pretoria FLE Standard Time (UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius Turkey Standard Time (UTC+02:00) Istanbul (UTC+02:00) Arabic Standard Time (UTC+03:00) Baghdad Kaliningrad Standard Time (UTC+03:00) Kaliningrad, Minsk Arab Standard Time (UTC+03:00) Kuwait, Riyadh E. Africa Standard Time (UTC+03:00) Nairobi Iran Standard Time (UTC+03:30) Tehran Arabian Standard Time (UTC+04:00) Abu Dhabi, Muscat Azerbaijan Standard Time (UTC+04:00) Baku Russian Standard Time (UTC+04:00) Moscow, St. Petersburg, Volgograd Mauritius Standard Time (UTC+04:00) Port Louis Georgian Standard Time (UTC+04:00) Tbilisi Caucasus Standard Time (UTC+04:00) Yerevan Afghanistan Standard Time (UTC+04:30) Kabul Pakistan Standard Time (UTC+05:00) Islamabad, Karachi West Asia Standard Time (UTC+05:00) Tashkent India Standard Time (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi (UTC+05:30) Sri Jayawardenepura (UTC+05:45) Central Asia Standard Time (UTC+06:00) Astana (UTC+06:00) Dhaka Ekaterinburg Standard Time (UTC+06:00) Ekaterinburg (UTC+06:30) Yangon (Rangoon) SE Asia Standard Time (UTC+07:00) Bangkok, Hanoi, Jakarta N. Central Asia Standard Time (UTC+07:00) Novosibirsk China Standard Time (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi North Asia Standard Time (UTC+08:00) Krasnoyarsk Singapore Standard Time (UTC+08:00) Kuala Lumpur, Singapore W. Australia Standard Time (UTC+08:00) Perth Taipei Standard Time (UTC+08:00) Taipei Ulaanbaatar Standard Time (UTC+08:00) Ulaanbaatar North Asia East Standard Time (UTC+09:00) Irkutsk Tokyo Standard Time (UTC+09:00) Osaka, Sapporo, Tokyo Korea Standard Time (UTC+09:00) Seoul Cen. Australia Standard Time (UTC+09:30) Adelaide AUS Central Standard Time (UTC+09:30) Darwin E. Australia Standard Time (UTC+10:00) Brisbane AUS Eastern Standard Time (UTC+10:00) Canberra, Melbourne, Sydney West Pacific Standard Time (UTC+10:00) Guam, Port Moresby Tasmania Standard Time (UTC+10:00) Hobart Yakutsk Standard Time (UTC+10:00) Yakutsk Central Pacific Standard Time (UTC+11:00) Solomon Is., New Caledonia Vladivostok Standard Time (UTC+11:00) Vladivostok New Zealand Standard Time (UTC+12:00) Auckland, Wellington UTC+12 (UTC+12:00) Coordinated Universal Time+12 Fiji Standard Time (UTC+12:00) Fiji Magadan Standard Time (UTC+12:00) Magadan Kamchatka Standard Time (UTC+12:00) Petropavlovsk-Kamchatsky - Old Tonga Standard Time (UTC+13:00) Nuku'alofa Samoa Standard Time (UTC+13:00) Samoa Azores Standard Time (UTC-01:00) Azores Cape Verde Standard Time (UTC-01:00) Cape Verde Is. UTC-02 (UTC-02:00) Coordinated Universal Time-02 Mid-Atlantic Standard Time (UTC-02:00) Mid-Atlantic E. South America Standard Time (UTC-03:00) Brasilia Argentina Standard Time (UTC-03:00) Buenos Aires SA Eastern Standard Time (UTC-03:00) Cayenne, Fortaleza Greenland Standard Time (UTC-03:00) Greenland Montevideo Standard Time (UTC-03:00) Montevideo Bahia Standard Time (UTC-03:00) Salvador Newfoundland Standard Time (UTC-03:30) Newfoundland Paraguay Standard Time (UTC-04:00) Asuncion Atlantic Standard Time (UTC-04:00) Atlantic Time (Canada) Central Brazilian Standard Time (UTC-04:00) Cuiaba SA Western Standard Time (UTC-04:00) Georgetown, La Paz, Manaus, San Juan Pacific SA Standard Time (UTC-04:00) Santiago Venezuela Standard Time (UTC-04:30) Caracas SA Pacific Standard Time (UTC-05:00) Bogota, Lima, Quito Eastern Standard Time (UTC-05:00) Eastern Time (US & Canada) US Eastern Standard Time (UTC-05:00) Indiana (East) Central America Standard Time (UTC-06:00) Central America Central Standard Time (UTC-06:00) Central Time (US & Canada) Central Standard Time (Mexico) (UTC-06:00) Guadalajara, Mexico City, Monterrey Canada Central Standard Time (UTC-06:00) Saskatchewan US Mountain Standard Time (UTC-07:00) Arizona Mountain Standard Time (UTC-07:00) Chihuahua, La Paz, Mazatlan (Mexico) Mountain Standard Time (UTC-07:00) Mountain Time (US & Canada) Pacific Standard Time (Mexico) (UTC-08:00) Baja California Pacific Standard Time (UTC-08:00) Pacific Time (US & Canada) Alaskan Standard Time (UTC-09:00) Alaska Hawaiian Standard Time (UTC-10:00) Hawaii UTC-11 (UTC-11:00) Coordinated Universal Time-11 Dateline Standard Time (UTC-12:00) International Date Line West