Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid attribute error #12

Open
seanforyou23 opened this issue Oct 22, 2020 · 2 comments
Open

Invalid attribute error #12

seanforyou23 opened this issue Oct 22, 2020 · 2 comments

Comments

@seanforyou23
Copy link

Hi! When I push certain datashapes to the databox api I receive the following error.

...
{
      type: 'invalid_atribute',
      message: 'This is the same record',
      dataItem: [Object]
    }

The datashape I'm pushing is an array of objects that look like the following

  {
    "key": "Leadsdata",
    "value": 2499,
    "date": "Thu, 22 Oct 2020 17:24:13 GMT",
    "attributes": {
      "createdon": "2016-06-30T18:26:00Z",
      "salesstagecode": "3 - Attempted Contact",
      "_frm_leadsource_value": "Search"
    }
  }

I've tried omitting the attributes altogether, and changing the values of the other properties and for some reason I keep getting this error. I'm not really sure what I'm doing wrong or where to find what "invalid attribute" means or why I get it when not specifying attributes at all. Any ideas? FWIW I'm using this same format for other bits of data and they are able to post to the api no problem. Feel free to point me to any documentation in case I've overlooked it. Thank you!

@VladaPetrovic
Copy link
Member

VladaPetrovic commented Oct 22, 2020

Hi @seanforyou23!

I'll try to explain first what is Databox doing with pushed data so we can understand invalid_atribute error.

If I use your example and add one more item so it looks like this

[
  {
    "key": "Leadsdata",
    "value": 2499,
    "date": "Thu, 22 Oct 2020 17:24:13 GMT",
    "attributes": {
      "createdon": "2016-06-30T18:26:00Z",
      "salesstagecode": "3 - Attempted Contact",
      "_frm_leadsource_value": "Search"
    }
  },
  {
    "key": "Leadsdata",
    "value": 2450,
    "date": "Thu, 22 Oct 2020 17:24:13 GMT",
    "attributes": {
      "createdon": "2016-06-30T18:26:00Z",
      "salesstagecode": "3 - Attempted Contact (NEW)",
      "_frm_leadsource_value": "Search (NEW)"
    }
  }
]

Databox will normalize this data to look like this

Date Key Value AttributeValue Unit
1 Thu, 22 Oct 2020 17:24:13 GMT Leadsdata|createdon 2499 2016-06-30T18:26:00Z null
2 Thu, 22 Oct 2020 17:24:13 GMT Leadsdata|salesstagecode 2499 3 - Attempted Contact null
3 Thu, 22 Oct 2020 17:24:13 GMT Leadsdata|_frm_leadsource_value 2499 Search null
4 Thu, 22 Oct 2020 17:24:13 GMT Leadsdata|createdon 2499 2016-06-30T18:26:00Z null
5 Thu, 22 Oct 2020 17:24:13 GMT Leadsdata|salesstagecode 2499 3 - Attempted Contact (NEW) null
6 Thu, 22 Oct 2020 17:24:13 GMT Leadsdata|_frm_leadsource_value 2499 Search (NEW) null

Columns Date, Key, AttributeValue and Unit are treated as a combined unique key in the context of the request. Knowing this we can see that rows 1. and 4. are the same. 💡 This is why Databox throws invalid_atribute error.

Is also good to know that Databox will save all records without a problem, but records 1. and 4. (maybe this is related to the question you asked in the #13)

So now when we know how it works the question is how to fix it?

  • one way is to change the Date field to be unique (if you can)
  • the other way is to split the request into a two or more requests

@seanforyou23
Copy link
Author

Super helpful - thx @VladaPetrovic. It does seem like the other issue I raised may be caused/related to the same thing and I think some combination of what you recommended should be able to work. I will give it a shot within the next couple days and report back. Thx again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants