Marketo - How to save complex object in Lead Database? - marketo

I was asked to store leads like below in Marketo's lead database through rest api "POST /rest/v1/leads.json".
{
"action": "createOnly",
"lookupField": "email",
"input": [{
"email": "kjashaedd-1#klooblept.com",
"firstName": "Kataldar-1",
"postalCode": "04828",
"property": [{
"type": "land",
"status": "available"
},
{
"type": "car",
"status": "sold out"
},
{
"type": "bike",
"status": "sold out"
},
{
"type": "laptops",
"status": "available"
}
]
},
{
"email": "kjashaedd-2#klooblept.com",
"firstName": "Kataldar-2",
"postalCode": "04828",
"property": [{
"type": "land",
"status": "sold out"
},
{
"type": "car",
"status": "available"
},
{
"type": "bike",
"status": "sold out"
},
{
"type": "laptops",
"status": "available"
}
]
}
]
}
Input field is not in flat json structure. What could be the best approach? Do I really need to use custom objects in this case? Can I dump "property" object as it is in the lead database and use velocity script to parse it ?

If 'Property' is a custom object, you'll want to call that separately for the record and associated the record with that object via the custom object API
So you can push (create) the record first and then associate (add) the custom object to the record.

You can create a List<Dictionary<string,object>> in C# and retrieve the data and then store it using Entity Framework.
I am considering .Net framework in this case

Related

How to send event parameters for a tag through the google tag manager API

With this query i can create a GTM event tag for Google Analytics 4. i would like to pass some event parameters aswell. I feel that im really close because the API seems to recognize the eventParameters key, it tells me that its value its invalid.
"vendorTemplate.parameter.eventParameters[0]: The value is invalid.\n",
If i change this eventParameters key to something else, the query goes through (obviously without taking into consideration my eventParameters) so i know that this code has to be close.
The documentation is really shallow so building queries with the GTM api its been very trial and error until now.
When i get this working i'll probably make a sample for automating trigger and tag creation for GA4 migrations
`
{
"name": "test2",
"type": "gaawe",
"parameter": [
{
"type": "template",
"key": "eventName",
"value": "hey"
},
{
"type": "tagReference",
"value": "LocalTag",
"key": "measurementId"
},
{
"type": "list",
"key": "eventParameters",
"list": [
{
"type": "template",
"value": "page_title",
"key": "page_title"
}
]
}
]
}
`
The parameters is a array
Here is the example:
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "name",
"value": `${parameterName}`
},
{
"type": "TEMPLATE",
"key": "value",
"value": `${parameterValue}`
}
]
}
And if you want to pass a variable to the value
Just add the "{{" , "}}" as you used in GTM UI.
Like {{DataLayer-Ecommerce}}
So yes you are very close to it.

Getting all profiles from Google Analytics API

I'm trying to get all profiles using ~all option with this endpoint
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles
It doesn't return all profiles due to ~all for accounts. If I include account ID instead of ~all, then it returns profiles based on that account id - which are missing when used with ~all option.
https://www.googleapis.com/analytics/v3/management/accounts/89478503/webproperties/~all/profiles
Am I doing something wrong or is this GA API bug?
I sugst you look into using account summaries list
GET https://www.googleapis.com/analytics/v3/management/accountSummaries
This will return all the account information for a user.
{
"kind": "analytics#accountSummaries",
"username": "me#gmail.com",
"totalResults": 15,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "59183475",
"kind": "analytics#accountSummary",
"name": "Cube Analytics",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-59183475-1",
"name": "Cube Analytics",
"internalWebPropertyId": "93305066",
"level": "STANDARD",
"websiteUrl": "XXXXXXX",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "115455750",
"name": "Alaternate",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "97191919",
"name": "All Web Site Data",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "178538323",
"name": "MobileView",
"type": "APP"
}
]
}, ]
}
By using this call you should only need to make one call and get all of the information back.

How to create multiple tabs of forms using angular json schema form?

