add validation related api
- Dominant language
- Python
- Stars
- 28
- Forks
- 37
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 9
Description
something like below could be added to the cli api to find bad assets. also see this api change request: https://github.com/dandi/dandi-api/issues/396
for example the code below returns that assets are failing because they are missing a sha256. (https://github.com/dandi/dandi-api/issues/254)
```python
def get_assets(dandiset, baseurl="api"):
url = f"https://{baseurl}.dandiarchive.org/api/dandisets/{dandiset}/versions/draft/assets/"
querystring = {"page_size":"100"}
headers = {"Accept": "application/json"}
resp = requests.request("GET", url, headers=headers, params=querystring).json()
results = resp["results"]
while resp["next"]:
resp = requests.request("GET", resp["next"], headers=headers).json()
results.extend(resp["results"])
assert len(results) == resp["count"]
url = f"https://{baseurl}.dandiarchive.org/api/dandisets/{dandiset}/versions/draft/assets/"
assetmeta = []
for val in results:
resp = requests.request("GET", url + val["asset_id"] + "/validation", headers=headers).json()
resp.update(**{"identifier": val["asset_id"]})
assetmeta.append(resp)
return results, assetmeta
res, vs = get_assets("000003")
vs
[val for val in vs if val["validation_error"]]
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.