I have created users using CreateOrUpdateUser() method but i was unable to fetch all the users from zendesk. I am getting null for "oListUser" also I tried to fetch user list for Organization but for that also i am getting null.Any help would be appreciated. There is no issue with the connection.
Code:
ZenDeskApi.ZenDeskApi oZen = new ZenDeskApi.ZenDeskApi("https://waresolution.zendesk.com", "j#se.com", "87ggh76IO");
List<User> oListUser = oZen.GetUsers();
User oUsers = new ZenDeskApi.Model.User();
oUsers.Email = "r#se.com";
oUsers.IsVerified = true;
oUsers.Name = "R r";
oUsers..........// Other properties
int a = oZen.CreateOrUpdateUser(oUsers);
List<Organization> oOrg = oZen.GetOgranizations();
foreach (var orgItem in oOrg)
{
int orgId = orgItem.Id;
}
Take a look at this zendesk api client for C#.net on Github. See the JUSTEAT blog for more details. You can use this client to get all users like this:
Create a client:
IZendeskClient client = new ZendeskClient(
new Uri("my-zendesk-api-host-endpoint"),
"my-zendesk-username",
"my-zendesk-token"
);
Then you can use the Search resource to search all users:
var result = client.Search.Find(new ZendeskQuery<User>().WithCustomFilter("y", "x"));
You can download the code as a Nuget here
I am using ZendeskApi_v2 and I am able to get all the users using api as follows:
var userList = api.Users.GetAllUsers();
Here userList is GroupUserReponse.I doubt whether we have any method GetUsers().Atleast its not available in the version which I am using.Once you get the response you can iterate through it.
I see that this question is related to ZenDeskApi which is available at this location:
https://github.com/eneifert/ZenDeskApi.
Sorry,I have not worked on it and tried this.
Not sure if you got a response to this but for anyone else looking for info on the API:
Try instead of:
ZenDeskApi.ZenDeskApi oZen = new ZenDeskApi.ZenDeskApi("https://waresolution.zendesk.com", "j#se.com", "87ggh76IO");
ZenDeskApi.ZenDeskApi oZen = new ZenDeskApi("https://waresolution.zendesk.com", "j#se.com", "87ggh76IO");
Also, to get a paginated list of 100 users instead of the group response, just call:
var zendeskUsers = oZen.Users.GetAllUsers().Users;
Related
Im trying to get a VendorPayment object internal id by having its external id.
Maybe someone did such a search? the API seems to be very verbose..
help would be appreciated.
If you have the externalId, you don’t need to do a search. You can use the get operation by creating a RecordRef that references the externalId.
Making tests about this i get this code, i give to you this example(in PHP) of searching items by internal id maybe helps someone.
$item_id = new RecordRef();
$item_id->internalId = $by_item;
$rec = new SearchMultiSelectField();
$rec->operator = SearchMultiSelectFieldOperator::anyOf;
$rec->searchValue = $item_id;
$itemSearchBasic->internalId = $rec;
$itemSearchBasic = new ItemSearchBasic();
$itemSearchBasic->type = $itemTypeFld;
$itemSearch = new ItemSearch();
$itemSearch->basic = $condition;
$search_field = new ItemSearchAdvanced();
$search_field->criteria = $itemSearch;
$request = new SearchRequest();
$request->searchRecord = $search_field;
And then you use your Netsuite Client to execute the search.
I am trying to create a Job using the C# api and the DataLakeAnalyticsJobManagementClient and have been unsuccessful in every attempt with the error message: "Invalid job definition.". There is no other useful information about what is invalid about it. The job is a U-SQL job and I began bey creating it in the azure portal and that worked just fine and ran correctly with no errors.
I am building up the JobInformation and JobProperties using the same information that the portal test one used and I know the U-SQL statements are valid.
JobProperties props = new JobProperties(File.ReadAllText(#"C:\myusqlscript.usql"));
var myId = Guid.NewGuid();
JobInformation jobNfo = new JobInformation("mysamplejob", JobType.USql, props,myId) { DegreeOfParallelism = 1, Priority = 1000};
jobNfo.Validate(); //<--this doesn't throw an exception either
var jobs = await _adlaJobClient.Job.ListAsync("myanalyticsaccountname");
var adlaJob = await _adlaJobClient.Job.CreateAsync("myanalyticsaccountname", myId, jobNfo);
I have tried various combinations of constructors and property settings including just using defaults for some of the properties and I get the same result: "Invalid job definition." There is no other info that would indicate missing information or formatting issues or anything like that.
Anyone out there created Azure Data Lake Analytics jobs with the C# API?
Anyone out there created Azure Data Lake Analytics jobs with the C# API?
You need to use USqlJobProperties instead of JobProperties.
var props = new USqlJobProperties(File.ReadAllText(#"C:\myusqlscript.usql"));
The official document for Data Lake analytics get started .NET SDK is not available. But we can also get some useful sample code from the histories of this document.
public static Guid SubmitJobByPath(string scriptPath, string jobName)
{
var script = File.ReadAllText(scriptPath);
var jobId = Guid.NewGuid();
var properties = new USqlJobProperties(script);
var parameters = new JobInformation(jobName, JobType.USql, properties, priority: 1, degreeOfParallelism: 1, jobId: jobId);
var jobInfo = _adlaJobClient.Job.Create(_adlaAccountName, jobId, parameters);
return jobId;
}
Using NotificationHubClient I can get all registered devices using GetAllRegistrationsAsync(). But if I do not use the registration model but the installation model instead, how can I get all installations? There are methods to retrieve a specific installation but none to get everything.
You're correct, as of July 2016 there's no way to get all installations for a hub. In the future, the product team is planning to add this feature to the installations model, but it will work in a different way. Instead of making it a runtime operation, you'll provide your storage connection string and you'll get a blob with everything associated with the hub.
Sorry for visiting an old thread... but in theory you could use the GetAllRegistrationsAsyc to get all the installations. I guess this will return everything without an installation id as well, but you could just ignore those if you choose.
Could look something like this
var allRegistrations = await _hub.GetAllRegistrationsAsync(0);
var continuationToken = allRegistrations.ContinuationToken;
var registrationDescriptionsList = new List<RegistrationDescription>(allRegistrations);
while (!string.IsNullOrWhiteSpace(continuationToken))
{
var otherRegistrations = await _hub.GetAllRegistrationsAsync(continuationToken, 0);
registrationDescriptionsList.AddRange(otherRegistrations);
continuationToken = otherRegistrations.ContinuationToken;
}
// Put into DeviceInstallation object
var deviceInstallationList = new List<DeviceInstallation>();
foreach (var registration in registrationDescriptionsList)
{
var deviceInstallation = new DeviceInstallation();
var tags = registration.Tags;
foreach(var tag in tags)
{
if (tag.Contains("InstallationId:"))
{
deviceInstallation.InstallationId = new Guid(tag.Substring(tag.IndexOf(":")+1));
}
}
deviceInstallation.PushHandle = registration.PnsHandle;
deviceInstallation.Tags = new List<string>(registration.Tags);
deviceInstallationList.Add(deviceInstallation);
}
I am not suggesting this to be the cleanest chunk of code written, but it does the trick for us. We only use this for debugging type purposes anyways
We are having an issue with searching a custom record through SuiteTalk. Below is a sample of what we are calling. The issue we are having is in trying to set up the search using the internalId of the record. The issue here lies in in our initial development account the internal id of this custom record is 482 but when we deployed it through the our bundle the record was assigned with the internal Id of 314. It would stand to reason that this internal id is not static in a site per site install so we wondered what property to set up to reference the custom record. When we made the record we assigned its “scriptId’ to be 'customrecord_myCustomRecord' but through suitetalk we do not have a “scriptId”. What is the best way for us to allow for this code to work in all environments and not a specific one? And if so, could you give an example of how it might be used.
Code (C#) that we are attempting to make the call from. We are using the 2013.2 endpoints at this time.
private SearchResult NetSuite_getPackageContentsCustomRecord(string sParentRef)
{
List<object> PackageSearchResults = new List<object>();
CustomRecord custRec = new CustomRecord();
CustomRecordSearch customRecordSearch = new CustomRecordSearch();
SearchMultiSelectCustomField searchFilter1 = new SearchMultiSelectCustomField();
searchFilter1.internalId = "customrecord_myCustomRecord_sublist";
searchFilter1.#operator = SearchMultiSelectFieldOperator.anyOf;
searchFilter1.operatorSpecified = true;
ListOrRecordRef lRecordRef = new ListOrRecordRef();
lRecordRef.internalId = sParentRef;
searchFilter1.searchValue = new ListOrRecordRef[] { lRecordRef };
CustomRecordSearchBasic customRecordBasic = new CustomRecordSearchBasic();
customRecordBasic.recType = new RecordRef();
customRecordBasic.recType.internalId = "314"; // "482"; //THIS LINE IS GIVING US THE TROUBLE
//customRecordBasic.recType.name = "customrecord_myCustomRecord";
customRecordBasic.customFieldList = new SearchCustomField[] { searchFilter1 };
customRecordSearch.basic = customRecordBasic;
// Search for the customer entity
SearchResult results = _service.search(customRecordSearch);
return results;
}
I searched all over for a solution to avoid hardcoding internalId's. Even NetSuite support failed to give me a solution. Finally I stumbled upon a solution in NetSuite's knowledgebase, getCustomizationId.
This returns the internalId, scriptId and name for all customRecord's (or customRecordType's in NetSuite terms! Which is what made it hard to find.)
public string GetCustomizationId(string scriptId)
{
// Perform getCustomizationId on custom record type
CustomizationType ct = new CustomizationType();
ct.getCustomizationTypeSpecified = true;
ct.getCustomizationType = GetCustomizationType.customRecordType;
// Retrieve active custom record type IDs. The includeInactives param is set to false.
GetCustomizationIdResult getCustIdResult = _service.getCustomizationId(ct, false);
foreach (var customizationRef in getCustIdResult.customizationRefList)
{
if (customizationRef.scriptId == scriptId) return customizationRef.internalId;
}
return null;
}
you can make the internalid as an external property so that you can change it according to environment.
The internalId will be changed only when you install first time into an environment. when you deploy it into that environment, the internalid will not change with the future deployments unless you choose Add/Rename option during deployment.
I'm using the Business Objects Web Services SDK to access our Business Objects data. I've successfully got a list of reports, and from that found the LastSuccessfulInstance of a report that has been previously run. However, I can't seem to get the LastRunTime to be populated. When I do a query with no attributes specified it comes back as not set, and I get the same result when I ask for that attribute in particular. I've looked at the report itself and the instance and they both don't have this information. Does anyone know where I can get it from?
Here's my code (hacked from one of SAP's demos):
var sessConnUrl = serviceUrl + "/session";
var boConnection = new BusinessObjects.DSWS.Connection(sessConnUrl);
var boSession = new Session(boConnection);
// Setup the Enterprise Credentials used to login to the Enterprise System
var boEnterpriseCredential = new EnterpriseCredential
{
Domain = cmsname,
Login = username,
Password = password,
AuthType = authType
};
// Login to the Enterprise System and retrieve the SessionInfo
boSession.Login(boEnterpriseCredential);
/************************** DISPLAY INBOX OBJECTS *************************/
// Retrieve the BIPlatform Service so it can be used to add the USER
var biPlatformUrl = boSession.GetAssociatedServicesURL("BIPlatform");
var boBiPlatform = BIPlatform.GetInstance(boSession, biPlatformUrl[0]);
// Specify the query used to retrieve the inbox objects
// NOTE: Adding a "/" at the end of the query indicates that we want to
// retrieve the all the objects located directly under the inbox.
// Without the "/" Path operator, the inbox itself would be returned.
const string query = "path://InfoObjects/Root Folder/Reports/";
// Execute the query and retrieve the reports objects
var boResponseHolder = boBiPlatform.Get(query, null);
var boInfoObjects = boResponseHolder.InfoObjects.InfoObject;
// If the reports contains a list of objects, loop through and display them
if (boInfoObjects != null)
{
// Go through and display the list of documents
foreach (var boInfoObject in boInfoObjects)
{
var report = boInfoObject as Webi;
if (report == null)
continue;
if (!string.IsNullOrEmpty(report.LastSuccessfulInstanceCUID))
{
var instanceQuery = "cuid://<" + report.LastSuccessfulInstanceCUID + ">";
var instanceResponseHolder = boBiPlatform.Get(instanceQuery, null);
var instance = instanceResponseHolder.InfoObjects.InfoObject[0];
}
}
}
Both report.LastRunTimeSpecified and instance.LastRunTimeSpecified are false and both LastRunTime are 01\01\0001, but I can see a last run time in the Web Intelligence UI.
With a little help from Ted Ueda at SAP support I figured it out. Not all the properties are populated by default you need to append #* to the query string to get everything, i.e. change the line:
const string query = "path://InfoObjects/Root Folder/Reports/";
to:
const string query = "path://InfoObjects/Root Folder/Reports/#*";