I have been successfully using this awesome library and concept called json schema form.
https://www.npmjs.com/package/angular2-json-schema-form
Now using the schema patterns given I am able to generate a form based on a dynamically created schema from database. I want to convert the single form in multiple tabs. I.E I want to group certain kind of fields in one panel.
Is there any kind of support for this functionality? So that I can assign the css class according to the layout.
https://angular2-json-schema-form.firebaseapp.com/?set=ng-jsf&example=ng-jsf-flex-layout&framework=material-design&language=en
You can split group of fields into separate tabs using the fieldsets property.
See the following example from README.md:
{
"properties": {
"firstName": {
"type": "string",
"description": "First name"
},
"lastName": {
"type": "string",
"description": "Last name"
},
"email": {
"type": "string",
"description": "Email"
},
"notificationsFrequency": {
"type": "string",
"description": "Notifications frequency",
"widget": "select",
"oneOf": [
{
"description": "Daily",
"enum": [
"daily"
]
},
{
"description": "Weekly",
"enum": [
"weekly"
]
},
{
"description": "Monthly",
"enum": [
"monthly"
]
}
],
"default": "daily"
}
},
"fieldsets": [
{
"title": "Personal information",
"fields": [
"firstName",
"lastName",
"email"
]
},
{
"title": "Account settings",
"fields": [
"notificationsFrequency"
]
}
]
}

How to create compound documents?

I'm thinking of using the JSONAPI standard for the design of our API. One thing this API must be able to do, is accept a compound document (several layers deep) and create it. The root object owns all descendants ('to-many' relationships) which the server knows nothing about at that point, so it's not possible for the client to provide an id.
Is this supported by the specification or does the client have to issue http requests for every object in the document in order?
from http://jsonapi.org/format/#document-compound-documents
Compound documents require "full linkage", meaning that every included
resource MUST be identified by at least one resource identifier object
in the same document. These resource identifier objects could either
be primary data or represent resource linkage contained within primary
or included resources. The only exception to the full linkage
requirement is when relationship fields that would otherwise contain
linkage data are excluded via sparse fieldsets.
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!"
},
"links": {
"self": "http://example.com/articles/1"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" }
},
"comments": {
"links": {
"self": "http://example.com/articles/1/relationships/comments",
"related": "http://example.com/articles/1/comments"
},
"data": [
{ "type": "comments", "id": "5" },
{ "type": "comments", "id": "12" }
]
}
}
}],
"included": [{
"type": "people",
"id": "9",
"attributes": {
"first-name": "Dan",
"last-name": "Gebhardt",
"twitter": "dgeb"
},
"links": {
"self": "http://example.com/people/9"
}
}, {
"type": "comments",
"id": "5",
"attributes": {
"body": "First!"
},
"links": {
"self": "http://example.com/comments/5"
}
}, {
"type": "comments",
"id": "12",
"attributes": {
"body": "I like XML better"
},
"links": {
"self": "http://example.com/comments/12"
}
}]
}

Usergrid: Queries not accepted in GET requests

Using Postman when I issue a get request to my Usergrid backend I get a response back. For example:
When I run:
https://api.usergrid.com/gss/sandbox/summaries
I get a response:
{
"action": "get",
"application": "6e9204f0-71da-11e4-9a58-bd53db9c149b",
"params": {},
"path": "/summaries",
"uri": "https://api.usergrid.com/gss/sandbox/summaries",
"entities": [
{
"uuid": "7cd5c98a-7b16-11e4-9085-b5397738dcd5",
"type": "summary",
"created": 1417629724184,
"modified": 1417629993800,
"accountId": "123123",
"accounts": [
{
"id": "123123",
"type": "Individual",
"category": "Prepaid",
"numberOfLines": 2,
"balance": {...
However when I run the request with a query:
https://api.usergrid.com/gss/sandbox/summaries?ql=select * where id=123123
I get :
"action": "get",
"application": "6e9204f0-71da-11e4-9a58-bd53db9c149b",
"params": {
"ql": [
"select * where id=123123"
]
},
"path": "/summaries",
"uri": "https://api.usergrid.com/gss/sandbox/summaries",
"entities": [],
"timestamp": 1418766878176,
"duration": 7,
"organization": "gss",
"applicationName": "sandbox",
"count": 0
I want to be able to get the complete response when I pass in an 'id' in the query as it is coming from my UI & get the response. Any ideas?
-S
Your id property is a sub-key of accounts - when dealing with objects, you can use dot notation to reference sub-keys, like account.id. Unfortunately in your case, because you're using an array ([]) of accounts in a single entity (not an {} object), those are not queryable. I did notice though that the same property exists under accountId. You could try:
https://api.usergrid.com/gss/sandbox/summaries?ql=select * where accountId=123123
If not, I'd recommend you look at using a new collection to maintain your list of accounts, and use connections to manage the relationships between the entities.

Resources