[Pulp-list] Make a selection in a GET call

Juan Cabrera juan.cabrera at unamur.be
Fri May 24 09:40:42 UTC 2019


I think I found the answer, name,.version,.release,.arch comes from the
package name.

Is not more easy to find a content HREF looking for the .location_href
instead of .name,.version,.release,.arch ?

http
"$PORT/pulp/api/v3/content/rpm/packages/?name=mailcap&version=2.1.41&release=2.el7&arch=noarch"

I prefer the query version than using jq

http $PORT/pulp/api/v3/content/rpm/packages/ | jq -r '.results[] |
select( .location_href == "mailcap-2.1.41-2.el7.noarch.rpm")'

There could be a limitation when there are to much contents because the
pagination prevents to look for all contents.

Juan

On 24/05/19 11:08, Juan Cabrera wrote:
>
> Hi,
>
> I realized that I can get the href of an artifact selecting its sha512
> in the URI path.
>
> https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/artifacts_list
>
> This simplifies the use of jq as I get directly the good artifact.
>
> [vagrant at dev-pulp-server ~]$ http
> $PORT/pulp/api/v3/artifacts/?sha512=9df10268233e243ef8b6c0fc9fea6452bf81eea8b2627c90d0a652304b5acf05e4996768c68adb4f6d224a369e7f3b6cf77d3fb62b5989bfce3fa94d46ce9ec7
> HTTP/1.1 200 OK
> Allow: GET, POST, HEAD, OPTIONS
> Connection: close
> Content-Length: 745
> Content-Type: application/json
> Date: Fri, 24 May 2019 08:39:23 GMT
> Server: gunicorn/19.9.0
> Vary: Accept, Cookie
> X-Frame-Options: SAMEORIGIN
>
> {
>     "count": 1,
>     "next": null,
>     "previous": null,
>     "results": [
>         {
>             "_created": "2019-05-24T08:08:58.445890Z",
>             "_href":
> "/pulp/api/v3/artifacts/aaefcc88-9bb7-4a70-9e98-19e039b0f95e/",
>             "file":
> "artifact/5b/6b81a0bbe944ab393ea8dea0ab2cf906a1f6fd81ad139efd125d2454752780",
>
>             "md5": "0011ff65d03dde05b4370f7879b4bd0c",
>             "sha1": "db05ead3a760d5906ea5cd9c1e4d713379785b90",
>             "sha224":
> "6b0da4b1ef04d25344d924f8785cc5fd34f7b58554fbcc9e902fb1a3",
>             "sha256":
> "5b6b81a0bbe944ab393ea8dea0ab2cf906a1f6fd81ad139efd125d2454752780",
>             "sha384":
> "8598ba74004db73b0f02bed5bc5ef0313539123986be910fda07187bff926a7d608dcec1815a7a248cd8a218dc53f6ad",
>
>             "sha512":
> "9df10268233e243ef8b6c0fc9fea6452bf81eea8b2627c90d0a652304b5acf05e4996768c68adb4f6d224a369e7f3b6cf77d3fb62b5989bfce3fa94d46ce9ec7",
>
>             "size": 31264
>         }
>     ]
> }
>
> I see in
> https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/content_rpm_packages_list
>
> that there is a possible "name" query.  But to what this query
> corresponds?
>
> [vagrant at dev-pulp-server ~]$ http
> $PORT/pulp/api/v3/content/rpm/packages/?name=mailcap-2.1.41-2.el7.noarch.rpm
>
> HTTP/1.1 200 OK
> Allow: GET, POST, HEAD, OPTIONS
> Connection: close
> Content-Length: 52
> Content-Type: application/json
> Date: Fri, 24 May 2019 09:05:08 GMT
> Server: gunicorn/19.9.0
> Vary: Accept, Cookie
> X-Frame-Options: SAMEORIGIN
>
> {
>     "count": 0,
>     "next": null,
>     "previous": null,
>     "results": []
> }
>
> Sincerely
>
> Juan
>
> -- 
>
> Juan CABRERA
> Correspondant informatique
> Département de Mathématiques
>
> T. 081724919
> juan.cabrera at unamur.be <mailto:juan.cabrera at unamur.be>
> http://staff.unamur.be/jbcabrer
>
> Université de Namur ASBL
> Rue de Bruxelles 61 - 5000 Namur
> Belgique
>
> Let’s respect the environment together.
> Only print this message if necessary!
>
>
> _______________________________________________
> Pulp-list mailing list
> Pulp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-list
-- 

Juan CABRERA
Correspondant informatique
Département de Mathématiques

T. 081724919
juan.cabrera at unamur.be <mailto:juan.cabrera at unamur.be>
http://staff.unamur.be/jbcabrer

Université de Namur ASBL
Rue de Bruxelles 61 - 5000 Namur
Belgique

Let’s respect the environment together.
Only print this message if necessary!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190524/d8adb73f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lofndhpfeinefpce.png
Type: image/png
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190524/d8adb73f/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: npcodcekphkjnald.png
Type: image/png
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190524/d8adb73f/attachment-0001.png>


More information about the Pulp-list mailing list