How to create cognito dataset ? can't find example or explanation anywhere

0

Greetings, I'm trying to create a new dataset for an existing identity in cognito, using php sdk 3, but I can't seem to find any actual explanation or example of how to do this. Not even the API reference seems to have a method to create a new dataset...

In some places it is said that cognito will create a dataset if it doesn't exist... but there is no actual explanation of which method, event or action will trigger this.

I've tried describeDataset and listDatasets but the dataset is not created if it doesn't exist... updateRecords does work, but only if the dataset exists, because I can't get a sync token if there is no dataset in the first place.

I would really appreciate any help or ideas to create a dataset using php, even if it's using the raw API or an AWS CLI command.
Thank you.

pcriado
asked 3 years ago38 views
1 Answer
0

In case anyone wonders, I figured it out after much trial and error. In both the php and nodejs sdks you have to call listRecords() with the new dataset name, retrieve the syncToken from that response, and then call updateRecords() with the new dataset name and the syncToken from the previous call.

This tiny bit of information appears to be missing from all the docs available... extremely unfortunate IMHO...

pcriado
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions