Help to use Export Cache API

Hello

I’m trying to use the Export Cache API

How am I supposed to proceed ?

Should I call the same export cache API every x seconds until the export is ready?
Should I change the uid on every try?

I do not manage to get the export file from cache.

Here is my code :

STEP 1 : Request the export
Here is the answer :

{"version":"2.11.1","actions":[{"name":"default","title":"Default model","href":"https://sdr7euc1-nocdn.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/default","method":"GET"},{"name":"close","title":"Close session","href":"https://sdr7euc1-nocdn.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/close","method":"POST"},{"name":"export-cache","title":"Get cached export","href":"https://sdr7euc1-nocdn.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/export/cache","template":"export-cache-request","method":"PUT"}],"exports":{"836fbd6cf9934dda83c65fb4a89fa911":{"id":"836fbd6cf9934dda83c65fb4a89fa911","name":"exp_2d_dxf","type":"download","uid":"bfba8e53b6d379a1cc1fda5b86dde63d","dependency":["781867f9-787e-4f99-a2a4-4a3de1abcd0e","964c140b-b468-4b0b-845a-e417fc24c4fa","84add694-6430-4c26-b56e-769384a713dd","af8e1171-d86b-485d-8ccc-927e95aa7e11","69130869-5308-4e6e-b3ee-6c44d25cee94","e4d9fefc-bcac-4e1c-b37e-e4e0c2fac3a7","40be53d7-11ef-4ed3-bdec-44c8fc5e03db","5c030e7b-a0fc-4f67-a363-2432e6827fec","a8db75db-0d64-4336-8453-15d3c6df5837","88bf7b4b-3568-46d0-bc66-14def3bfc0ae","42c2dbb8-1eb6-4a0e-befc-731f00971304","33c9534f-ce52-4784-a29a-f7e06dfc694e","afefe2b4-7712-4b72-ae29-57c94e56a7c7","8a2a1208-80d8-4627-9c00-4c193534958b","fff4fbbb-d91e-48c3-9e31-d66a06a48097","4599e8ad-4395-447b-bd0a-1213af287b8a","343f82c8-12da-4fed-b502-ec524e296fcb","2f73a4b1-85bc-4011-aa71-880a398583e7","5e26890a-d7df-4a0f-813a-a90637637079","f642b00e-2864-4900-b62b-aed4900b3e0f","42b3648c-d88b-452a-82d8-0295b9aeb423","eb8a262e-686e-4d88-8c39-2629ced92aaa","9289df8e-b345-49a8-a3a3-818a94525794","f7fdaf20-b488-43db-a57d-e49e26632307","1aabcd59-4d3c-457a-9839-e8d38b8e631e","8a1c8345-3bc2-41e3-b91e-96fd362aa495","cc0b79f9-b2dd-409c-909a-2cdaf8b60535","824c6d36-2afa-43ab-b85b-65c57a8f97f9","d9477baf-e5d7-4862-8c26-0c87ba9ae70a","02c41cd9-a494-4a48-abe4-f3bdfc842390","7ca57a66-45a9-46b4-acda-91fb63df743d","2194ae93-6012-4be9-90d8-f83f37f8db05","876210b5-aef2-470a-9744-90a498e305cd","2bbf22e3-b10e-4a57-9951-28dff93217a9","82451530-c2ae-4954-a62a-dc4f4feb9930","ba20e3de-3a0a-4665-9bb4-4fbb74c7357a","61d5ad2e-6d90-4d62-a237-ea2fc34c8c64","1a54385d-d8d6-425e-92c7-da9fa69f8fde","aaa234fa-8ae3-42ce-b287-ca309c09d0d6","57a790fc-b7bf-477e-a6c9-3dd63d7e7114","975f307b-c361-443b-a288-678dcf70a2de","82fe8fc0-a712-4412-8136-7b7286000514","05861aad-4d19-4da4-af26-9e7eeb90c3ed","ba9d634e-5af2-43b9-a36e-f48b035e873c","4916e043-a92e-4a58-8322-c2fdf9899449","e83eaee5-60dd-480d-bb4c-11f1ced8d072","06fd8537-46ab-460f-93a6-8155c694683f","77dc225f-66fd-4d4a-a5c3-3df233412601","e9460769-4859-4261-9111-c901cbcf78ca","f6226886-0ce3-46a0-80b0-6592ad22f3d6","24b6da0b-6c55-4b74-ba1a-92866265017b","f5930de8-a30f-4dee-a202-02ef02c7bca6","81a1de93-9510-4dea-ade1-bca5505a135c","02e5cb3d-a39e-4f43-99b2-5a8ef87dd346","fe8511d8-7eda-49cb-8861-c88cafa7b48c","c5959daa-37f0-4f51-bba8-600d8de92f0c","04073776-ed5c-489b-8ba9-8a57212b1c5d","dc2c2fae-c946-439f-8724-9a333213769e","a974b018-8306-4837-8c2e-c14fc3deec37","fc909447-b518-4ee0-a591-bf8c6a6c2f5b","37f9a924-7ac0-4295-87bb-deefd40c1953","65e3c484-a70a-4437-9626-6be3fc1278df","0f2c46de-d747-448f-bd04-0900df3e6863","bc33f8cd-1dd6-4428-8922-d6ce88557c27","b2fc102a-9eb3-448f-8ca7-563b87a3a2a7","21714de9-65d5-40de-988b-69907214433e","63d254f9-c5d5-4b9a-ae68-503568dd53d8"],"group":{"id":"8e24822f-c027-4e66-b032-cb74ab145577","name":"export_2d_dxf"},"version":"da2176d51a58af200e5aefbc48baee87","order":0,"tooltip":"","displayname":"","hidden":false,"delay":5074}},"templates":[{"name":"export-cache-request","title":"Template for export-cache action","data":{"836fbd6cf9934dda83c65fb4a89fa911":"da2176d51a58af200e5aefbc48baee87"}}]}

