asterixdb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Maxon <ima...@uci.edu>
Subject Re: HTTP API / REST API query result not returning in JSON Format
Date Fri, 18 Sep 2015 00:37:44 GMT
Chris Hillery had some thoughts on this (as a lot of these changes
were implemented by him), posting for him here since users@ is acting
up:

"Looking at the code for 0.8.6, I can kind of see how this is
happening. I've changed that code pretty significantly since then; I'm
not sure when the 0.8.7 snapshot you used was built, but I'm guessing
it was before any of my changes. But in any case, if you're setting
the Accept header to application/json, it should produce JSON output.
("application/x-adm" was added considerably later.)

What tool/code are you using to connect to localhost:19002?"


-Ian

On Wed, Sep 16, 2015 at 2:35 AM, Bryan Glenn Marsh
<bryan.marsh@email.ucr.edu> wrote:
> Also I have noticed without any modifications that any errors that occur get
> returned in a JSON format.
>
> On Tue, Sep 15, 2015 at 9:44 PM, Bryan Glenn Marsh
> <bryan.marsh@email.ucr.edu> wrote:
>>
>> What I have been using till now was 'application/json and have changed it
>> to application/x-adm  like you suggested and I am still getting the same
>> results as described above.
>>
>>
>>
>> On Tue, Sep 15, 2015 at 5:34 PM, Ian Maxon <imaxon@uci.edu> wrote:
>>>
>>> Hi Bryan,
>>>
>>> The change that happened between those versions was the addition of
>>> output format specification based on the Accept header. There
>>> shouldn't be any necessity to hacking apart that HTML output to
>>> extract the ADM within. Are your accept headers for HTTP? You should
>>> be able to get the same output you had in 0.8.5 by requesting
>>> application/x-adm instead.
>>>
>>> Thanks,
>>> -Ian
>>>
>>> On Tue, Sep 15, 2015 at 5:27 PM, Bryan Glenn Marsh
>>> <bryan.marsh@email.ucr.edu> wrote:
>>> > For awhile I have been trying to create a wrapper around AsterixDB that
>>> > will
>>> > add Transaction Time functionality without changing the code base for
>>> > AsterixDB.
>>> >
>>> > The way have been able to do this is by making HTTP API/REST API
>>> > calls. In
>>> > Asterix version 0.8.5 when I would send a HTTP call in the form of a
>>> > query I
>>> > would get back the result in a JSON format. Since switching to both
>>> > Asterix
>>> > version 0.8.6 and the snapshot of 0.8.7, when making a HTTP call in the
>>> > form
>>> > of a query the resultI get back is not in a JSON format.
>>> >
>>> > Example:
>>> > Query: for $ds in dataset Metadata.Dataset return $ds;
>>> > URL encoded:
>>> >
>>> > http://127.0.0.1:19002/query?query=for+%24ds+in+dataset+Metadata.Dataset+return+%24ds%3B%0A%0A%0A
>>> > Result:
>>> > <h4>Results:</h4>
>>> > <pre>
>>> > { "DataverseName": "Metadata", "DatasetName": "CompactionPolicy",
>>> > "DataTypeName": "CompactionPolicyRecordType", "DatasetType":
>>> > "INTERNAL",
>>> > "InternalDetails": { "FileStructure": "BTREE", "PartitioningStrategy":
>>> > "HASH", "PartitioningKey": [ "DataverseName", "CompactionPolicy" ],
>>> > "PrimaryKey": [ "DataverseName", "CompactionPolicy" ], "GroupName":
>>> > "MetadataGroup", "Autogenerated": false, "CompactionPolicy": "prefix",
>>> > "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size",
>>> > "Value": "1073741824" }, { "Name": "max-tolerance-component-count",
>>> > "Value":
>>> > "5" } ] }, "ExternalDetails": null, "Hints": {{  }}, "Timestamp": "Tue
>>> > Jul
>>> > 07 23:18:17 PDT 2015", "DatasetId": 13, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Dataset",
>>> > "DataTypeName":
>>> > "DatasetRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "DatasetName" ], "PrimaryKey": [ "DataverseName",
>>> > "DatasetName" ], "GroupName": "MetadataGroup", "Autogenerated": false,
>>> > "CompactionPolicy": "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 2, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "DatasourceAdapter",
>>> > "DataTypeName": "DatasourceAdapterRecordType", "DatasetType":
>>> > "INTERNAL",
>>> > "InternalDetails": { "FileStructure": "BTREE", "PartitioningStrategy":
>>> > "HASH", "PartitioningKey": [ "DataverseName", "Name" ], "PrimaryKey": [
>>> > "DataverseName", "Name" ], "GroupName": "MetadataGroup",
>>> > "Autogenerated":
>>> > false, "CompactionPolicy": "prefix", "CompactionPolicyProperties": [ {
>>> > "Name": "max-mergable-component-size", "Value": "1073741824" }, {
>>> > "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 8, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Datatype",
>>> > "DataTypeName":
>>> > "DatatypeRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "DatatypeName" ], "PrimaryKey": [ "DataverseName",
>>> > "DatatypeName" ], "GroupName": "MetadataGroup", "Autogenerated": false,
>>> > "CompactionPolicy": "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 3, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Dataverse",
>>> > "DataTypeName":
>>> > "DataverseRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName" ], "PrimaryKey": [ "DataverseName" ], "GroupName":
>>> > "MetadataGroup", "Autogenerated": false, "CompactionPolicy": "prefix",
>>> > "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size",
>>> > "Value": "1073741824" }, { "Name": "max-tolerance-component-count",
>>> > "Value":
>>> > "5" } ] }, "ExternalDetails": null, "Hints": {{  }}, "Timestamp": "Tue
>>> > Jul
>>> > 07 23:18:17 PDT 2015", "DatasetId": 1, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "ExternalFile",
>>> > "DataTypeName": "ExternalFileRecordType", "DatasetType": "INTERNAL",
>>> > "InternalDetails": { "FileStructure": "BTREE", "PartitioningStrategy":
>>> > "HASH", "PartitioningKey": [ "DataverseName", "DatasetName",
>>> > "FileNumber" ],
>>> > "PrimaryKey": [ "DataverseName", "DatasetName", "FileNumber" ],
>>> > "GroupName":
>>> > "MetadataGroup", "Autogenerated": false, "CompactionPolicy": "prefix",
>>> > "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size",
>>> > "Value": "1073741824" }, { "Name": "max-tolerance-component-count",
>>> > "Value":
>>> > "5" } ] }, "ExternalDetails": null, "Hints": {{  }}, "Timestamp": "Tue
>>> > Jul
>>> > 07 23:18:17 PDT 2015", "DatasetId": 14, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Feed", "DataTypeName":
>>> > "FeedRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "FeedName" ], "PrimaryKey": [ "DataverseName",
>>> > "FeedName"
>>> > ], "GroupName": "MetadataGroup", "Autogenerated": false,
>>> > "CompactionPolicy":
>>> > "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 10, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "FeedActivity",
>>> > "DataTypeName": "FeedActivityRecordType", "DatasetType": "INTERNAL",
>>> > "InternalDetails": { "FileStructure": "BTREE", "PartitioningStrategy":
>>> > "HASH", "PartitioningKey": [ "DataverseName", "FeedName",
>>> > "DatasetName",
>>> > "ActivityId" ], "PrimaryKey": [ "DataverseName", "FeedName",
>>> > "DatasetName",
>>> > "ActivityId" ], "GroupName": "MetadataGroup", "Autogenerated": false,
>>> > "CompactionPolicy": "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 11, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "FeedPolicy",
>>> > "DataTypeName":
>>> > "FeedPolicyRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "PolicyName" ], "PrimaryKey": [ "DataverseName",
>>> > "PolicyName" ], "GroupName": "MetadataGroup", "Autogenerated": false,
>>> > "CompactionPolicy": "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 12, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Function",
>>> > "DataTypeName":
>>> > "FunctionRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "Name", "Arity" ], "PrimaryKey": [ "DataverseName",
>>> > "Name", "Arity" ], "GroupName": "MetadataGroup", "Autogenerated":
>>> > false,
>>> > "CompactionPolicy": "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 7, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Index", "DataTypeName":
>>> > "IndexRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "DatasetName", "IndexName" ], "PrimaryKey": [
>>> > "DataverseName", "DatasetName", "IndexName" ], "GroupName":
>>> > "MetadataGroup",
>>> > "Autogenerated": false, "CompactionPolicy": "prefix",
>>> > "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size",
>>> > "Value": "1073741824" }, { "Name": "max-tolerance-component-count",
>>> > "Value":
>>> > "5" } ] }, "ExternalDetails": null, "Hints": {{  }}, "Timestamp": "Tue
>>> > Jul
>>> > 07 23:18:17 PDT 2015", "DatasetId": 4, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Library",
>>> > "DataTypeName":
>>> > "LibraryRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "DataverseName", "Name" ], "PrimaryKey": [ "DataverseName", "Name" ],
>>> > "GroupName": "MetadataGroup", "Autogenerated": false,
>>> > "CompactionPolicy":
>>> > "prefix", "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size", "Value": "1073741824" }, { "Name":
>>> > "max-tolerance-component-count", "Value": "5" } ] }, "ExternalDetails":
>>> > null, "Hints": {{  }}, "Timestamp": "Tue Jul 07 23:18:17 PDT 2015",
>>> > "DatasetId": 9, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Node", "DataTypeName":
>>> > "NodeRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "NodeName" ], "PrimaryKey": [ "NodeName" ], "GroupName":
>>> > "MetadataGroup",
>>> > "Autogenerated": false, "CompactionPolicy": "prefix",
>>> > "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size",
>>> > "Value": "1073741824" }, { "Name": "max-tolerance-component-count",
>>> > "Value":
>>> > "5" } ] }, "ExternalDetails": null, "Hints": {{  }}, "Timestamp": "Tue
>>> > Jul
>>> > 07 23:18:17 PDT 2015", "DatasetId": 5, "PendingOp": 0 }
>>> > { "DataverseName": "Metadata", "DatasetName": "Nodegroup",
>>> > "DataTypeName":
>>> > "NodeGroupRecordType", "DatasetType": "INTERNAL", "InternalDetails": {
>>> > "FileStructure": "BTREE", "PartitioningStrategy": "HASH",
>>> > "PartitioningKey":
>>> > [ "GroupName" ], "PrimaryKey": [ "GroupName" ], "GroupName":
>>> > "MetadataGroup", "Autogenerated": false, "CompactionPolicy": "prefix",
>>> > "CompactionPolicyProperties": [ { "Name":
>>> > "max-mergable-component-size",
>>> > "Value": "1073741824" }, { "Name": "max-tolerance-component-count",
>>> > "Value":
>>> > "5" } ] }, "ExternalDetails": null, "Hints": {{  }}, "Timestamp": "Tue
>>> > Jul
>>> > 07 23:18:17 PDT 2015", "DatasetId": 6, "PendingOp": 0 }
>>> > </pre>
>>> >
>>> > The formatting seems to be that of HTML and not JSON.
>>> >
>>> > Due to time restrictions, I am being forced to write my own parser to
>>> > be
>>> > able to parse feedback from HTTP API calls. But I am wondering is this
>>> > a bug
>>> > or is this the new intended behavior of the HTTP API calls. I think its
>>> > the
>>> > former due to the documentation and the way the calls used to work in
>>> > the
>>> > past.
>>> >
>>> > Thank you for your time.
>>> >
>>
>>
>

Mime
View raw message