Project

General

Profile

Actions

Bug #19335

closed

Adding media via the REST API does not correctly associate org/location

Added by James Shewey over 7 years ago. Updated over 7 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When attempting to add Installation Media via the REST API, the location_ids and organization_ids are ignored and not set with the arrays returning empty:

curl -i -k -u admin:example -H "Content-Type: application/json" -X POST -d '{"name":"CentOS", "os_family":"Redhat", "path":"http://mirrors.centos.org/7/os/x86_64", "location_ids":[2], "organization_ids":[1]}' https://localhost/api/media

HTTP/1.1 201 Created
Date: Thu, 20 Apr 2017 17:05:54 GMT
Server: Apache/2.4.6 (CentOS)
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Foreman_version: 1.13.4
Foreman_api_version: 2
Apipie-Checksum: 65f3b03cf7258e6366609106bbcf2e9a
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 0dafaeca-32bf-4efe-beb1-2d5923cedc20
X-Runtime: 0.092155
X-Powered-By: Phusion Passenger 4.0.53
Set-Cookie: request_method=POST; path=/
Set-Cookie: _session_id=57a8066b95c5b6aa50241286a6696122; path=/; secure; HttpOnly
ETag: W/"391dfc43bf76631e346499f473b2cff7"
Status: 201 Created
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{"path":"http://mirrors.centos.org/7/os/x86_64","os_family":"Redhat","created_at":"2017-04-20 17:05:54 UTC","updated_at":"2017-04-20 17:05:54 UTC","id":25,"name":"CentOS","operatingsystems":[],*"locations":[],"organizations":[]}*

I have verified the location and organization IDs are correct.


Related issues 1 (1 open0 closed)

Is duplicate of Foreman - Bug #6991: API v2 - support unwrapped POST/PUT parameters even though it's not documentedNew08/07/2014Actions
Actions

Also available in: Atom PDF