Project

Profile

Help

Issue #324

closed

200 is not returned if profile does not exist during profile retrieval

Added by ipanova@redhat.com about 9 years ago. Updated about 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Documentation, Pulp 2
Sprint:
Quarter:

Description

http://pulp.readthedocs.org/en/latest/dev-guide/integration/rest-api/consumer/profile.html#retrieve-a-profile-by-content-type

Should be removed:
200 - regardless of whether any profiles exist

And replaced with:

200 - if profile exists

$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"content_type":"mytype", "profile":[]}' "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/"
HTTP/1.1 201 Created
Date: Thu, 26 Feb 2015 13:50:55 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Location: /pulp/api/v2/consumers/myconsumer/profiles/myconsumer/mytype/
Content-Length: 340
Content-Type: application/json

{"profile": [], "_href": "/pulp/api/v2/consumers/myconsumer/profiles/myconsumer/mytype/", "_ns": "consumer_unit_profiles", "profile_hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "consumer_id": "myconsumer", "content_type": "mytype", "_id": {"$oid": "54ef24bf45ef4809c5f6785d"}, "id": "54ef24bf45ef4809c5f6785d"}
[ipanova@ina pulp]$
[ipanova@ina pulp]$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/mytype/"HTTP/1.1 200 OK
Date: Thu, 26 Feb 2015 13:51:05 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 329
Content-Type: application/json

{"profile": [], "_href": "/pulp/api/v2/consumers/myconsumer/profiles/mytype/", "_ns": "consumer_unit_profiles", "profile_hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "consumer_id": "myconsumer", "content_type": "mytype", "_id": {"$oid": "54ef24bf45ef4809c5f6785d"}, "id": "54ef24bf45ef4809c5f6785d"}
[ipanova@ina pulp]$
[ipanova@ina pulp]$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X DELETE -k -u admin:admin "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/mytype/"
HTTP/1.1 200 OK
Date: Thu, 26 Feb 2015 13:51:14 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 4
Content-Type: application/json

null

$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/mytype/"
HTTP/1.1 404 NOT FOUND
Date: Thu, 26 Feb 2015 13:51:16 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 599
Content-Type: application/json

{"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'myconsumer'}", "_href": "/pulp/api/v2/consumers/myconsumer/profiles/mytype/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"profile_id": {"content_type": "mytype", "consumer_id": "myconsumer"}}}, "description": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'myconsumer'}", "sub_errors": []}, "traceback": null, "resources": {"profile_id": {"content_type": "mytype", "consumer_id": "myconsumer"}}}

Also available in: Atom PDF