Last active
December 15, 2015 04:09
-
-
Save bobsilverberg/5200021 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uri = "api/v1/product" | |
| user = mozwebqa.credentials['default'] | |
| post_params = { | |
| 'username': user['name'], | |
| 'api_key': user['api_key'], | |
| } | |
| post_data = { | |
| u'name': u'My Test', | |
| u'description': u'My Description', | |
| u'productversions': [ { u'version': u'v1' } ] | |
| } | |
| response = requests.post("%s/%s" % (mozwebqa.base_url, uri), params=post_params, data=post_data) | |
| response.raise_for_status() | |
| text = json.loads(response.text) |
Author
I updated it with that suggestions but am still seeing the same result: Product is not created and a list of 20 products is returned.
oops, i forgot to tell you how to get the id!
id = response.headers['location'].split('/')[-2]
if the product isn't created, then i would expect there to be an error message in response.text
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the reason for that is you can't create a product without the first productversion. (and you should also use unicode)
post_data = {
u'name': u'My Test',
u'description': u'My Description',
u'productversions': [ { u'version': u'v1' } ]
}
the API doc does say productversions is required, but it doesn't provide an example...if i had a great idea how to write an example for it, i would.