Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post basket #28

Closed
tudorels opened this issue May 18, 2020 · 9 comments
Closed

Post basket #28

tudorels opened this issue May 18, 2020 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@tudorels
Copy link

Hello,

I tried to create a basket, but I only get error:
Could not create basket: Validation failed: An instance of Block has failed the validation:

  • property payload has failed the following constraints: isNotEmptyObject

Thanks

@imRohan
Copy link
Owner

imRohan commented May 18, 2020

Hey @tudorels, it seems like you're trying to create a basket without supplying any object as the payload. Can you please post the request payload of the POST request?

@imRohan imRohan self-assigned this May 18, 2020
@imRohan imRohan added the question Further information is requested label May 18, 2020
@tudorels
Copy link
Author

https://getpantry.cloud/apiv1/pantry/myPantryID/basket/testbasket

like I saw in docs to create a basket

@tudorels
Copy link
Author

tudorels commented May 18, 2020

Is mandatory to insert some data in basket. I can not create an empty basket? Why?

@imRohan
Copy link
Owner

imRohan commented May 18, 2020

Unfortunately yes, a basket cannot be empty. For now, would you be able to work around this limitation? In the meantime, I'll figure out a way to allow users to create empty baskets in their pantry.

@tudorels
Copy link
Author

It's ok for now. I'm also interested in adding new data in basket along with other data already existing in basket, like adding new record in other database system. It is posible? I've seen the other issue and you said it will be posible with put method. It will be very usefull to add new record in basket. Thanks!

@imRohan
Copy link
Owner

imRohan commented May 18, 2020

Ok sounds good! I agree that adding new data to existing baskets is definitely useful, and ill probably go the PUT route. Going to close this issue for now and continue discussions on this issue regarding the new update basket feature.

@imRohan imRohan closed this as completed May 18, 2020
@imRohan
Copy link
Owner

imRohan commented May 19, 2020

@tudorels Just an update, I've added a put route to the API to allow users to add new data to an existing basket, you can check it out it here! Please let me know if this works better for you.

@tudorels
Copy link
Author

Maybe, I don't understand how is working ... I've made a basket "users" and I tried to add some records like this:
{ "username":"tudor", "password":"test1234$"} - this is first user
{"username":"tedi", "password":"test1234$"} -second user added with put
when I query the basket I get only second user. Maybe the basket is not like a collection. You must clarify this, how can we use this in real world. If you want to introduce a new concept nosql database, you must explain the concept and it must be made to easy understand and use. Till now I don't understand how it must work ...and how I can use this service ...
Thank you!

@imRohan
Copy link
Owner

imRohan commented May 19, 2020

@tudorels Theput route allows you to perform a deep merge of objects. It merges the new data you provide with the existing contents of the basket.

For your use-case, perhaps look into structuring your basket with an array of users like so:
{ "users": [ { "username": "user1", "password": "pass123"}, {"username": "user2", "password": "pass234"} ] }

That way you can add new users to your array by sending a put request with the body
{ "users": [ {"username": "user3", "password": "pass345"} ] }

The response of this put call will be an array of 3 users.

Repository owner locked as off-topic and limited conversation to collaborators May 19, 2020
Repository owner unlocked this conversation May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants