Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubles with api #75

Closed
Vindicatory opened this issue Nov 28, 2024 · 7 comments
Closed

Troubles with api #75

Vindicatory opened this issue Nov 28, 2024 · 7 comments
Labels
question Further information is requested

Comments

@Vindicatory
Copy link

Vindicatory commented Nov 28, 2024

Hi, I've tried different variations of
curl -X POST "https://%my repo%/api/extensionquery" with different filter parameters, but always got:

{"results":[{"extensions":[],"resultMetadata":[{"metadataType":"ResultCount","metadataItems":[{"name":"TotalCount","count":0}]}]}]}

Also changed the product.json file like:

"extensionsGallery": {
"serviceUrl": "https://%my repo%/api",
"itemUrl": "https://%my repo%/item"
}

and I don't get any results in vs code Extensions.
Although
curl "https://%my repo%/healthz" and curl "https://%my repo%/files" works well.

@coder-labeler coder-labeler bot added the question Further information is requested label Nov 28, 2024
@code-asher
Copy link
Member

Could be some missing flags on the cURL command, but it is strange that you also get no results in the IDE. Are you sure there are extensions? Here is my experimentation with this. Checking that I have extensions then running the server:

λ tree ./extensions -L 4
./extensions
└── eamodio
    └── gitlens
        └── 2024.11.2511
            ├── [Content_Types].xml
            ├── eamodio.gitlens-2024.11.2511.vsix
            ├── extension
            └── extension.vsixmanifest

5 directories, 3 files
λ ./code-marketplace --extensions-dir ./extensions server
2024-12-02 20:37:28.728 [info]  Started API server  address=127.0.0.1:3001

Running cURL:

λ curl 'http://localhost:3001/api/extensionquery' -H 'Accept: application/json;api-version=3.0-preview.1' --compressed -H 'Content-Type: application/json' --data-raw '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"}],"pageSize":1}],"flags":439}'
{"results":[{"extensions":[{"extensionId":"eamodio.gitlens","extensionName":"gitlens","displayName":"GitLens — Git supercharged","shortDescription":"Supercharge Git within VS Code — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more","publisher":{"displayName":"eamodio","publisherId":"eamodio","publisherName":"eamodio"},"versions":[{"version":"2024.11.2511","lastUpdated":"0001-01-01T00:00:00Z","assetUri":"http://localhost:3001/assets/eamodio/gitlens/2024.11.2511","fallbackAssetUri":"http://localhost:3001/assets/eamodio/gitlens/2024.11.2511","files":[{"assetType":"Microsoft.VisualStudio.Code.Manifest","source":"http://localhost:3001/files/eamodio/gitlens/2024.11.2511/extension/package.json"},{"assetType":"Microsoft.VisualStudio.Services.Content.Details","source":"http://localhost:3001/files/eamodio/gitlens/2024.11.2511/extension/readme.md"},{"assetType":"Microsoft.VisualStudio.Services.Content.Changelog","source":"http://localhost:3001/files/eamodio/gitlens/2024.11.2511/extension/changelog.md"},{"assetType":"Microsoft.VisualStudio.Services.Content.License","source":"http://localhost:3001/files/eamodio/gitlens/2024.11.2511/extension/LICENSE.txt"},{"assetType":"Microsoft.VisualStudio.Services.Icons.Default","source":"http://localhost:3001/files/eamodio/gitlens/2024.11.2511/extension/images/gitlens-icon.png"},{"assetType":"Microsoft.VisualStudio.Services.VSIXPackage","source":"http://localhost:3001/files/eamodio/gitlens/2024.11.2511/eamodio.gitlens-2024.11.2511.vsix"}],"properties":[{"key":"Microsoft.VisualStudio.Code.Engine","value":"^1.82.0"},{"key":"Microsoft.VisualStudio.Code.ExtensionDependencies","value":""},{"key":"Microsoft.VisualStudio.Code.ExtensionPack","value":""},{"key":"Microsoft.VisualStudio.Code.ExtensionKind","value":"workspace,web"},{"key":"Microsoft.VisualStudio.Code.LocalizedLanguages","value":""},{"key":"Microsoft.VisualStudio.Code.EnabledApiProposals","value":""},{"key":"Microsoft.VisualStudio.Code.PreRelease","value":"true"},{"key":"Microsoft.VisualStudio.Code.ExecutesCode","value":"true"},{"key":"Microsoft.VisualStudio.Services.Links.Source","value":"https://github.com/gitkraken/vscode-gitlens.git"},{"key":"Microsoft.VisualStudio.Services.Links.Getstarted","value":"https://github.com/gitkraken/vscode-gitlens.git"},{"key":"Microsoft.VisualStudio.Services.Links.GitHub","value":"https://github.com/gitkraken/vscode-gitlens.git"},{"key":"Microsoft.VisualStudio.Services.Links.Support","value":"https://github.com/gitkraken/vscode-gitlens/issues"},{"key":"Microsoft.VisualStudio.Services.Links.Learn","value":"https://gitkraken.com/gitlens"},{"key":"Microsoft.VisualStudio.Services.Branding.Color","value":"#8647ae"},{"key":"Microsoft.VisualStudio.Services.Branding.Theme","value":"dark"},{"key":"Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown","value":"true"},{"key":"Microsoft.VisualStudio.Services.Content.Pricing","value":"Free"}]}],"statistics":null,"tags":["gitlens","git","blame","log","annotation","multi-root ready","keybindings","__web_extension"],"releaseDate":"0001-01-01T00:00:00Z","publishedDate":"0001-01-01T00:00:00Z","lastUpdated":"0001-01-01T00:00:00Z","categories":["Other","SCM Providers"],"flags":"public"}],"resultMetadata":[{"metadataType":"ResultCount","metadataItems":[{"name":"TotalCount","count":1}]}]}]}

@Vindicatory
Copy link
Author

Oops, wait a minute, didn't know about
├── [Content_Types].xml
├── extension
└── extension.vsixmanifest

Are they all necessary? As far as I know, .vsixmanifest is a format for Visual Studio extensions only.

I only have
./extensions
└── my-extension.vsix

@code-asher
Copy link
Member

code-asher commented Dec 3, 2024

Yes, the manifest is the most important part, VS Code fetches it first directly (the .vsix is not fetched until later).

The other files might not be necessary, it depends on whether the extension is a web extension (web extensions load files directly, they do not read the .vsix), and it also depends on what other things VS Code fetches (I am not sure exactly what all the files they require are, so to be safe we extract them all---for example I believe it loads the icons directly as well).

@code-asher
Copy link
Member

code-asher commented Dec 3, 2024

Also a publisher/extension/version directory structure is required. I recommend using code-marketplace add my-extension.vsix to add extensions, otherwise you have to create the directory structure and extract the files yourself.

@Vindicatory
Copy link
Author

Yes, I made the folder structure and pulled the necessary files from .vsix and everything worked.
Thanks a lot!

@Vindicatory
Copy link
Author

Let me ask you one more question.
Is there a simple way to make extensions are searched for in both my private marketplace and the default VS Code marketplace?

It's just so inconvenient to go into Product.json every time for my colleagues.

@code-asher
Copy link
Member

No, there is no way to do that at the moment. Open issue about it here: #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants