We loaded our product catalogue into a staging project and now want it in the production project. There's no move call. How do we get the records across?
Moving records from one project to another
Common question, written up by the Supero team.
Linkrev 1
1 answer
Accepted answer
Accepted answer
There's no move. fq_name, parent_type and parent_uuid are fixed after create, so a record can't change project. Copy it instead: read from the source project, create in the target.
- Read with a credential for the source project. A plain list is clamped to the token's project; page
POST /list-bulkwithcursor, and always sendlimit. - Check the target project has the same schemas.
GET /api/v1/projects/{project_uuid}/schemaslists a project's schemas, so compare the two. - Strip
uuid,fq_name,parent_type,parent_uuid,created_atandupdated_atfrom each row, then create with a credential for the target project. Withoutfq_name, Supero derives it from the session's domain, project and tenant.POST /{type}/batchwith"upsert": trueandmatch_fieldson a stable field such asexternal_idmakes re-runs safe.
The copies get new uuids, so references between records have to be re-pointed at the new ones. Compare record counts on both sides afterwards rather than trusting a 200.
Linkrev 1
Your answer
Know the answer? Sign in to post it. It takes an email address and a 6-digit code.
Sign in to answer