Exporter filesystem does not display content

So I do it strictly according to this instruction, and after downloading the file I get the following answer

{

“pulp_href”: “/pulp/api/v3/content/file/files/01939274-b4c2-79f9-8d5c-b574ec8670d1/”,
“prn”: “prn:file.filecontent:01939274-b4c2-79f9-8d5c-b574ec8670d1”,
“pulp_created”: “2024-12-04T16:15:42.277146Z”,
“pulp_last_updated”: “2024-12-04T16:15:42.277173Z”,
“artifact”: “/pulp/api/v3/artifacts/01939274-b1fc-7fbd-95c9-11345a55df05/”,
“relative_path”: “pulp.zip”,
“md5”: null,
“sha1”: null,
“sha224”: “4c035f8d156c3efae07e2356d45ce3eb8eabf279909bceaa9cbfd369”,
“sha256”: “5f70f1228c486d4a871163a97d5bfd76bdc988837410f0ae120bad718644b27e”,
“sha384”: “d5306f4b6de4756c179a4384bc3a53acc9e59e24e5c1050c7b0962d0a4250855ec47038406cfb717d011bfd526a2da4d”,
“sha512”: “39b51df1797ad9597e3fa7d347873c3ab1a503a04f0686d98c8aabaeb1c431a098ddcbc88c223611ac03a0ad1d68f8da57e582c81eb256b6dc496e1c6aa571e9”
}

1 Like

The question of how to upload a file via the API without using the CLI is still open

do I need to transfer the file itself in the request body?

I would recommend using httpie (pip install httpie).
http $HOST/pulp/api/v3/content/file/files/ relative_path=foo.bar repository=$REPOSITORY_HREF file@foo.bar --form

with curl:
curl -F "relative_path=foo.bar" -F "repository=$REPOSITORY_HREF" -F "file=@foo.bar" $HOST/pulp/api/v3/content/file/files/

Also if the files are on a remote server instead of downloading and uploading them one by one you can try to sync the files by creating a PULP_MANIFEST on the server, we have a tool to create them here. Else you can use the file_url field on content upload and this will get Pulp to download the artifact from the supplied url. Of course this all assumes that the Pulp server can reach your remote server.

3 Likes
I figured it out after all! below I publish the correct solution for uploading a file via the API   
files = {'file': open('/opt/trash/file_to_upload', 'rb')}
data = {
    "repository": url_file_repo,
    "relative_path":"path_to_file_distribs",
    "file":"/opt/trash/file_to_upload",
}
res = requests.post(f'{path_upload_api_url}',files=files, auth=(f'{username}', f'{password}'), data=data)
print(res.text, res)

Thank you all for your time!

2 Likes