Skip to content

Adding credentials set support demisto rest api #17506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Packs/DemistoRESTAPI/.pack-ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[file:DemistoRESTAPI.yml]
ignore=IN139,DS107,IN145
ignore=IN139,DS107,IN145,IN124

[file:DemistoUploadFileV2.yml]
ignore=SC105
Expand Down
14 changes: 10 additions & 4 deletions Packs/DemistoRESTAPI/Integrations/DemistoRESTAPI/DemistoRESTAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ sendMultipart = function (uri, entryID, body) {
// do nothing, use the body as is in the request.
logDebug('could not parse body as a JSON object, passing as is. body: ' + JSON.stringify(body));
}

var key = [params.apikey? params.apikey : (params.creds_apikey? params.creds_apikey.password : '')];
if (key == ''){
throw 'API Key must be provided.';
}
var res = httpMultipart(
requestUrl,
entryID,
{
Headers: {
'Authorization': [params.apikey],
'Authorization': key,
'Content-Type': ['multipart/form-data'],
'Accept': ['application/json']
},
Expand Down Expand Up @@ -55,15 +58,18 @@ var sendRequest = function(method, uri, body, raw) {
requestUrl += '/';
}
requestUrl += uri;

var key = [params.apikey? params.apikey : (params.creds_apikey? params.creds_apikey.password : '')];
if (key == ''){
throw 'API Key must be provided.';
}
var res = http(
requestUrl,
{
Method: method,
Headers: {
'Accept': ['application/json'],
'content-type': ['application/json'],
'authorization': [params.apikey]
'authorization': key
},
Body: body,
SaveToFile: raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ configuration:
defaultvalue: https://127.0.0.1
type: 0
required: true
- display: Demisto Server API Key
name: apikey
type: 4
required: true
- displaypassword: Demisto Server API Key
name: creds_apikey
type: 9
required: false
hiddenusername: true
- display: Trust any certificate (not secure)
name: insecure
type: 8
required: false
- display: Demisto Server API Key
name: apikey
type: 4
required: false
hidden: true
- display: Use system proxy settings
name: proxy
type: 8
Expand Down
4 changes: 4 additions & 0 deletions Packs/DemistoRESTAPI/ReleaseNotes/1_2_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#### Integrations
##### Demisto REST API
- Enhanced the *API Key* integration parameter to support credentials fetching object.
2 changes: 1 addition & 1 deletion Packs/DemistoRESTAPI/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Demisto REST API",
"description": "Use Demisto REST APIs",
"support": "xsoar",
"currentVersion": "1.2.3",
"currentVersion": "1.2.4",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down