Forge ModelDerivativeAPI: can't convert to obj format - autodesk-forge

I'm trying to convert .nwc file uploaded on my A360 account with ModelDerivativeAPI with this method. While converting to svf and some other formats works for me perfectly I have troubles with converting to obj format. I keep getting the following 400 error:
{
"diagnostic": "Failed to trigger translation for this file." }
Here is the body of my POST request:
{
"input": {
"urn": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjJFZWM1RzZsU1NXMXNnVmFUSW93Zmc_dmVyc2lvbj0x"
},
"output": {
"formats": [
{
"type": "obj"
}
]
}
}
What am I doing wrong?

Try to add the advanced field as follow:
{
"input": {
"urn": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjJFZWM1RzZsU1NXMXNnVmFUSW93Zmc_dmVyc2lvbj0x"
},
"output": {
"formats": [
{
"type": "obj",
"advanced": {
"objectIds": [-1], // -1 means all nodes, otherwise specify an array of valid dbIds
"modelGuid": "ab2fb5b0-9101-0d3e-28c9-e61f9f0c15c5" // Get this one from the GET :urn/metadata call - https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET/
}
}
]
}
}
You can use my sample https://oss.autodesk.io which exposes a UI to help you test and format the payloads:
Hope that helps

Related

Azure CI/CD Json transformation on array

When I'm creating a Task for an Azure DevOps release, can I transform the value of an object in an array, based on the "key" of the object?
As an example, I'm copying the example Json file from this article, which is this.
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Data Source=(LocalDb)\\MSDB;AttachDbFilename=aspcore-local.mdf;"
},
"DebugMode": "enabled",
"DBAccess": {
"Administrators": ["Admin-1", "Admin-2"],
"Users": ["Vendor-1", "vendor-3"]
},
"FeatureFlags": {
"Preview": [
{
"newUI": "AllAccounts"
},
{
"NewWelcomeMessage": "Newusers"
}
]
}
}
}
What I have is something more like this, look at the "FeatureFlags" array. My array contains a list of "key"/"value" objects similar to this. I need to be able to transform the object in the array that matches a key, and have the transform process replace the "value" property value.
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Data Source=(LocalDb)\\MSDB;AttachDbFilename=aspcore-local.mdf;"
},
"DebugMode": "enabled",
"DBAccess": {
"Administrators": ["Admin-1", "Admin-2"],
"Users": ["Vendor-1", "vendor-3"]
},
"FeatureFlags": {
"Preview": [
{
"key": "newUI",
"value": "AllAccounts"
},
{
"key": "NewWelcomeMessage",
"value": "Newusers"
}
]
}
}
}
For example, I want to change the value of "Newusers" in the object with a key of NewWelcomeMessage, to "AllUsers".
In the Azure Release "Variables" tab, can I simply use this as the "Name", Data.FeatureFlags.Preview.NewWelcomeMessage, and AllUsers as the value for it to transform the value for the correct object, or will this fail?
This pattern seems to work with XML, see this.

Insert whole json to the field in Dynamo DB using AWS Step Functions

