Extract zip file using CMS API

FSandbox
Participant
Hi,

I have upload zip file in Design Manager using following CMS Source Code API.

Upload Zip file in Desing Manager
[POST] {{baseUrl}}/cms/v3/source-code/published/content/api-test-folder/theme-folder.zip
[FORM-DATA] file: <<select zip file here>>

Above API give response
{
    "id": "/api-test-folder/theme-folder.zip",
    "name": "base.css",
    "folder": false,
    "children": null,
    "updatedAt": 1723639888118,
    "createdAt": 0,
    "archivedAt": null
}


File uploaded successfully and show in design manager also BUT problem is how to extract zip file.
Design manager does not provide any UI option to extract it.

I have try following API but no success.

[1] Extracting a file package

[POST] {{baseUrl}}/cms/v3/source-code/extract/api-test-folder/theme-folder.zip

Above API gives response as "204 No Content".

[2] Extract a zip file

[POST] {{baseUrl}}/cms/v3/source-code/extract/async
[DATA]  {
    "path": "/api-test-folder/theme-folder.zip"
}

Above API give following response.
{
    "id": "100729881",
    "links": {
    }
}

But when check status using status link its give following response.
{
    "status": "CANCELED",
    "startedAt": "2024-08-14T13:12:24.146Z",
    "completedAt": "2024-08-14T13:12:24.146Z"
}

Can someone show me where i am wrong?
Someone suggest me right path to upload zip file in design manager and how to extract it?

Thanks and please do the helpful.
0 Upvotes
3 Replies 3
GiantFocal
Top Contributor | Gold Partner
Top Contributor | Gold Partner

Hi @FSandbox,

 

Could you please clarify why you chose to upload the theme in a zip format?

You can use the hs upload command to upload the directory instead of compressing it. 

 

In your local CLI, you can run:

 

hs upload theme-folder theme-folder

 

It will upload all files and subdirectories.


Best regards,

Abraham Ernesto

Glad I could help.
Solving HubSpot puzzles is what we do.
Ernesto // GiantFocal


Found this answer helpful?
Marking it as the solution helps both the community and me - thanks in advance!
FSandbox
Participant

Hi @GiantFocal,

 

Yes, I know the CLI way but I have plan to build public app and in app requirements i need to upload theme file in Design Manager.

So I need to upload theme file using CMS API but in API document there is not properly explain in depth details and not have properly example to describe it.

 

Thanks.

 

0 Upvotes
huffit
Participant

did you ever resolve this? having the same issue.

0 Upvotes