File is not ready so :
TRY 1 : call export cache API
836fbd6cf9934dda83c65fb4a89fa911 is my exportId
bfba8e53b6d379a1cc1fda5b86dde63d is the uid got from the export API

url : https://sdr7euc1.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/export/cache
body : {"836fbd6cf9934dda83c65fb4a89fa911":"bfba8e53b6d379a1cc1fda5b86dde63d"}

Response :

{"version":"2.11.1","exports":{"836fbd6cf9934dda83c65fb4a89fa911":{"id":"836fbd6cf9934dda83c65fb4a89fa911","name":"exp_2d_dxf","type":"download","uid":"bfba8e53b6d379a1cc1fda5b86dde63d","dependency":["781867f9-787e-4f99-a2a4-4a3de1abcd0e","964c140b-b468-4b0b-845a-e417fc24c4fa","84add694-6430-4c26-b56e-769384a713dd","af8e1171-d86b-485d-8ccc-927e95aa7e11","69130869-5308-4e6e-b3ee-6c44d25cee94","e4d9fefc-bcac-4e1c-b37e-e4e0c2fac3a7","40be53d7-11ef-4ed3-bdec-44c8fc5e03db","5c030e7b-a0fc-4f67-a363-2432e6827fec","a8db75db-0d64-4336-8453-15d3c6df5837","88bf7b4b-3568-46d0-bc66-14def3bfc0ae","42c2dbb8-1eb6-4a0e-befc-731f00971304","33c9534f-ce52-4784-a29a-f7e06dfc694e","afefe2b4-7712-4b72-ae29-57c94e56a7c7","8a2a1208-80d8-4627-9c00-4c193534958b","fff4fbbb-d91e-48c3-9e31-d66a06a48097","4599e8ad-4395-447b-bd0a-1213af287b8a","343f82c8-12da-4fed-b502-ec524e296fcb","2f73a4b1-85bc-4011-aa71-880a398583e7","5e26890a-d7df-4a0f-813a-a90637637079","f642b00e-2864-4900-b62b-aed4900b3e0f","42b3648c-d88b-452a-82d8-0295b9aeb423","eb8a262e-686e-4d88-8c39-2629ced92aaa","9289df8e-b345-49a8-a3a3-818a94525794","f7fdaf20-b488-43db-a57d-e49e26632307","1aabcd59-4d3c-457a-9839-e8d38b8e631e","8a1c8345-3bc2-41e3-b91e-96fd362aa495","cc0b79f9-b2dd-409c-909a-2cdaf8b60535","824c6d36-2afa-43ab-b85b-65c57a8f97f9","d9477baf-e5d7-4862-8c26-0c87ba9ae70a","02c41cd9-a494-4a48-abe4-f3bdfc842390","7ca57a66-45a9-46b4-acda-91fb63df743d","2194ae93-6012-4be9-90d8-f83f37f8db05","876210b5-aef2-470a-9744-90a498e305cd","2bbf22e3-b10e-4a57-9951-28dff93217a9","82451530-c2ae-4954-a62a-dc4f4feb9930","ba20e3de-3a0a-4665-9bb4-4fbb74c7357a","61d5ad2e-6d90-4d62-a237-ea2fc34c8c64","1a54385d-d8d6-425e-92c7-da9fa69f8fde","aaa234fa-8ae3-42ce-b287-ca309c09d0d6","57a790fc-b7bf-477e-a6c9-3dd63d7e7114","975f307b-c361-443b-a288-678dcf70a2de","82fe8fc0-a712-4412-8136-7b7286000514","05861aad-4d19-4da4-af26-9e7eeb90c3ed","ba9d634e-5af2-43b9-a36e-f48b035e873c","4916e043-a92e-4a58-8322-c2fdf9899449","e83eaee5-60dd-480d-bb4c-11f1ced8d072","06fd8537-46ab-460f-93a6-8155c694683f","77dc225f-66fd-4d4a-a5c3-3df233412601","e9460769-4859-4261-9111-c901cbcf78ca","f6226886-0ce3-46a0-80b0-6592ad22f3d6","24b6da0b-6c55-4b74-ba1a-92866265017b","f5930de8-a30f-4dee-a202-02ef02c7bca6","81a1de93-9510-4dea-ade1-bca5505a135c","02e5cb3d-a39e-4f43-99b2-5a8ef87dd346","fe8511d8-7eda-49cb-8861-c88cafa7b48c","c5959daa-37f0-4f51-bba8-600d8de92f0c","04073776-ed5c-489b-8ba9-8a57212b1c5d","dc2c2fae-c946-439f-8724-9a333213769e","a974b018-8306-4837-8c2e-c14fc3deec37","fc909447-b518-4ee0-a591-bf8c6a6c2f5b","37f9a924-7ac0-4295-87bb-deefd40c1953","65e3c484-a70a-4437-9626-6be3fc1278df","0f2c46de-d747-448f-bd04-0900df3e6863","bc33f8cd-1dd6-4428-8922-d6ce88557c27","b2fc102a-9eb3-448f-8ca7-563b87a3a2a7","21714de9-65d5-40de-988b-69907214433e","63d254f9-c5d5-4b9a-ae68-503568dd53d8"],"group":{"id":"8e24822f-c027-4e66-b032-cb74ab145577","name":"export_2d_dxf"},"version":"bfba8e53b6d379a1cc1fda5b86dde63d","order":0,"tooltip":"","displayname":"","hidden":false,"delay":5079}},"actions":[{"name":"export-cache","title":"Get cached export","href":"https://sdr7euc1-nocdn.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/export/cache","template":"export-cache-request","method":"PUT"}],"templates":[{"name":"export-cache-request","title":"Template for export-cache action","data":{"836fbd6cf9934dda83c65fb4a89fa911":"bfba8e53b6d379a1cc1fda5b86dde63d"}}]}