I am trying to PutItem into the DynamoDB using the AWS Step Functions.
I managed to save Item with simple string fields (S), but one of the fields should store the whole JSON payload. So it should be the Map (M).
But my payload includes nested Maps also.
Example JSON:
{
"firstMap": {
"field": "something",
},
"secondMap": {
"nestedMap": {
"field": "something",
},
"anotherNestedMap": [
{
"field": "something",
"oneMoreNestedMap": {
"andOneMore": {
"field": "something",
},
"arrayComesHere": [
{
"andAgainNestedMap": {
"field": "something",
},
"andAgain": [
{
"field": "something",
"alsoNestedArray": [
{
"field": "something"
}
]
}
]
}
]
},
"letItBeFinalOne": [
{
"field": "something"
}
]
}
]
...
What I want to do is to just say, hey Step Function, insert please this whole JSON into the item field like this
"Item": {
...
"whole_payload": {
"M.$": "$"
},
} ...
But it fails, cause it accepts only one Map to be handled.
So I need to directly iterate over all nested maps and mark them with 'M'.
Is there a way to make it resolve it by itself?
Like in Typescript I can use aws.DynamoDB.DocumentClient() and just put a whole JSON to the field and it resolves all the maps by itself
Came across a thread for similar request to AWS Step functions team. New feature enhanced allows something closer to what you are looking for.
Sample snippet:
...
"Parameters": {
"TableName" : "dynamodb-table",
"Item":{
"requestId" : {
"S.$": "$.requestId"
},
"payload": {
"S.$":"States.JsonToString($)"
}
}
...
AWS Reference

Invalid argument in Google Actions regarding noInputPrompts

I am getting the following error in the Google Actions console and can't seem to work out where I'm going wrong. I've tried to use this link for guidance. If remove the "noInputPrompts" section then the response works as expected.Any ideas please?:
API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: "(expected_inputs[0].input_prompt.no_input_prompts[0]) simpleResponse: Cannot find field." HTTP Status Code: 200.
My response looks like this:
"expectedInputs": [
{
"possibleIntents": [
{
"intent": "actions.intent.TEXT"
}
],
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "test",
"displayText": "test"
}
}
]
},
"noInputPrompts": [
{
"simpleResponse": {
"textToSpeech": "Test",
"displayText": "Test"
}
}
]
}
}

facebook graph explorer returns empty data array using marketing api

I have an issue with the graph explorer when I try to test for insights data.
When I do
act_XXX/?fields=campaigns
It returns
{
"campaigns": {
"data": [
{
"id": "XXXX"
},
{
"id": "XXXX"
}
],
"paging": {
"cursors": {
"before": "MjM4NDI1MTI2NzQ3NzAxMzEZD",
"after": "MjM4NDI1MTI2NzQxNTAxMzEZD"
}
}
},
"id": "act_XXXX"
}
But when I do
act_XXX/insights
I returns an empty data array
{
"data": [
]
}
It looks like I have set the correct permission, but I must be missing something?
probably doesn't have any insight data for previous month as it only fetches last month insights
try using
act_XXX?fields=insights.time_range({"since":"2018-03-03","until":"2019-03-03"})

How to return a subcollection (or object) in json without including all attributes

I am using mongoose as JSON Schema and node.js with it. Need not say, I am new to both. I have been struggling through the day to get this thing work for me but couldn't. Finally, the only solution was to get help from some real nice people out here.
Here is my schema definition -
UserName = {
"properties": {
userURL: {
"description": "URL of this resource",
"type": "string"
},
userName : {
"description": "UserName",
"type": "string",
"required": true
},
}
}
When I make a get call to it, it returns the response in following format -
[
{
"_id": "54c5ede55c82c4bd6abee50a",
"__v": 0,
"properties": {
"userURL": "http://localhost:3000/54c1d6ae441ae900151a6520",
"userName ": "testUser"
}
}
]
Now my requirement is to return the response in following format -
[
{
"_id": "54c5ede55c82c4bd6abee50a",
"userURL": "http://localhost:3000/54c1d6ae441ae900151a6520",
"userName ": "testUser"
}
]
i.e without version and properties tags. I am able to get away with version using following code but properties seems to be tricky thing -
.get(function(request, response) {
UserSchemaModel.find().select('properties.userURL properties.userName').exec (function (err, resObj) {
if (err)
response.send(err);
else{
response.json(resObj);
}
});
});
But it still has properties field :( -
[
{
"_id": "54c5ede55c82c4bd6abee50a",
"properties": {
"userURL": "http://localhost:3000/54c1d6ae441ae900151a6520",
"userName ": "testUser"
}
}
]
I did some google around select as, alias name in select,population in mongoose but no luck.
Kindly suggest. With best Regards.
Just make a new object
response.json(
{
"_id": resObj["_id"],
"userURL": resObj["properties"]["userUrl"],
"userName": resObj["properties"]["userName"]
}
);
Update: Since resObj is an array (as per your comment), you can use Array.prototype.map() to transform them into the right format like so:
response.json( resObj.map(function(o){
return {
"_id": o["_id"],
"userURL": o["properties"]["userUrl"],
"userName": o["properties"]["userName"]
};
})
);
This will return a list of transformed objects that then get passed into the response.json() method.