Expand my Community achievements bar.

SOLVED

Schema creation using AEPP package

Avatar

Level 4

Hello All

I am new to AEP world. Anyone created schema using AEPP package? If yes, could you please share the sample code snippets? 

Thanks in Advance.

 

Regards

Sheejo Rapheal

1 Accepted Solution

Avatar

Correct answer by
Community Advisor and Adobe Champion

@sheejo  what are type of schema are you creating? 

I have not used it yet, but looking at the docs here's what you could try 

 

1.) Experience Event Schema 

createExperienceEventSchema(
        name="webEventSchema",
        mixinIds:[<list of your field group id required for the schema>],
        description = "schema description <optional>",
    )

2.) Profile Event Schema 

createProfileSchema(
        name="crmProfileSchema",
        mixinIds:[<list of your field group id required for the schema>],
        description = "schema description <optional>",
    )

* you could get a list of field group for a sandbox and filter to get mixinId that you require for creating the schema. 

//returns the fieldGroups of the account.
getFieldGroups()

Refer to this video which shows actual working demo 

https://youtu.be/EBfTanow76w?t=1261

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor and Adobe Champion

@sheejo  what are type of schema are you creating? 

I have not used it yet, but looking at the docs here's what you could try 

 

1.) Experience Event Schema 

createExperienceEventSchema(
        name="webEventSchema",
        mixinIds:[<list of your field group id required for the schema>],
        description = "schema description <optional>",
    )

2.) Profile Event Schema 

createProfileSchema(
        name="crmProfileSchema",
        mixinIds:[<list of your field group id required for the schema>],
        description = "schema description <optional>",
    )

* you could get a list of field group for a sandbox and filter to get mixinId that you require for creating the schema. 

//returns the fieldGroups of the account.
getFieldGroups()

Refer to this video which shows actual working demo 

https://youtu.be/EBfTanow76w?t=1261

 

Avatar

Level 4

@Anil_Umachigi , I tried this way and it was working fine. I am trying to create a custom profile schema. How can I pass a json file (list of attributes) to create a schema instead of passing the mixinids? Is there any straight way?

Avatar

Community Advisor and Adobe Champion

@sheejo Yes you can create a custom profile schema, however you cannot pass the fields (list of attributes) to create schema. 

The create schema api ( python or in general) only accepts field group ids, so here's how i would sequence and approach it 

  1. Create an array with attributes you would like to be part of field group
  2. Create field group using the method below to return a field group id save it in an array 
  3. use the list of field group id's created and create a schema. 

For convention of field group object, see here 

https://developer.adobe.com/experience-platform-apis/references/schema-registry/#tag/Field-groups/op...

var loyaltyDetails = [
    {
        "type" : "string", 
        "title" : "Loyalty id", 
        "defnition" : ""
    },
    {
        "type" : "string", 
        "title" : "Loyalty tier", 
        "defnition" : ""
    },
    {
        "type" : "string", 
        "title" : "Loyalty name", 
        "defnition" : ""
    },
]
createFieldGroup(fieldGroup_obj="loyaltyDetails")
// save the field group in a array
// now execute createSchema using field group ids.

Avatar

Employee

Hi @sheejo 

 

You can refer to the snippet in this link to create the FieldGroup. Then refer the $id of the Fieldgroup in the schema creation API.