Wait for 5 seconds

TRY 2 : call export cache API

url : https://sdr7euc1.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/export/cache
body : {"836fbd6cf9934dda83c65fb4a89fa911":"bfba8e53b6d379a1cc1fda5b86dde63d"}

Response is the same :

{"version":"2.11.1","exports":{"836fbd6cf9934dda83c65fb4a89fa911":{"id":"836fbd6cf9934dda83c65fb4a89fa911","name":"exp_2d_dxf","type":"download","uid":"bfba8e53b6d379a1cc1fda5b86dde63d","dependency":["781867f9-787e-4f99-a2a4-4a3de1abcd0e","964c140b-b468-4b0b-845a-e417fc24c4fa","84add694-6430-4c26-b56e-769384a713dd","af8e1171-d86b-485d-8ccc-927e95aa7e11","69130869-5308-4e6e-b3ee-6c44d25cee94","e4d9fefc-bcac-4e1c-b37e-e4e0c2fac3a7","40be53d7-11ef-4ed3-bdec-44c8fc5e03db","5c030e7b-a0fc-4f67-a363-2432e6827fec","a8db75db-0d64-4336-8453-15d3c6df5837","88bf7b4b-3568-46d0-bc66-14def3bfc0ae","42c2dbb8-1eb6-4a0e-befc-731f00971304","33c9534f-ce52-4784-a29a-f7e06dfc694e","afefe2b4-7712-4b72-ae29-57c94e56a7c7","8a2a1208-80d8-4627-9c00-4c193534958b","fff4fbbb-d91e-48c3-9e31-d66a06a48097","4599e8ad-4395-447b-bd0a-1213af287b8a","343f82c8-12da-4fed-b502-ec524e296fcb","2f73a4b1-85bc-4011-aa71-880a398583e7","5e26890a-d7df-4a0f-813a-a90637637079","f642b00e-2864-4900-b62b-aed4900b3e0f","42b3648c-d88b-452a-82d8-0295b9aeb423","eb8a262e-686e-4d88-8c39-2629ced92aaa","9289df8e-b345-49a8-a3a3-818a94525794","f7fdaf20-b488-43db-a57d-e49e26632307","1aabcd59-4d3c-457a-9839-e8d38b8e631e","8a1c8345-3bc2-41e3-b91e-96fd362aa495","cc0b79f9-b2dd-409c-909a-2cdaf8b60535","824c6d36-2afa-43ab-b85b-65c57a8f97f9","d9477baf-e5d7-4862-8c26-0c87ba9ae70a","02c41cd9-a494-4a48-abe4-f3bdfc842390","7ca57a66-45a9-46b4-acda-91fb63df743d","2194ae93-6012-4be9-90d8-f83f37f8db05","876210b5-aef2-470a-9744-90a498e305cd","2bbf22e3-b10e-4a57-9951-28dff93217a9","82451530-c2ae-4954-a62a-dc4f4feb9930","ba20e3de-3a0a-4665-9bb4-4fbb74c7357a","61d5ad2e-6d90-4d62-a237-ea2fc34c8c64","1a54385d-d8d6-425e-92c7-da9fa69f8fde","aaa234fa-8ae3-42ce-b287-ca309c09d0d6","57a790fc-b7bf-477e-a6c9-3dd63d7e7114","975f307b-c361-443b-a288-678dcf70a2de","82fe8fc0-a712-4412-8136-7b7286000514","05861aad-4d19-4da4-af26-9e7eeb90c3ed","ba9d634e-5af2-43b9-a36e-f48b035e873c","4916e043-a92e-4a58-8322-c2fdf9899449","e83eaee5-60dd-480d-bb4c-11f1ced8d072","06fd8537-46ab-460f-93a6-8155c694683f","77dc225f-66fd-4d4a-a5c3-3df233412601","e9460769-4859-4261-9111-c901cbcf78ca","f6226886-0ce3-46a0-80b0-6592ad22f3d6","24b6da0b-6c55-4b74-ba1a-92866265017b","f5930de8-a30f-4dee-a202-02ef02c7bca6","81a1de93-9510-4dea-ade1-bca5505a135c","02e5cb3d-a39e-4f43-99b2-5a8ef87dd346","fe8511d8-7eda-49cb-8861-c88cafa7b48c","c5959daa-37f0-4f51-bba8-600d8de92f0c","04073776-ed5c-489b-8ba9-8a57212b1c5d","dc2c2fae-c946-439f-8724-9a333213769e","a974b018-8306-4837-8c2e-c14fc3deec37","fc909447-b518-4ee0-a591-bf8c6a6c2f5b","37f9a924-7ac0-4295-87bb-deefd40c1953","65e3c484-a70a-4437-9626-6be3fc1278df","0f2c46de-d747-448f-bd04-0900df3e6863","bc33f8cd-1dd6-4428-8922-d6ce88557c27","b2fc102a-9eb3-448f-8ca7-563b87a3a2a7","21714de9-65d5-40de-988b-69907214433e","63d254f9-c5d5-4b9a-ae68-503568dd53d8"],"group":{"id":"8e24822f-c027-4e66-b032-cb74ab145577","name":"export_2d_dxf"},"version":"bfba8e53b6d379a1cc1fda5b86dde63d","order":0,"tooltip":"","displayname":"","hidden":false,"delay":5079}},"actions":[{"name":"export-cache","title":"Get cached export","href":"https://sdr7euc1-nocdn.eu-central-1.shapediver.com/api/v2/session/0cf89a33-619b-4c59-92da-15d77bd3e3ad/export/cache","template":"export-cache-request","method":"PUT"}],"templates":[{"name":"export-cache-request","title":"Template for export-cache action","data":{"836fbd6cf9934dda83c65fb4a89fa911":"bfba8e53b6d379a1cc1fda5b86dde63d"}}]}

Related thread: API "Get cached Export" - #2 by snabela

@olivia3 please answer the question I asked here. When sending the export request, are you including max_wait_time in your request body? The body should look somehow like this:

{
  "parameters": {
    "YOUR_PARAM_ID_1": "YOUR_PARAM_VALUE_1",
    "YOUR_PARAM_ID_2": "YOUR_PARAM_VALUE_2"
  },
  "exports": {
    "id": "YOUR_EXPORT_ID"
  }
  "max_wait_time": 30000
}

If you receive a delay property (either in response to an export or export cache request), you have to wait and try again.

When sending an export cache request, you have to use the id and the version that you got in reply to the export request.

Hello @snabela

I do Use API directly with a max_wait_time
I work in Zoho CRM and Zoho Creator, not sure to be able to use the SDK inside Zoho.

URL to request the export : https://sdr7euc1.eu-central-1.shapediver.com/api/v2/session/20a0fb43-f82d-4aff-b9c3-2a12b8e0a449/export

Body

{
"max_wait_time":3000,
"exports":{
"id":"836fbd6cf9934dda83c65fb4a89fa911"
},
"parameters":{
"3c451fe0-ebdd-459f-aee8-d88ebc62fe6b":true,
"f642b00e-2864-4900-b62b-aed4900b3e0f":true,
...
}
}

What is the maximum max_wait_time authorized?

Can you detailed this ? : " When sending an export cache request, you have to use the id and the version that you got in reply to the export request."
What should I do with the version?

Thanks

The max_wait_time is capped slightly below one minute, because this is the maximum timeout typically imposed for HTTP requests.

When you request an export, the reply contains a version property. The value of this version depends on the parameter values you used to request the export. You need to use the id of the export and the value of the version property for the body of the export cache request.

Related documentation: Exports on the API

Could you give me an example of the API to call a cached export?
Because this is not clear what to do with the ExportID, uid and version

Thanks!

When making an export cache request, the body must be a directory of export-IDs and version-IDs.

The export-ID of an export is the value of the property id of the export. This is a static property, it does not depend on the parameter values you used to request the export.

The version-ID is the value of the property version that you receive in return to an export request. This is a dynamic property, it depends on the parameter values you used to request the export.

Example request body:

{
  "96ce38f8-e197-416a-b78b-18d8376f5903": "62b3e13f-7b78-4a59-86f9-4a51f83feb21"
}