I am trying to create a new Story asset through the V1 API. I am receiving an error:
"Unhandled Exception: VersionOne.SDK.APIClient.ConnectionException: Error writing
to output stream ---> System.Net.WebException: The remote server returned an er
ror: (400) Bad Request. ---> VersionOne.SDK.APIClient.APIException: Violation'Re
quired'AttributeDefinition'Super'Story"
I am setting up my connector and creating the asset like so:
V1Connector connector = V1Connector
.WithInstanceUrl("xxx")
.WithUserAgentHeader("NewApp", "1.0")
.WithAccessToken("xxx")
.UseOAuthEndpoints()
.Build();
IServices services = new Services(connector);
Oid projectId = services.GetOid("Scope:02284");
IAssetType storyType = services.Meta.GetAssetType("Story");
Asset newStory = services.New(storyType, projectId);
IAttributeDefinition nameAttribute = storyType.GetAttributeDefinition("Name");
newStory.SetAttributeValue(nameAttribute, "My New Test Story");
services.Save(newStory);
The error is given on the last line. I've been trying to figure this out for a while and I haven't come up with a solution. Does anybody have suggestions?
Here is a link to the example I am trying to follow: https://community.versionone.com/VersionOne_Connect/Developer_Library/Get_an_SDK/.NET_SDK/Creating_Assets
Violation'Required'AttributeDefinition'Super'Story exception is being thrown because you are attempting to create a Story asset without populating the required field, 'Super'. Someone in your organization made this a required attribute.
See your VersionOne project administrator or populate this attribute with a valid value. In order to determine if there are other required fields, do a meta query and any attributes with the '*' next to it is required. As you can see in this png, Name and Scope are my only required attributes.
When you look at your meta data, you will see that Super is a relation to an Epic.
There are two places that you can learn about VersionOne Metadata
1) http://community.versionone.com/VersionOne_Connect/Developer_Library/Learn_the_API/Meta_API
2) http://YourVersionOneInstance/help/api
btw, a Story meta query url has a shape like this
https://YourVersionOneInstance/meta.v1/Story?xsl=api.xsl
Related
I'm trying to create new Sharepoint document locations in my Dynamics365 (in the cloud) system, and I'm trying to link those to an existing Sharepoint Site (collection), as well as to a custom entity of my own.
I tried to do this:
POST /api/data/v9.2/sharepointdocumentlocations
Accept:application/json
Authorization: Bearer (valid JWT token)
Content-Type:application/json
OData-Version: 4.0
OData-MaxVersion: 4.0
{
"name": "WebDocuments",
"description": "Some useful description",
"sharepointdocumentlocation_parent_sharepointsite#odata.bind" : "sharepointsites(0f66e9e3-5dfc-ec11-82e5-0022489f9669)",
"relativeurl": "site",
"customEntity_SharePointDocumentLocations#odata.bind": "my_customentity(a654d179-ab61-ec11-8f8f-000d3a64d05c)"
}
but no matter what I try, I keep getting errors - mostly along the lines of:
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'sharepointdocumentlocation_parent_sharepointsite' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.
I have been researching and found several blog posts offering help - unfortunately, none of that has helped me solve my issue.
I tried to use various field names:
sharepointdocumentlocation_parent_sharepointsite#odata.bind
ParentLocationOrSite
and quite a few more - yet without any success.
Any ideas? How can I create a new Sharepoint document location in Dynamics365, and set its ParentLocationOrSite and RegardingObjectId properties in the POST request?
The correct syntax for that field should be:
parentsiteorlocation_sharepointsite#odata.bind
as you have another lookup pointing to a custom entity, I suggest to use my tool Dataverse REST Builder to create the Web API requests.
Am new to Elastic search and NEST, I am trying to get connected with my ES server through NEST. My ES Connection initialization looks like below.
ElasticClient client = null;
public void Connect()
{
var local = new Uri("http://192.168.40.95:9200/");
var settings = new ConnectionSettings(local).DisableDirectStreaming();
client = new ElasticClient(settings);
settings.DefaultIndex("gisgcc18q4");
ReadAllData();
}
public void ReadAllData()
{
var x= client.Search<dynamic>(s=> s.MatchAll());
}
The response is attached as image below,
I am Never getting any Hits, or data. Did i made any mistake in my connector, Also please suggest me good tutorials to convert JSOn ES query to NEST as well.
Looking at the Uri in the screenshot
POST /gisgcc18q4/object/_search?typed_keys=true
suggests that you're using a version older than 7, such as 5 or 6, where document types are used. In this case, the document type name "object" has been inferred from the dynamic type passed as the generic parameter argument, but I suspect that documents have not been indexed with a document type name of "object", but something else.
If the index "gisgcc18q4" only contains one type of document, you can use
var x = client.Search<dynamic>(s=> s.MatchAll().AllTypes());
Or you can pass the specific document type name to use
var x = client.Search<dynamic>(s=> s.MatchAll().Type("_doc"));
A good getting started tutorial for the client is the elasticsearch-net-example GitHub repository. It is a walkthrough in building out a ASP.NET Core web application to search Nuget packages.
Your connection looks fine, can you please validate the detailed summary under DebugInfrormation by clicking on it and get the row query and response.
After apply same query on Postman.
Please copy and paste below expression on quick watch window on the same line which is displayed in your screenshot.
((Elasticsearch.Net.ApiCallDetails)response.ApiCall).DebugInformation
You will get the detailed information, it will be helpful for you to investigate this issue.
I am using the Nuget package Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction
I have created a Custom Vision application in the Custom Vision portal and obtained API keys and a project ID.
Whenever I try to make a request to the API, I always get the following exception thrown:
HttpOperationException: Operation returned an invalid status code
'NotFound'
Here is my code:
HttpClient httpClient = new HttpClient();
CustomVisionPredictionClient customVisionPredictionClient = new CustomVisionPredictionClient(httpClient, false)
{
ApiKey = PredictionKey,
Endpoint = PredictionEndpoint,
};
var result = customVisionPredictionClient.PredictImageAsync(CUSTOM_VISION_PROJECT_GUID, imageData);
I have tried several different endpoints:
https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction
https://southcentralus.api.cognitive.microsoft.com/customvision/Prediction/v1.0
https://southcentralus.api.cognitive.microsoft.com/customvision/v1.1/Prediction
though on the portal the listed one is the first of the list. I have also succesfuly exported my app on Azure, which gives me the second endpoint in the list but with no more success.
I have also set a default iteration as suggested in a similar issue that I found ( CustomVision: Operation returned an invalid status code: 'NotFound' ).
I have tried this sample https://github.com/Microsoft/Cognitive-CustomVision-Windows/tree/master/Samples/CustomVision.Sample which uses a deprecated windows client, to at least ensure my project information are correct and I was able to access the API.
Any insight would be appreciated
For the .NET client SDK, you need to specify the base endpoint URL without the version or the rest of the path. The version is automatically added by the client SDK. In other words, you'll want (assuming SouthCentralUS is your region):
PreditionEndpoint = "https://southcentralus.api.cognitive.microsoft.com";
CustomVisionPredictionClient customVisionPredictionClient = new CustomVisionPredictionClient()
{
ApiKey = PredictionKey,
Endpoint = PredictionEndpoint,
};
var result = customVisionPredictionClient.PredictImageAsync(CUSTOM_VISION_PROJECT_GUID, imageData);
As an aside, note that unless you want to fine-tune the behavior, you don't need to pass in an HttpClient object to CustomVisionPredictionClient constructor.
If you need more sample code, please take a look at the QuickStart.
How to use the Prediction API
If you have an image URL:
your endpoint would be something like this
https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction/{Project-GUID}/url?iterationId={Iteration-ID}
Set Prediction-Key Header to : predictionId
Set Content-Type Header to : application/json
Set Body to : {"Url": "https://example.com/image.png"}
Or If you have an image file:
Endpoint would be like
https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction/{ProjectGuid}/image?iterationId={Iteration-Id}
Set Prediction-Key Header to : Predcition-key
Set Content-Type Header to : application/octet-stream
Set Body to : <image file>
Remember, you can mark an iteration as Default so you can send data to it without specifying an iteration id. You can then change which iteration your app is pointing to without having to update your app.
Check my other answer on the similar issue using python
Python custom vision predictor fails
Hope it helps.
As I am on my way to switch from using the legacy header authentication method to the JWT Token method, I have used the following example found here.
However, I get the following error :
Error calling Login: {
"errorCode": "PARTNER_AUTHENTICATION_FAILED",
"message": "The specified Integrator Key was not found or is disabled. An Integrator key was not specified."
}
Below is my C# code.
string oauthBasePath = "account-d.docusign.com";
string privateKeyFilename = "./private.pem";
int expiresInHours = 1;
ApiClient apiClient = new ApiClient(docuSignUrl);
apiClient.ConfigureJwtAuthorizationFlow(
"IntegratorKey",
"USER ID GUID",
oauthBasePath,
privateKeyFilename,
expiresInHours);
AuthenticationApi authApi = new AuthenticationApi(apiClient.Configuration);
return authApi.Login();
I have found this thread that shows the similar error but it doesn't seem resolved
Update 05/07/2018: I have validated the domain used in my account but I still get the same error message
Update 05/11/2018: When I use my code but that I replace the IntegratorKey, UserID and private key used in the DocuSign Unit Tests here, my code now works !? Hence, I can only conclude that the issue doesn't come from my code but maybe a configuration issue on the DocuSign side ? do I need to configure my Integrator Key a specific way ?
After more investigation, the reason with such an error is that I was not generating the Authorization Code Grant prior to executing my code.
Based on the information found here, I had to perform the following HTTPRequest example :
GET /oauth/auth?
response_type=token
&scope=signature
&client_id=YOUR_INTERGRATOR_KEY
&state=a39fh23hnf23
&redirect_uri=http://www.example.com/callback
Once it is approved, then I can run my code successfully.
In the end, the initial error message is really misleading (I might argue it could be considered a bug ?).
I am working on a requirement where I need to create an 'Epic' issue type first and then I need to create a 'Bug' issue type mentioning the Epic name in it.
I am parsing the following data for adding an Epic in JIRA but its giving me an error:
string json = #"{""fields"":{""project"":{""key"":""SITBIT""},""summary"": ""Test Epic"",""description"": ""Test Epic Description"",""issuetype"": {""name"":""Epic""}}}";
The above code is giving me the below error:
The remote server returned an error: (400) Bad Request.
The above JSON code is working fine for normal issue type however its throwing an error if I changed the Issue type to 'EPIC'.
What could be the issue? How can I parse the JSON so that the epic can be added.
Secondly, When I am parsing the already added Epic name in the normal issue type then also it gave me (400) bad request error.
Different issue types can have different required fields. To create an epic you also need to specify the 'Epic Name', but this field is missing in your request.
You can use the JIRA REST API to verify which fields are required using the /rest/api/2/issue/createmeta resource:
The fields that can be set on create, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/createmeta resource. If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field validation error will occur if it is submitted.
The JIRA REST API documentation also contains more info about how errors are handled. You only mention the message that corresponds to the status code of the response, but the response body will contain more info, for example:
{
"errorMessages": [
"Field 'priority' is required"
],
"errors": {}
}