how to pass array payload for POST <http://some-ur...
# talk-kratos
f
how to pass array payload for POST http://some-url/self-service/settings?flow=someid ? (i'm using @ory/kratos-client javascript SDK) i'm trying to add multiple emails but it's throwing "Expected array but got object" error.
identity schema for emails field
i tried to pass payload in three ways
1. i'm getting emails fields from nodes in this format with GET http://localhost:4433/self-service/settings/browser , so i tried to pass payload same way
2) I tried to pass Stringified payload for emails but still same error.
3) i just simply passed array of object, this time it's throwing "property tratits is missing" error.
Any help would be greatly appreciated, Thanks
r
@few-orange-16990 you can use the response from the settings flow and look at the structure in which it is returning the fields for your schema and then use that to submit it also.
When you read the flow, you have:
ui.action
and
ui.nodes
and action is the URL to post the update to, and
nodes
contains the structure it "expects" from you to save data. If you name your fields accordingly, it's almost a no-brainer.
And if you don't care about "design" of your forms, you can do it like the ory example apps that spread
ui.nodes
into form elements.
f
@red-machine-69654 i'm getting the structure from nodes like this (from ui.nodes[index].attributes.name and i'm passing the payload in same structure.
github.com/ory/kratos/issues/2374 seems like there's some issue with this endpoint itself.
r
Fun