The create products operation will create new products with the specified request body.
After creating a product, you can add actions to it using the various POST actions documented in the Self Service API.
Using JSON
Request
Request URI
Method | Request URI |
---|---|
POST | https://{company-name}.helloid.com/api/v1/selfservice/products/batch/ |
Request parameters
Parameter | Description |
---|---|
{company-name} | The company name of the target company |
Request headers
Header | Description |
---|---|
Content-Type | Required. Must be set to application/json. |
Sample request body
[
{
"Name": "TestProduct",
"Description": "Product description",
"Code": "ABCD1234",
"managedByGroupGUID": "2dd10d56-c8a7-4766-8675-cace73e3cf52",
"Category": "Applications",
"isEnabled": false,
"isAutoApprove": false,
"isAutoDeny": false,
"isCommentable": false,
"FaIcon" : "fa-rocket",
"UseFaIcon": true,
"MultipleRequestOption": 1,
"ReminderTimeout": 30,
"OwnershipMaxDurationInMinutes": 90,
"HasTimeLimit": true,
"ManagerCanOverrideDuration": true,
"LimitType": "Maximum",
"riskFactor": 1,
"maxCount": null,
"showPrice": false,
"price": 50
},
{
"Name": "TestProduct2",
"Description": "Product description",
"Code": "ABCD5678",
"ManagedByUserName": "Administrator",
"Category": "Applications",
"isEnabled": false,
"isAutoApprove": false,
"isAutoDeny": false,
"isCommentable": false,
"FaIcon" : "fa-globe",
"UseFaIcon": true,
"MultipleRequestOption": 1,
"ReminderTimeout": 15,
"OwnershipMaxDurationInMinutes": 45
}
]
Request body parameters
Parameter | Description | Required/Optional | Default value |
---|---|---|---|
{Name} | Name of the product. | Required | - |
{Description} | Description of the product. | Optional | - |
{Code} | Main part of the product SKU (unique) | Optional | random |
{ManagedByGroupGUID} | The GUID of the group whose direct members will allow/deny access to the product. | Optional | - |
{Category} | In which category will the product fall. | Required | - |
{IsEnabled} | Indicates if the product is enabled | Optional | true |
{IsAutoApprove} | Indicates if the product is automatically approved | Optional | false |
{IsAutoDeny} | Indicates if the product is automatically denied | Optional | false |
{IsCommentable} | Indicates if comments can be added when requesting the product | Optional | false |
{Icon} | The hash of a custom icon. | Optional | |
{FaIcon} | The name of a font-awesome icon. For example: "fa-globe". | Optional | |
{UseFaIcon} | A boolean value indicating if the specified font-awesome icon should be used. | Optional | false |
{MultipleRequestOption} | A value indicating how often a product can be requested. Possible values: 1: Once 2: Always |
Optional | 1 |
{ReminderTimeout} | The timeout duration of the reminders in days, where 0 means never. | Optional | 0 |
{OwnershipMaxDuration} | The duration that that can be requested for this product in days, where 0 means indefinitely. | Optional | 0 |
{OwnershipMaxDurationInMinutes} | The duration that that can be requested for this product in minutes, where 0 means indefinitely. Overrides OwnershipMaxDuration. | Optional | 0 |
{HasTimeLimit} | Can there be a maximum duration of product ownership | Optional | false |
{LimitType} | What type is the duration limit. Options: Fixed / Maximum | Optional | Maximum |
{ManagerCanOverrideDuration} | Can the duration as requested by a user be overridden when approving. | Optional | false |
{CreateDefaultEmailActions} | Create the default email actions associated with the self service product. These actions are: 1. Email resource owner when the user requests the product. 2. Email requester when the request has been denied. Note that this option is only usable when creating a new product. Setting this option when performing an update will not add the default email actions. |
Optional | false |
{HasRiskFactor} | Indicates if a product has a risk factor. | optional | false |
{RiskFactor} | The risk factor of the product. This must be a value between 1 an 10. | optional | 1 |
{maxCount} | The maximum times a product can be requested. | optional | - |
{showPrice} | Show the price of the product to the end user. | optional | false |
{price} | The price of a product. Can be a number with decimals, divided by a comma or point. | optional | - |
Response
Response status
Code | Description |
---|---|
200(OK) | Indicates that the operation was successful and the resource is created. |
400(BAD REQUEST) | Indicates that the operation was not successful. The content type was incorrect or the request body was malformed. |
401(UNAUTHORIZED) | Indicates that no authentication header was given or the api key and secret were invalid. If the api key and secret were valid check the configuration in your portal, it is possibilty these were IP restricted or are disabled. |
409(CONFLICT) | Indicates that the operation was not successful. If there were validation errors, the response will include an error result. |
Please also see error result.
Please also see common HTTP status codes.
Sample response body
[
{
"actions": [
{
"actionGUID": "34e79fc9-9fd6-439d-b106-088a552534a0",
"name": "Custom PowerShell script",
"options": 1,
"objectGUID": "aada90fd-88b3-4b1a-9350-a42e67c69a2d",
"executeOnState": 5,
"automationStoreTaskId": "4d20769f-80f1-48f6-acd1-33e642aa211d",
"automationStoreTaskVersion": "1.0.0",
"executionType": "native",
"executionEntry": "powershell-script",
"executionEnvironment": "helloid-agent",
"executionMinimumVersion": "1.1.0",
"variables": [
{
"id": "b8f866fc-564f-4db6-98fe-303508df1113",
"name": "powerShellScript",
"value": "Write-host \"Please enter your name:\"\n$userName = read-host\n\"Hello $userName!\"",
"typeConstraint": "string",
"secure": false,
"isScriptVariable": false
},
{
"id": "bf626780-9d9b-4558-af6b-a4333b8ad3b7",
"name": "powerShellScriptGuid",
"value": null,
"typeConstraint": "string",
"secure": false,
"isScriptVariable": false
},
{
"id": "434e66a9-b62f-44c1-a01b-7bdff33de90e",
"name": "useTemplate",
"value": "false",
"typeConstraint": "boolean",
"secure": false,
"isScriptVariable": false
}]
}],
"selfServiceProductGUID": "de0bec60-7b75-4c97-aecb-2bc30aac4324",
"name": "Test Product",
"description": null,
"managedByUserName": "Administrator",
"category": "Applications",
"code": "20170612EUUPKVJPDD",
"isEnabled": false,
"isAutoApprove": false,
"isAutoDeny": false,
"isCommentable": false,
"Icon": null,
"FaIcon" : "fa-rocket",
"UseFaIcon": true,
"MultipleRequestOption": 1,
"ReminderTimeout": 30,
"OwnershipMaxDurationInMinutes": 90,
"HasTimeLimit": true,
"ManagerCanOverrideDuration": true,
"LimitType": "Fixed",
"hasRiskFactor": true,
"riskFactor": 7,
"maxCount": null,
"showPrice": false,
"price": 50 }
]
Example request with cURL
Replace placeholder values surrounded by {
}
with the actual values.
curl -u {api-key}:{api-secret} -X POST https://{company-name}.helloid.com/api/v1/selfservice/products/batch/ -H "Content-Type:application/json" -d
'[
{
"Name": "TestProduct1",
"Code": "ABCD1234",
"Category": "Applications"
},
{
"Name": "TestProduct2",
"Code": "BCDE2345",
"Category": "Applications"
}
]'