Schema creation using AEPP package | Community
Skip to main content
sheejo
Level 3
October 17, 2022
Solved

Schema creation using AEPP package

  • October 17, 2022
  • 2 replies
  • 1658 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anil_Umachigi

@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

 

2 replies

Anil_Umachigi
Adobe Employee
Anil_UmachigiAdobe EmployeeAccepted solution
Adobe Employee
October 17, 2022

@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

 

sheejo
sheejoAuthor
Level 3
October 18, 2022

@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?

Anil_Umachigi
Adobe Employee
Adobe Employee
October 19, 2022

@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/operation/createFieldGroup

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.
Adobe Employee
October 17, 2022

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.