I am using redmine rest api with c# and I have a problem with custom fields. I have this method:
NameValueCollection parameters = new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.CUSTOM_FIELDS} };
var projectInfo = manager.GetObject<Redmine.Net.Api.Types.Project>("1", parameters);
From that I can get project info but the custom fields are always null. I have one custom field (email) that appears in all new issues and I can get it from issue. I would like to get all custom fields that are in the project.
What am I doing wrong?
Here is the solution if anybody needs it.
NameValueCollection queryParameters = new NameValueCollection { { RedmineKeys.PROJECT_ID, "1" } };
var GetTickets = manager.GetObjects<Redmine.Net.Api.Types.CustomField>(queryParameters);
Just to mention "Project_ID" don't do anything I always get all custom fields in redmine projects. Will try to find out how to get custom fields from specific project.
Related
We need to add service information like officeId for entities.
Or how we can use IntuitAnyType for set and get our service information. I tried to add xmlElement into IntuitAnyType, and then create bill, but when I try to get this bill, IntuitAnyType field (BillEx) was null. Also I tried to add NumberTypeCustomFieldDefinition and got Validation Exception was thrown.Details:Operation Could not find resource for relative : /v3/company/4620816365019493550/numbertypecustomfielddefinition of full path: https://c50.sandbox.qbo.intuit.com/qbo50/v3/company/xxxxxxxxxxx/numbertypecustomfielddefinition?minorversion=29&requestid=a52a148d0f6f4c3ab366f55ca7440525 is not supported..
var dataService = new DataService(_serviceContext);
var officeId= new QBO.NumberTypeCustomFieldDefinition()
{
DefaultValue = 0,
DefaultValueSpecified = true,
Name = "OfficeId",
Hidden = true,
EntityType = QBO.objectNameEnumType.Bill.ToString(),
Required = false
};
var createdCaseIdField = dataService.Add(caseId);
is it possible?
Is there a way to create and update hidden custom field for bill with use api
No. Custom fields can only be created via the UI, and they are visible in the UI.
This is all documented here:
https://developer.intuit.com/app/developer/qbo/docs/develop/tutorials/create-custom-fields#enable-custom-fields
I'm trying to make a targetingIdeaService API call to Google AdWords. This is my code so far:
[HttpGet]
public IEnumerable<string> Get()
{
var user = new AdWordsUser();
using (TargetingIdeaService targetingIdeaService = (TargetingIdeaService)user.GetService(AdWordsService.v201802.TargetingIdeaService))
{
// Create selector.
TargetingIdeaSelector selector = new TargetingIdeaSelector();
selector.requestType = RequestType.IDEAS;
selector.ideaType = IdeaType.KEYWORD;
selector.requestedAttributeTypes = new AttributeType[] {
AttributeType.KEYWORD_TEXT,
AttributeType.SEARCH_VOLUME,
AttributeType.AVERAGE_CPC,
AttributeType.COMPETITION,
AttributeType.CATEGORY_PRODUCTS_AND_SERVICES
};
// Set selector paging (required for targeting idea service).
var paging = Paging.Default;
// Create related to query search parameter.
var relatedToQuerySearchParameter =
new RelatedToQuerySearchParameter
{ queries = new String[] { "bakery", "pastries", "birthday cake" } };
var searchParameters = new List<SearchParameter> { relatedToQuerySearchParameter };
var page = new TargetingIdeaPage();
page = targetingIdeaService.get(selector);
return new string[] { "value1", "value2" };
}
}
it looks ok, compiles at last, and so on. But then I went into debug mode. And I saw this:
So as you can see, the variable doesn't have the access token. The other data comes from app.config file.
I am quite certain the keys passed in are correct.
Then the code throws the famous invalid_grand error. In my case, I believe that's because the access token is not being generated. I'm new to AdWords and ASP.NET, so I probably missed something, but I have no idea what.
I used the
docs,
Code Structure instructions, and
code examples to put it all together.
I had my configuration wrong. I had to recreate all the credentials using incognito window. If you have any issues just open a thread here: https://groups.google.com/forum/#!forum/adwords-api
public ISearchResponse<object> GetById(string id) {
var uri = new Uri("<myendpoint>");
var settings = new ConnectionSettings(uri).DefaultIndex("useraction-*").PrettyJson().DisableDirectStreaming(); //or try _all
var client = new ElasticClient(settings);
var search = new SearchRequest<object>
{
Query = new TermQuery
{
Field = "field",
Value = "example"
}
};
var response = client.Search<object>(search);
return response;
}
I'm having trouble getting NEST to work. When I try to call the query defined above, I get the following error:
System.Exception: If you use a custom contract resolver be sure to subclass from ElasticResolver
at Nest.JsonExtensions.GetConnectionSettings(JsonSerializer serializer) in C:\Users\russ\source\elasticsearch-net-master\src\Nest\CommonAbstractions\Extensions\JsonExtensions.cs
I've searched the internet for mention of this and can't seem to find anything other than the source code. I've pretty much followed the documentation exactly so I don't know what to change.
Does anyone out there know what this error is trying to tell me? I feel like it's an error behind the scenes that I don't have control over.
I'm happy to answer additional questions if people need more info.
Thanks.
Also I don't know where that path is coming from in the exception because I have no user "russ"
I am getting Redmine Issue with parameters.
I tried:
var rmMan = new RedmineManager(RedmineHost, RedmineKey);
rmMan.GetObjectList<Issue>(new NameValueCollection { { "parent_id", "1111" } }).Where(i=>i.Tracker.Name == "MyTrackerName");
How can I overcome this?
I want to get "Issue" object, found in the parameters without specifying Id. For example on the tracker.
GetObjectList wont do any filtering unless you specify the parameters. It will get all objects of type Issue (in your case). Adding the Where clause does the filtering after you've selected everything. I'm not sure that your NameValueCollection using parent_id will do anything either and redmine-net-api has terrible documentation.
Try this:
var parameters = new NameValueCollection
{
{ "parent_id", "1111" },
{ "tracker", "MyTrackerName" },
}
var rmMan = new RedmineManager(RedmineHost, RedmineKey);
var issues = rmMan.GetObjectList<Issue>(parameters);
Again, since the redmine-net-api documentation is very bad, this is kind of a shot in the dark.
I've forked the repository on GitHub and I'm going to try to generate the XMLDoc comments for the library in the next few days. Hopefully it'll get released with the next version.
For a few hours now I've been trying to create a product via the SOAP V2 API with additional attributes. The product is being added whenever I call catalogProductCreate but the additional attributes I send with the request are set empty. Whenever I don't add the additional attributes both attributes are set on their default, so I've figured that the attributes are being send and received but not processed properly? I've tried everything, I've Googled but came up empty.
This is my code: (C#)
catalogProductCreateEntity cpce = new catalogProductCreateEntity();
associativeEntity[] attributes = new associativeEntity[2];
attributes[0] = new associativeEntity();
attributes[0].key = "product_state1";
attributes[0].value = _stateofbox;
attributes[1] = new associativeEntity();
attributes[1].key = "product_state2";
attributes[1].value = _stateofproduct;
catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity();
additionalAttributes.single_data = attributes;
cpce.additional_attributes = additionalAttributes;
Thanks for the help.
Fixed it, I thought I had to set the plaintext/ID (0,1,2,3) of the pre-defined attributes inside the value of associativeEntity. Although, I found out that catalogProductAttributeOptions will tell you what ID your values have. Thus you have to call that method in order to find out what ID's you should use.