and more in a single search tool across platforms. Read the announcement here. |
11/20/2022 09:20 PM
Here is payload to get users
curl --location --request POST
'https://demo.sourcegraph.com/.api/graphql' \
--header 'Authorization: token [Token]' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query {\n users(activePeriod:ALL_TIME ) {\n totalCount\n nodes {\n username,\n siteAdmin,\n usageStatistics {\n lastActiveTime\n }\n \t}\n }\n}","variables":{}}'
And here is response.
Can anyone help me how to make JSON for importAccountJSON with REST connector in this case?
Example response
{
"data": {
"users": {
"totalCount":
2,
"nodes": [
{
"username":
"sourcegraph-user 2",
"siteAdmin":
true,
"usageStatistics": {
"lastActiveTime":
"2022-11-15T09:58:55Z"
}
},
{
"username":
"user2",
"siteAdmin":
true,
"usageStatistics": {
"lastActiveTime":
"2022-09-08T18:23:28Z"
}
} ] } } }
Solved! Go to Solution.
11/21/2022 09:15 AM
Share your draft version of json, Looking at response its doable.
11/21/2022 04:38 PM
"httpParam" : {"query":"query {\n users(activePeriod:ALL_TIME ) {\n totalCount\n nodes {\n username,\n siteAdmin,\n usageStatistics {\n lastActiveTime\n }\n \t}\n }\n}","variables":{}}
I am wondering in httpParam part in importAccountJSON. Could you please let me know if I need to add \n or \t for graphQL?
Here is response I can get via Postman
Query I used
11/21/2022 05:18 PM
\n \t you can ignore
click on code option in postman to check how its getting passed in curl url
11/21/2022 09:27 PM
thanks. let me try it
11/21/2022 11:03 PM
This is JSON I configured and I tried to import accounts.
{
"accountParams": {
"connection": "acctAuth",
"createUsers": false,
"processingType": "SequentialAndIterative",
"statusAndThresholdConfig": {
"deleteLinks": true,
"accountThresholdValue": 50,
"correlateInactiveAccounts": false,
"accountsNotInImportAction": "NOACTION",
"inactivateAccountsNotInFile": false,
"deleteAccEntForActiveAccounts": true
},
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"disableDeletedAccounts": true,
"http": {
"url": "url",
"httpMethod": "POST",
"httpHeaders": {
"contentType": "application/json",
"Authorization": "token token",
"Accept": "application/json"
},
"httpParams": {
"query": "query {users(activePeriod:ALL_TIME ) {totalCount nodes {id,username,siteAdmin,usageStatistics {lastActiveTime}}}}"
},
"listField": "data.nodes",
"keyField": "accountID",
"colsToPropsMap": {
"accountID": "id~#~char",
"name": "username~#~char",
"displayName": "username~#~char",
"customproperty1": "siteAdmin~#~char"
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
404,
409,
405,
500
]
}
}
}
}
}
}
I am getting error like below.
11/22/2022 06:25 AM
"httpContentType": "application/json",
11/22/2022 06:39 AM
Thanks. I added it but still get same error.
{
"accountParams": {
"connection": "acctAuth",
"createUsers": false,
"processingType": "SequentialAndIterative",
"statusAndThresholdConfig": {
"deleteLinks": true,
"accountThresholdValue": 50,
"correlateInactiveAccounts": false,
"accountsNotInImportAction": "NOACTION",
"inactivateAccountsNotInFile": false,
"deleteAccEntForActiveAccounts": true
},
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"disableDeletedAccounts": true,
"http": {
"url": "url",
"httpContentType": "application/json",
"httpMethod": "POST",
"httpHeaders": {
"contentType": "application/json",
"Authorization": "token token",
"Accept": "application/json"
},
"httpParams": {
"query": "query {users(activePeriod:ALL_TIME ) {totalCount nodes {id,username,siteAdmin,usageStatistics {lastActiveTime}}}}"
},
"listField": "data.nodes",
"keyField": "accountID",
"colsToPropsMap": {
"accountID": "id~#~char",
"name": "username~#~char",
"displayName": "username~#~char",
"customproperty1": "siteAdmin~#~char"
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
404,
409,
405,
500
]
}
}
}
}
}
}
11/22/2022 06:42 AM
here is error.
java.lang.NullPointerException: Cannot invoke method trim() on null object
at com.saviynt.provisoning.rest.RestProvisioningService.persistAccounts(RestProvisioningService.groovy:4711)
at com.saviynt.provisoning.rest.RestProvisioningService.processAccountsByPagination(RestProvisioningService.groovy:4060)
at com.saviynt.provisoning.rest.RestProvisioningService.processAccounts(RestProvisioningService.groovy:3967)
at com.saviynt.provisoning.rest.RestProvisioningService$_processAccountsFinal_closure11_closure78.doCall(RestProvisioningService.groovy:1634)
at com.saviynt.provisoning.rest.RestProvisioningService$_processAccountsFinal_closure11.doCall(RestProvisioningService.groovy:1630)
at com.saviynt.provisoning.rest.RestProvisioningService.processAccountsFinal(RestProvisioningService.groovy:1629)
at com.saviynt.provisoning.rest.RestProvisioningService.processAccountsFullBySequentialAndIterative(RestProvisioningService.groovy:1591)
at com.saviynt.provisoning.rest.RestProvisioningService.importAccountsFull(RestProvisioningService.groovy:1422)
at com.saviynt.provisoning.rest.RestProvisioningService.doImport(RestProvisioningService.groovy:136)
at com.saviynt.ecm.integration.ExternalConnectionCallService.invokeExternalMethod(ExternalConnectionCallService.groovy:187)
at SapImportJob.execute(SapImportJob.groovy:104)
at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
11/22/2022 07:05 AM
Does connection name is correct ?
"listField": "data.nodes" try "listField": "nodes",
11/22/2022 07:38 AM
it's correct name, also I think I need to add "data.nodes". Here is sample response
11/22/2022 07:46 AM
I tried "data.users.nodes" as well but didn't work.
One thing I found is.. when trying from postman, it is taking around 11 second to get response. would it be matter?
11/22/2022 10:10 AM
that should not matter, are you passing proper Authorization
11/22/2022 01:46 PM
Yes. Even i am trying by hardcoding token in import account json..
Btw, by looking response above,
Whats correct list field would be?
11/22/2022 02:00 PM
here is full response. could you please let me know what would be listfield to get id ?
02/17/2023 08:31 AM
Can you tell what should be the Listfield value in the Accountimport json?
I am facing this issue while configuring the connector.