I don't get how to download a created derivative from Forge.
Here is what I get from the "GET :urn/manifest" request:
{
"type": "manifest",
"hasThumbnail": "false",
"status": "success",
"progress": "complete",
"region": "US",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA",
"version": "1.0",
"derivatives": [
{
"name": "Ständer_Y_Oben v1.f3d",
"hasThumbnail": "false",
"status": "success",
"progress": "complete",
"outputType": "obj",
"children": [
{
"guid": "4064073b-a56c-4007-8b87-3cf87c821361",
"type": "resource",
"role": "obj",
"status": "success",
"progress": "complete",
"mime": "application/octet-stream",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/Ständer_Y_Oben v1.obj"
}
]
}
]
So how to form a valid "GET :urn/manifest/:derivativeurn" request with that? The docs say "urn should be The Base64 (URL Safe) encoded design URN" and "derivativeurn should be The URL-encoded URN of the derivatives.".
For me this results in:
https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/manifest/urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/St%C3%A4nder_Y_Oben%20v1.obj
But the result always is the message "The requested derivative is not belongs to the design data.".
So what is wrong? The docs or me?
Regards,
Michael
According to documentation of GET :urn/manifest/:derivativeurn, the derivativeurn should be escaped into a URL safe form since there are some reserved and unsafe keywords ( i.e. :, ., ? and = ) in this parameter. They will invalid your request to the Forge service. (Ref)
Your file urn is:
urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/Ständer_Y_Oben v1.obj
To download this file, you have to transform it into this form: urn%3Aadsk.viewing%3Afs.file%3AdXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA%2Foutput%2Ffiles%2F6f7db9b2-925f-44b3-92e8-a5aeeb3954d2%2FSt%C3%A4nder_Y_Oben%20v1.obj
In JavaScript, the encodeURIComponent()(Ref) function can help you do this transformation. Here is a sample for you:
encodeURIComponent('urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/Ständer_Y_Oben v1.obj')
If you are coding in C#, Uri.EscapeDataString() (Ref) can help you to archive the same goal.
Related
According to Forge API Reference, there is a workflowAttribute available to 'set some custom workflow information'. Its part of the misc object in the Body Structure of the POST request used to submit a job.
I am using the following request:
convertResponse = await axios({
method: "post",
url:
"https://developer.api.autodesk.com/modelderivative/v2/designdata/job",
headers: {
"Content-Type": "application/json",
Authorization: access_token
},
data: JSON.stringify({
input: { urn: url_safe_encoded_urn },
output: {
destination: { region: "us" },
formats: [
{
type: "svf",
views: ["2d", "3d"],
advanced: { generateMasterViews: true }
}
]
},
misc: {
workflow: "designgen-forge",
workflowAttribute: { projectId }
}
})
});
But when the webHook calls my callback function, I see nothing like hookAttribute available in the data:
{
"version": "1.0",
"resourceUrn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3VmZm9say1nZW5kZXNpZ25sb3ZlLWRldi10ZW1wLzkxZjhhNGZmLTM5NTYtNGM5Yi05NzkyLThiMWMxNDQyZGJkNyUyRnJldml0LTkxZjhhNGZmLTM5NTYtNGM5Yi05NzkyLThiMWMxNDQyZGJkNy5ydnQ",
"hook": {
"hookId": "6d770063-d5dc-4c66-8ed8-e84207ade07d",
"tenant": "designgen-forge",
"callbackUrl": "https://bigchief.ngrok.io/dev/workitemcomplete",
"createdBy": "9DqOEPqAd4ZZYQ2MAxuT2VQwMfAJrBGp",
"event": "extraction.updated",
"createdDate": "2020-10-20T20:14:31.874+0000",
"system": "derivative",
"creatorType": "Application",
"status": "active",
"scope": {
"workflow": "designgen-forge"
},
"urn": "urn:adsk.webhooks:events.hook:6d770063-d5dc-4c66-8ed8-e84207ade07d",
"__self__": "/systems/derivative/events/extraction.updated/hooks/6d770063-d5dc-4c66-8ed8-e84207ade07d"
},
"payload": {
"TimeStamp": 1603289180515,
"Env": "production",
"URN": "<my urn>",
"EventType": "UPDATED",
"Payload": {
"status": "inprogress",
"bubble": {
"guid": "<my guid>",
"owner": "<my guid>",
"hasThumbnail": "true",
"startedAt": "Wed Oct 21 14:05:39 UTC 2020",
"type": "design",
"urn": "<my urn>",
"success": "75%",
"progress": "50% complete",
"region": "US",
"status": "inprogress",
"children": []
},
"scope": "fd2d74bb-1d5a-407c-a344-20dffa327504",
"registerKey": []
}
}
}
I would imagine that is the intent of the workflowAttribute object to populate something in the callback data, otherwise, whats the point. Am I not specifying it correctly? Or is this not implemented? If not, webhooks become nearly unusable, I suppose the alternative is to make and destroy a webhook for each request, which is so ugly its not really a solution.
Thank you for bringing this to our attention. We could reproduce the issue as well - i.e. that the content of the workflowAttribute provided in the body of POST job request will not show up in the webhook callback.
It's being looked into, and I hope it will work soon, but I cannot yet provide a deadline for that.
In the meantime, the workaround could be either:
a) keep track of the extra data (in your case projectId) associated with the urn of the given file on the server or in a database (you might already be using one)
b) create separate webhooks, as you suggested, with different id for the "scope" -> "workflow" parameter and provide the data as the "hookAttribute" - that will show up in the callback
Update on 2020-12-14: it's working now - see https://forge.autodesk.com/blog/custom-data-translation-webhook
I'm trying to send new users / new customres of my WooCommerce store into the rental management app current-rms.com as new Organisations / new contacts. Since Current RMS does not have a native Zap, I am trying to use the generic Webhook zap that Zapier maintains.
Specifically, I'd like to see the sent JSON body in Zapier posts that I make during the setup and testing of the Zap after clicking "Make a Zap!". The Task History is not detailed enough nor does it show hits during test and setup, since it's not live yet.
My trigger is a WooCommerce New Customer. This is working with Zapier WooCommerce Plugin and webhooks OK.
My action is the generic Zapier "Webhooks" Zap. The label "instant" appears next to it in the list at /app/zaps and it is "off".
One version uses JSON PAYLOAD as the action.
Another version uses CUSTOM PAYLOAD as the action.
Wrap request in array is YES.
Unflatten is YES.
My API key and subdomain are in the app URL as query strings and working OK.
When I hit test I get:
We had trouble sending your test through.
The app returned "Invalid JSON - missing or invalid entry for 'member'". This usually happens when your Zap is missing a required field or a field value isn't in a recognized format.
We made a request to api.current-rms.com and received (400) Bad Request.
Official docs are at: https://api.current-rms.com/doc#members-members-post
Logging available at Current RMS side
Part of the authentication of Current RMS involves knowing the domain of the account you are trying to access, in my case its therockfactory due to it being an account for my company https://therockfactory.net/
https://api.current-rms.com/api/v1/members?apikey=APIKEYCENSORED&subdomain=therockfactory
which returns the following when I use the correct API key:
{"webhook_logs":[],"meta":{"total_row_count":0,"row_count":0,"page":1,"per_page":20}}
Maybe if I could see the actual hit that Zapier is posting to Current I could wrap my confused brain around it better? What me worry.
The hit should look somewhat similar to this example, but I've not been able to locate it so far... (in Zapier)
Headers
Content-Type: application/json
Body
{
"member": {
"name": "Chris Bralton",
"description": "Pictures and leaned back was strewn at one would rather more. People don't want of his own means of one hand! Unless it from our pioneer has he fallen tree but that ever stronger and a. Hid among us against the full of verdure through by my eyes.",
"active": true,
"bookable": false,
"location_type": 0,
"locale": "en-GB",
"membership_type": "Contact",
"lawful_basis_type_id": 10001,
"sale_tax_class_id": 1,
"purchase_tax_class_id": 1,
"tag_list": [
"[\"Red\", \"Blue\", \"Green\"]"
],
"custom_fields": {},
"membership": {},
"primary_address": {
"name": "Chris Branson",
"street": "16 The Triangle",
"postcode": "NG2 1AE",
"city": "Nottingham",
"county": "Nottinghamshire",
"country_id": "1",
"country_name": "United Kingdom",
"type_id": 3001,
"address_type_name": "Primary",
"created_at": "2015-06-29T10:00:00.000Z",
"updated_at": "2015-06-29T10:30:00.000Z"
},
"emails": [
{
"address": "abigail.parker#ggmail.co.uk",
"type_id": 4001,
"email_type_name": "Work",
"id": 1
}
],
"phones": [
{
"number": "+44 115 9793399",
"type_id": 6001,
"phone_type_name": "Work",
"id": 1
}
],
"links": [
{
"address": "www.facebook.com/profile.php?id=566828251",
"type_id": 5002,
"link_type_name": "Facebook",
"id": 1
}
],
"addresses": [
{
"name": "Chris Branson",
"street": "16 The Triangle",
"postcode": "NG2 1AE",
"city": "Nottingham",
"county": "Nottinghamshire",
"country_id": "1",
"country_name": "United Kingdom",
"type_id": 3002,
"address_type_name": "Billing",
"created_at": "2017-06-29T10:00:00.000Z",
"updated_at": "2017-06-29T10:30:00.000Z",
"id": 1
}
],
"service_stock_levels": [
{
"item_id": 10,
"store_id": 1,
"member_id": 1,
"asset_number": "Chris Bralton",
"serial_number": "",
"location": "",
"stock_type": 3,
"stock_category": 60,
"quantity_held": "1.0",
"quantity_allocated": "0.0",
"quantity_unavailable": "0.0",
"quantity_on_order": "0.0",
"starts_at": "",
"ends_at": "",
"icon": {
"iconable_id": 85,
"id": 1,
"image_file_name": "abigail.jpeg",
"url": "https://s3.amazonaws.com/current-rms-development/64a0ccd0-5fbd-012f-2201-60f847290680/icons/46/original/abigail.jpeg",
"thumb_url": "https://s3.amazonaws.com/current-rms-development/64a0ccd0-5fbd-012f-2201-60f847290680/icons/46/thumb/abigail.jpeg",
"created_at": "2015-06-29T10:00:00.000Z",
"updated_at": "2015-06-29T10:30:00.000Z",
"iconable_type": "StockLevel"
},
"custom_fields": {},
"id": 487,
"item_name": "Sound Engineer",
"store_name": "Nottingham",
"stock_type_name": "Service",
"stock_category_name": "Resource"
}
],
"day_cost": "",
"hour_cost": "",
"distance_cost": "",
"flat_rate_cost": "",
"icon": {
"image": ""
},
"child_members": [
{
"relatable_id": 317,
"relatable_type": "Member",
"related_id": 25,
"related_type": "Member"
}
],
"parent_members": [
{
"relatable_id": 317,
"relatable_type": "Member",
"related_id": 25,
"related_type": "Member"
}
]
}
}
UPDATE: After reading my chosen answer I was able to see what Zapier was sending:
[
{
"member[emails_attributes][0][address]": "test#test.co.nz",
"member[membership_type]": "Organisation",
"member[name]": "Testafari Testing"
}
]
You can send your webhook to a tool like this one to inspect the payloads that are being sent from anywhere on the internet: https://requestbin.com/
You can find more help in regards to using Webhooks by Zapier and other ideas on how you can troubleshoot issues stemming from its use: https://zapier.com/apps/webhook/help#inspect-the-requests
I am running a small experiment to crowd source images from users to build mesh models of interiors. I have been working with the ReCap API and it throws me a progress error when I try it with 160 images. My steps are with 40,80,120 and then 160 images. It worked alright for the first three sets.
Is this something to do with the engine itself? My fundamental procedure is the same.
I have encountered similar errors before when the mesh can not be reconstructed properly by the ReCap engine and it does not throw back an error code.
{
"Usage": "0.64602208137512",
"Resource": "/photoscene/nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg/progress",
"Photoscene": {
"photosceneid": "nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg",
"progressmsg": "ERROR",
"progress": "100"
}
}
And here are the details of the processed photoscene:
{
"Usage": "0.6743381023407",
"Resource": "/photoscene/nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg/properties",
"next_token": {},
"Photoscenes": {
"Photoscene": {
"photosceneid": "nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg",
"itemName": "nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg",
"workerID": "3.0.0|10.64.128.165|D:\\stratos-worker\\src",
"clientID": "BfKCfeWsfoeU8cnAz8qehKNbQzFZtD7y",
"clientStatus": "SENT",
"workerStatus": "ERROR",
"type": "all",
"userID": "IR9sKbyo5tJVcovRLItxGZBQ43LFGwC1R5r19WkE6wQ=",
"nbShots": "000161",
"sendEmail": "true",
"inFilename": "3.0.0/IN/Mb9NMJTN5Pbeba5vJ4viOooSP4tPDNGFSa1gXe5jtoE=/nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg-IN.3dp",
"convertStatus": "ERROR",
"projectID": "nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg",
"engineVersion": "3.0.0.3104",
"convertFormat": "obj,rcm",
"userAgent": "PF_APIv3.2.412-Photofly-WebAPI-FORGE",
"KPStatus": "ERROR",
"creationDate": "2019-05-08T15:21:13",
"name": "P4_Unguided_01",
"outFilename": "3.0.0/OUT/810ddyYgIdPmZE8VUph1DvDmHdY12FgknQaiks1VdV0=-nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg/100000000/P4_Unguided_01.3dp",
"translationScope": "error",
"Queue_messageID": "ca0a5998-be6f-435e-a5b1-6ad70cd5e6a6",
"Queue_message": "STITCH nsyAf7qWc2QDwa1Brpq37YkXc3t8k1dNyrp5uYSGhCg 2.0 3.0.0.3104 0",
"Queue_date": "2019-05-08T15:54:30+00:00",
"maxResolutionForImage": "100000000",
"Queue_name": "forge-bigOnAWSphotoflyqueue-calib",
"UseTitanTextureEngine": "1",
"workerType": "g3.8xlarge",
"scenetype": "object",
"processingtime": "1692.273",
"progress": "100",
"worker_version": "2.0",
"aws_hourly_rate": "2.156000",
"instanceID": "i-0eeac8cca7a8087ab",
"version_worker": "0.5.0.248",
"version_engine": "19.4.3.43",
"worker_temp": "D:\\Temp",
"purchase_option": "spot",
"status": "ERROR",
}
All the files are uploaded, not pasting all the files due to body sizing limit on code snippet.
Background
When I use Outlook client to send a mail with inline image.
The image in html email looks like this, which has cid:
<img size="100" src="cid:3bb599fc-f3eb-465b-af83-aa6a495f563a" style="max-width:100%">
When I use
GET /me/messages/{messageId}/attachments
The contentId in the result returned matched the cid in html.
{
"value": [
{
"#odata.type": "#microsoft.graph.fileAttachment",
"id": "aaa",
"lastModifiedDateTime": "2017-11-30T09:32:09Z",
"name": "image.png",
"contentType": "image/png",
"size": 100,
"isInline": true,
"contentId": "3bb599fc-f3eb-465b-af83-aa6a495f563a",
"contentLocation": null,
"contentBytes": "validBase64Bytes"
}
]
}
Using Microsoft Graph API
Now I am trying to use Microsoft Graph API to add inline image.
POST /me/messages/{messageId}/attachments
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "1.jpg",
"isInline": true,
"contentBytes": "validBase64Bytes"
}
However, the contentId is null in the result returned.
{
"#odata.type": "#microsoft.graph.fileAttachment",
"id": "aaa",
"lastModifiedDateTime": "2017-11-30T09:35:50Z",
"name": "1.jpg",
"contentType": "image/jpeg",
"size": 100,
"isInline": true,
"contentId": null,
"contentLocation": null,
"contentBytes": "validBase64Bytes"
}
And if I set contentId manually in POST
POST /me/messages/{messageId}/attachments
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "1.jpg",
"isInline": true,
"contentId": "myContentId",
"contentBytes": "validBase64Bytes"
}
It will return the error
{
"error": {
"code": "BadRequest",
"message": "Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.",
"innerError": {
"request-id": "36e95f0a-ad75-46c6-b86c-d585a150b96d",
"date": "2017-11-30T09:37:41"
}
}
}
So how to add inline image correctly?
Weird, I tried to run the exact same code again, it won't give me any error now.
POST /me/messages/{messageId}/attachments
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "1.jpg",
"isInline": true,
"contentId": "myContentId",
"contentBytes": "validBase64Bytes"
}
Not sure whether it is a temporary issue. I will inform Microsoft team to check the log.
If I am wrong for how to use the API, please definitely point out. Thanks.
I will leave it here for future people to save some time to implement adding inline image.
I'm tried to use this PATCH Api to rename item of "A360".
It returns 200 with DisplayName updated, but on myhub.autodesk360.com the item seems rendered with "Name" property of json object "Included".
this is the request body :
{
"jsonApi": {
"version": "1.0"
},
"data": {
"id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
"type": "items",
"attributes": {
"displayName": "new_item",
"name" : "new_item"
}
}
this is the response :
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
"attributes": {
"displayName": "new_item",
"createTime": "2017-10-25T09:04:35.0000000Z",
"createUserId": "QY23PAJ2YB4G",
"createUserName": "bot#autodesk360.com",
"lastModifiedTime": "2017-11-30T09:00:46.0000000Z",
"lastModifiedUserId": "AYLNNU3UK324",
"lastModifiedUserName": "Giuseppe Signorelli",
"hidden": false,
"extension": {
"type": "items:autodesk.core:File",
"version": "1.0",
"schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.core:File-1.0"},
"data": {}
}
}
and object included :
"included": [ {
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.tMqu2aQEToa3XsRmKzTTRg?version=2",
"attributes": {
"name": "House Design.rvt",
"displayName": "House Design.rvt",
"createTime": "2017-11-09T16:50:30.0000000Z",
"createUserId": "AYLNNU3UK324",
"createUserName": "gsignorelli#tierratelematics.com",
"lastModifiedTime": "2017-11-09T16:50:34.0000000Z",
"lastModifiedUserId": "",
"lastModifiedUserName": "",
"versionNumber": 2,
"mimeType": "application/vnd.autodesk.revit",
"storageSize": 12550144,
"fileType": "rvt",
"extension": {
"type": "versions:autodesk.core:File",
"version": "1.0",
"schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.core:File-1.0"},
"data": {}
}
}
I expected that on my client show same result that A360 shows.
If I understand correctly, you are trying to use PATCH API to rename the item name of BIM360 Docs, right? As far as I know, currently, PATCH APIs are only working on A360, they are not currently supported or encouraged for BIM 360 Docs. There might be a chance that allows for a folder rename, but it does not properly update the Docs database. So we do not recommend to use that APIs for BIM 360 Docs, and if you want to change a file name, I suggest you to upload a new version instead.
If you want to update the file name in A360, you should use PATCH API to a version, not an item. Here is what I tried, and the name of the file version is updated correctly:
PATCH API to update the name of the version, the trick thing is that you need to URL encode the version id in the endpoint, you can use any tools like https://meyerweb.com/eric/tools/dencoder/ to do that. This is different as the PATCH API to item.
Once you get the 200 status, your file name should be updated correctly in A360 as shown in the following picture: