Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Collection get overrided #45

Open
swuecho opened this issue May 19, 2016 · 0 comments
Open

Collection get overrided #45

swuecho opened this issue May 19, 2016 · 0 comments

Comments

@swuecho
Copy link

swuecho commented May 19, 2016

# HTTP Client for Python
import requests

# Standard JSON library
import json

# Basic Setup
PORT_NUMBER = 8888
BASE = 'http://localhost:' + str(PORT_NUMBER) + '/v1/'

# Header for posting data to the server as JSON
HEADERS = {'Content-Type': 'application/json'}

# Define dictionary of empty network
empty_network = {
    'data': {
        'name': 'I\'m empty!'
    },
    'elements': {
        'nodes': [],
        'edges': []
    }
}

res = requests.delete(BASE + 'networks', headers=HEADERS)
print(res.text)

res = requests.post(BASE + 'networks?collection=My%20Collection',
                    data=json.dumps(empty_network),
                    headers=HEADERS)
new_network_id = res.json()['networkSUID']
print('Empty network created: SUID = ' + str(new_network_id))

# the only difference between this post request and last one, its the collection name.
res = requests.post(BASE + 'networks?collection=Your%20Collection',
                    data=json.dumps(empty_network),
                    headers=HEADERS)
new_network_id = res.json()['networkSUID']
print('Empty network created: SUID = ' + str(new_network_id))

The second collection name override the first one, so the result is one collection 'Your Collection' with 2 network, instead of 2 collections, each with a network.

change the position of the two post get different result.

I think this is a bug. Could anybody take a look at it? Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant