RESTful architecture file to openAPI file - rest

I'm new working with APIs and its documentation. However, I need to get an openAPI or swagger file from a RESTful API.
I have tried a couple of libraries (goswagger.io, rest.sh) and swaggerHub or Apimatic.io. However, I have not find a way to transform the file I have to a proper swagger structure.
Is it possible to get from the definition file I have for the RESTful API to an openAPI swagger?
Here is a snippet of the file I need to transform:
{
"models":{
"com.linkedin.analytics.GetTimeseriesAggregatedStatsResponse":{
"namespace":"com.linkedin.analytics",
"name":"GetTimeseriesAggregatedStatsResponse",
"fields":[
{
"type":"string",
"name":"entityName",
"doc":"Input param entityName"
},
{
"type":"string",
"name":"aspectName",
"doc":"Input param aspectName"
},
{
"name":"filter",
"doc":"Input param filter.",
"optional":true,
"type":{
"namespace":"com.linkedin.metadata.query.filter",
"name":"Filter",
"doc":"The filter for finding a record or a collection of records",
"fields":[
{
"name":"or",
"doc":"A list of disjunctive criterion for the filter. (or operation to combine filters)",
"optional":true,
"type":{
"type":"array",
"items":{
"name":"ConjunctiveCriterion",
"doc":"A list of criterion and'd together.",
"fields":[
{
"type":{
"type":"array",
"items":{
"name":"Criterion",
"doc":"A criterion for matching a field with given value",
"fields":[
{
"type":"string",
"name":"field",
"doc":"The name of the field that the criterion refers to"
},
{
"type":"string",
"name":"value",
"doc":"The value of the intended field"
},
{
"name":"values",
"doc":"Values. one of which the intended field should match\nNote, if values is set, the above \"value\" field will be ignored",
"default":[
],
"type":{
"type":"array",
"items":"string"
}
},
{
"name":"condition",
"doc":"The condition for the criterion, e.g. EQUAL, START_WITH",
"default":"EQUAL",
"type":{
"name":"Condition",
"doc":"The matching condition in a filter criterion",
"type":"enum",
"symbolDocs":{
"IS_NULL":"Represent the relation: field is null, e.g. platform is null",
"IN":"Represent the relation: String field is one of the array values to, e.g. name in [\"Profile\", \"Event\"]",
"EQUAL":"Represent the relation: field = value, e.g. platform = hdfs",
"CONTAIN":"Represent the relation: String field contains value, e.g. name contains Profile",
"GREATER_THAN":"Represent the relation greater than, e.g. ownerCount > 5",
"LESS_THAN_OR_EQUAL_TO":"Represent the relation less than or equal to, e.g. ownerCount <= 3",
"START_WITH":"Represent the relation: String field starts with value, e.g. name starts with PageView",
"LESS_THAN":"Represent the relation less than, e.g. ownerCount < 3",
"GREATER_THAN_OR_EQUAL_TO":"Represent the relation greater than or equal to, e.g. ownerCount >= 5",
"END_WITH":"Represent the relation: String field ends with value, e.g. name ends with Event"
},
"symbols":[
"CONTAIN",
"END_WITH",
"EQUAL",
"IS_NULL",
"GREATER_THAN",
"GREATER_THAN_OR_EQUAL_TO",
"IN",
"LESS_THAN",
"LESS_THAN_OR_EQUAL_TO",
"START_WITH"
]
}
}
],
"type":"record"
}
},
"name":"and",
"doc":"A list of and criteria the filter applies to the query"
}
],
"type":"record"
}
}
},
{
"name":"criteria",
"doc":"Deprecated! A list of conjunctive criterion for the filter. If \"or\" field is provided, then this field is ignored.",
"optional":true,
"type":{
"type":"array",
"items":"Criterion"
}
}
],
"type":"record"
}
},
{
"name":"aggregationSpecs",
"doc":"Input param aggregated metrics.",
"optional":true,
"type":{
"type":"array",
"items":{
"namespace":"com.linkedin.timeseries",
"name":"AggregationSpec",
"doc":"Provides the aggregation specification on a member/field.",
"fields":[
{
"type":"string",
"name":"fieldPath",
"doc":"Name of the member/field."
},
{
"type":{
"name":"AggregationType",
"type":"enum",
"symbols":[
"LATEST",
"SUM",
"CARDINALITY"
]
},
"name":"aggregationType",
"doc":"Aggregation type for the metric."
}
],
"type":"record"
}
}
},
{
"type":{
"type":"array",
"items":{
"namespace":"com.linkedin.timeseries",
"name":"GroupingBucket",
"doc":"Defines the group by bucket definitions for time series requests.",
"fields":[
{
"type":{
"name":"GroupingBucketType",
"doc":"Defines a grouping bucket type.",
"type":"enum",
"symbols":[
"DATE_GROUPING_BUCKET",
"STRING_GROUPING_BUCKET"
]
},
"name":"type",
"doc":"Type of the grouping bucket."
},
{
"type":"string",
"name":"key",
"doc":"Key that specifies the column name to be used as the timestamp field for bucketing."
},
{
"name":"timeWindowSize",
"doc":"Bucket size (like a day/hour etc) for the date grouping buckets.",
"optional":true,
"type":{
"name":"TimeWindowSize",
"doc":"Defines the size of a time window.",
"fields":[
{
"type":{
"name":"CalendarInterval",
"type":"enum",
"symbols":[
"SECOND",
"MINUTE",
"HOUR",
"DAY",
"WEEK",
"MONTH",
"QUARTER",
"YEAR"
]
},
"name":"unit",
"doc":"Interval unit such as minute/hour/day etc."
},
{
"name":"multiple",
"doc":"How many units. Defaults to 1.",
"default":1,
"type":"int"
}
],
"type":"record"
}
}
],
"type":"record"
}
},
"name":"groupingBuckets",
"doc":"Input param groupingBuckets"
},
{
"type":{
"namespace":"com.linkedin.timeseries",
"name":"GenericTable",
"doc":"Defines a generic table.",
"fields":[
{
"type":{
"type":"array",
"items":"string"
},
"name":"columnNames",
"doc":"The names of the columns."
},
{
"type":{
"type":"array",
"items":"string"
},
"name":"columnTypes",
"doc":"The types of the columns."
},
{
"name":"rows",
"doc":"The data rows.",
"optional":true,
"type":{
"type":"array",
"items":{
"type":"array",
"items":"string"
}
}
}
],
"type":"record"
},
"name":"table",
"doc":"The results table."
},
{
"name":"lastUpdatedTimeMillis",
"doc":"When the index was last updated.",
"optional":true,
"type":"long"
}
],
"type":"record"
},
...
},
"resources":{
"com.linkedin.entity.entities":{
"schema":"com.linkedin.entity.Entity",
"namespace":"com.linkedin.entity",
"name":"entities",
"doc":"Single unified resource for fetching, updating, searching, & browsing DataHub entities\n\ngenerated from: com.linkedin.metadata.resources.entity.EntityResource",
"path":"/entities",
"collection":{
"supports":[
"batch_get",
"get"
],
"identifier":{
"type":"string",
"name":"entitiesId"
},
"actions":[
{
"name":"autocomplete",
"parameters":[
{
"type":"string",
"name":"entity"
},
{
"type":"string",
"name":"query"
},
{
"type":"string",
"name":"field",
"optional":true
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter",
"optional":true
},
{
"type":"int",
"name":"limit"
}
],
"returns":"com.linkedin.metadata.query.AutoCompleteResult"
},
{
"name":"batchGetTotalEntityCount",
"parameters":[
{
"type":"{ \"type\" : \"array\", \"items\" : \"string\" }",
"name":"entities"
}
],
"returns":"{ \"type\" : \"map\", \"values\" : \"long\" }"
},
{
"name":"batchIngest",
"parameters":[
{
"type":"{ \"type\" : \"array\", \"items\" : \"com.linkedin.entity.Entity\" }",
"name":"entities"
},
{
"type":"{ \"type\" : \"array\", \"items\" : \"com.linkedin.mxe.SystemMetadata\" }",
"name":"systemMetadata",
"optional":true
}
]
},
{
"name":"browse",
"parameters":[
{
"type":"string",
"name":"entity"
},
{
"type":"string",
"name":"path"
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter",
"optional":true
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"limit"
}
],
"returns":"com.linkedin.metadata.browse.BrowseResult"
},
{
"name":"delete",
"parameters":[
{
"type":"string",
"name":"urn"
}
],
"returns":"com.linkedin.metadata.run.DeleteEntityResponse"
},
{
"name":"deleteAll",
"parameters":[
{
"type":"string",
"name":"registryId",
"optional":true
},
{
"type":"boolean",
"name":"dryRun",
"optional":true
}
],
"returns":"com.linkedin.metadata.run.RollbackResponse"
},
{
"name":"deleteReferences",
"parameters":[
{
"type":"string",
"name":"urn"
},
{
"type":"boolean",
"name":"dryRun",
"optional":true
}
],
"returns":"com.linkedin.metadata.run.DeleteReferencesResponse"
},
{
"name":"exists",
"parameters":[
{
"type":"string",
"name":"urn"
}
],
"returns":"boolean"
},
{
"name":"filter",
"parameters":[
{
"type":"string",
"name":"entity"
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter"
},
{
"type":"com.linkedin.metadata.query.filter.SortCriterion",
"name":"sort",
"optional":true
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"count"
}
],
"returns":"com.linkedin.metadata.search.SearchResult"
},
{
"name":"getBrowsePaths",
"parameters":[
{
"type":"com.linkedin.common.Urn",
"name":"urn"
}
],
"returns":"{ \"type\" : \"array\", \"items\" : \"string\" }"
},
{
"name":"getTotalEntityCount",
"parameters":[
{
"type":"string",
"name":"entity"
}
],
"returns":"long"
},
{
"name":"ingest",
"parameters":[
{
"type":"com.linkedin.entity.Entity",
"name":"entity"
},
{
"type":"com.linkedin.mxe.SystemMetadata",
"name":"systemMetadata",
"optional":true
}
]
},
{
"name":"list",
"parameters":[
{
"type":"string",
"name":"entity"
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter",
"optional":true
},
{
"type":"com.linkedin.metadata.query.filter.SortCriterion",
"name":"sort",
"optional":true
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"count"
}
],
"returns":"com.linkedin.metadata.query.ListResult"
},
{
"name":"listUrns",
"parameters":[
{
"type":"string",
"name":"entity"
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"count"
}
],
"returns":"com.linkedin.metadata.query.ListUrnsResult"
},
{
"name":"search",
"parameters":[
{
"type":"string",
"name":"entity"
},
{
"type":"string",
"name":"input"
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter",
"optional":true
},
{
"type":"com.linkedin.metadata.query.filter.SortCriterion",
"name":"sort",
"optional":true
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"count"
}
],
"returns":"com.linkedin.metadata.search.SearchResult"
},
{
"name":"searchAcrossEntities",
"parameters":[
{
"type":"{ \"type\" : \"array\", \"items\" : \"string\" }",
"name":"entities",
"optional":true
},
{
"type":"string",
"name":"input"
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter",
"optional":true
},
{
"type":"com.linkedin.metadata.query.filter.SortCriterion",
"name":"sort",
"optional":true
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"count"
}
],
"returns":"com.linkedin.metadata.search.SearchResult"
},
{
"name":"searchAcrossLineage",
"parameters":[
{
"type":"string",
"name":"urn"
},
{
"type":"string",
"name":"direction"
},
{
"type":"{ \"type\" : \"array\", \"items\" : \"string\" }",
"name":"entities",
"optional":true
},
{
"type":"string",
"name":"input",
"optional":true
},
{
"type":"int",
"name":"maxHops",
"optional":true
},
{
"type":"com.linkedin.metadata.query.filter.Filter",
"name":"filter",
"optional":true
},
{
"type":"com.linkedin.metadata.query.filter.SortCriterion",
"name":"sort",
"optional":true
},
{
"type":"int",
"name":"start"
},
{
"type":"int",
"name":"count"
}
],
"returns":"com.linkedin.metadata.search.LineageSearchResult"
},
{
"name":"setWritable",
"parameters":[
{
"type":"boolean",
"name":"value",
"default":"true"
}
]
}
],
"entity":{
"path":"/entities/{entitiesId}"
},
"methods":[
{
"method":"get",
"parameters":[
{
"type":"{ \"type\" : \"array\", \"items\" : \"string\" }",
"name":"aspects",
"optional":true
}
],
"doc":"Retrieves the value for an entity that is made up of latest versions of specified aspects."
},
{
"method":"batch_get",
"parameters":[
{
"type":"{ \"type\" : \"array\", \"items\" : \"string\" }",
"name":"aspects",
"optional":true
}
]
}
]
}
},
...
Thank you in advance!

Related

Summarise keys and values from all json objects using jolt

I have a JSON input jolt transformation
[
{
"System": {
"Provider": {
"Name": "Microsoft-Windows-Eventlog",
"Guid": "{sdada}"
}
},
"EventID": "3434",
"EventData": {
"SubjectUserSid": "3455",
"SubjectUserName": "abc",
"SubjectDomainName": "def",
"SubjectLogonId": "e4545",
"ObjectServer": "dggg",
"ObjectType": "eet"
}
},
{
"System": {
"Provider": {
"Name": "Microsoft-Windows-Eventlog",
"Guid": "{sdada1}"
},
"EventID": "3435"
}
}
]
As you can see Event data is present in the first JSON but not in the second JSON object in the array
My desired output is :
[
{
"winlog": {
"provider_name": "Microsoft-Windows-Eventlog",
"provider_guid": "{sdada}",
"EventID": "3434",
"event_data": {
"SubjectUserSid": "3455",
"SubjectUserName": "abc",
"SubjectDomainName": "def",
"SubjectLogonId": "e4545",
"ObjectServer": "dggg",
"ObjectType": "eet"
}
}
},
{
"winlog": {
"provider_name": "Microsoft-Windows-Eventlog",
"provider_guid": "{sdada1}",
"EventID": "3435",
"event_data": {
"SubjectUserSid": null,
"SubjectUserName": null,
"SubjectDomainName": null,
"SubjectLogonId": null,
"ObjectServer": null,
"ObjectType": null
}
}
}
]
I want to event data key in both the objects with the value as null for the second object
[
{
"operation": "shift",
"spec": {
"*": {
"System": {
"Provider": {
"Name": "[&3].winlog.provider_name",
"Guid": "[&3].winlog.provider_guid"
}
},
"EventData": "[&1].winlog.event_data"
}
}
}]
My output is
[ {
"winlog" : {
"provider_name" : "Microsoft-Windows-Eventlog",
"provider_guid" : "{sdada}",
"event_data" : {
"SubjectUserSid" : "3455",
"SubjectUserName" : "abc",
"SubjectDomainName" : "def",
"SubjectLogonId" : "e4545",
"ObjectServer" : "dggg",
"ObjectType" : "eet"
}
}
}, {
"winlog" : {
"provider_name" : "Microsoft-Windows-Eventlog",
"provider_guid" : "{sdada1}"
}
} ]
In short how to summarize keys for each array JSON
Firstly, you can put default values into the tree like this:
{
"operation": "modify-default-beta",
"spec": {
"*": {
"EventData": {
"SubjectUserSid": null,
"SubjectUserName": null,
"SubjectDomainName": null,
"SubjectLogonId": null,
"ObjectServer": null,
"ObjectType": null
}
}
}
}

Application insights sink option not showing Performance counter in the Application insights for service fabric

Below is the configuration I have setup for Application Insights sink to send EtwEventSourceProviderConfiguration and EtwManifestProviderConfiguration and PerformanceCounters.
"WadCfg": {
"DiagnosticMonitorConfiguration": {
"overallQuotaInMB": "50000",
"sinks": "applicationInsights",
"EtwProviders": {
"EtwEventSourceProviderConfiguration": [
{
"provider": "Microsoft-ServiceFabric-Actors",
"scheduledTransferKeywordFilter": "1",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableActorEventTable"
}
},
{
"provider": "Microsoft-ServiceFabric-Services",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableServiceEventTable"
}
}
],
"EtwManifestProviderConfiguration": [
{
"provider": "cbd93bc2-xxxx-4566-b3a7-xxxxxxxx",
"scheduledTransferLogLevelFilter": "Information",
"scheduledTransferKeywordFilter": "4611686018427387904",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricSystemEventTable"
}
}
]
},
"PerformanceCounters": {
"scheduledTransferPeriod": "PT1M",
"PerformanceCounterConfiguration": [
{
"counterSpecifier": "\\Processor(_Total)\\% Processor Time",
"sampleRate": "PT1M",
"unit": "Percent",
"sinks": "applicationInsights"
},
{
"counterSpecifier": "\\Process(My.WebAPI)\\Private Bytes",
"sampleRate": "PT1M",
"sinks": "applicationInsights"
}
]
}
},
"SinksConfig": {
"Sink": [
{
"name": "applicationInsights",
"ApplicationInsights": "d504ba9a-xxx-42b7-xxxx-xxxxxxxxxx"
},
{
"name": "MyApplicationInsightsProfilerSink",
"ApplicationInsightsProfiler": "d504ba9a-xxxx-42b7-xxxx-xxxxxxxxx"
}
]
}
},
"StorageAccount": "sfdgjsxxxxxxxxxxxx"
}
}
},
I do not see any of the events or performance counter in Log.

How to filter unique value in REST API

I want to filter unique IP regardless it's in DST_Local_IP or in SRC_Local_IP.
this is my REST API:
{
"size" : 0,
"query": {
"bool": {
"should": [
{
"match":{"IPV4_DST_ADDR":"120.127.0.0/16"}
},
{
"match":{"IPV4_SRC_ADDR":"120.127.0.0/16"}
},
{
"range" : {
"LAST_SWITCHED" : {
"gte" : 0
}
}
}
],
"minimum_should_match": 2
}
},
"aggs": {
"DST_Local_IP": {
"filter": {
"bool": {
"filter": {
"match":{"IPV4_DST_ADDR":"120.127.0.0/16"}
}
}
},
"aggs": {
"dst_local_ip" : {
"terms" : {
"field" : "IPV4_DST_ADDR",
"size": 10000
}
}
}
},
"SRC_Local_IP": {
"filter": {
"bool": {
"filter": {
"match":{"IPV4_SRC_ADDR":"120.127.0.0/16"}
}
}
},
"aggs": {
"src_local_ip" : {
"terms" : {
"field" : "IPV4_SRC_ADDR",
"size": 10000
}
}
}
}
}
}
response:
"aggregations": {
"SRC_Local_IP": {
"doc_count": 48287688,
"src_local_ip": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "120.127.160.8",
"doc_count": 6890185
},
{
"key": "120.127.160.77",
"doc_count": 3791683
},
{
"key": "120.127.160.65",
"doc_count": 1646648
},
{
"key": "120.127.160.42",
"doc_count": 1058027
}
.
.
.
"DST_Local_IP": {
"doc_count": 36696216,
"dst_local_ip": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "120.127.160.8",
"doc_count": 2762815
},
{
"key": "120.127.160.99",
"doc_count": 1344110
}
I want the return value is distinct because the ip in DST_Local_IP may be in SRC_Local_IP duplicated, but I just want the unique ip regardless the ip is in DST_Local_IP or SRC_Local_IP.
How can I do?could you give me some idea:)
thank you in advance!

Match_phrase isn’t precise

this is my REST API:
GET logstash-2017.12.29/_search
{
"_source": {
"includes": [ "IPV4_DST_ADDR","IPV4_SRC_ADDR","IN_BYTES","OUT_BYTES"]
},
"size" : 100,
"query": {
"bool": {
"should": [
{
"match_phrase":{"IPV4_DST_ADDR":"192.168.0.159"}
},
{
"match_phrase":{"IPV4_SRC_ADDR":"192.168.0.159"}
}
],
"must":
{
"range" : {
"LAST_SWITCHED" : {
"gte" : 1514543547
}
}
}
}
},
"aggs": {
"IN_PKTS": {
"sum": {
"field": "IN_PKTS"
}
},
"IN_BYTES": {
"sum": {
"field": "IN_BYTES"
}
},
"OUT_BYTES": {
"sum": {
"field": "OUT_BYTES"
}
},
"OUT_PKTS": {
"sum": {
"field": "OUT_PKTS"
}
},
"genres":{
"terms" : {
"field" : "L7_PROTO_NAME.keyword",
"order" : { "in_bytes" : "desc" }
},
"aggs":{
"in_bytes": {
"sum": { "field":"IN_BYTES"}
}
}
},
"download1" : {
"filter" : { "term": { "IPV4_DST_ADDR":"192.168.0.159"} },
"aggs" : {
"downlod_bytes" : { "sum" : { "field" : "IN_BYTES" } }
}
},
"download2" : {
"filter" : { "term": { "IPV4_SRC_ADDR":"192.168.0.159"} },
"aggs" : {
"downlod_bytes" : { "sum" : { "field" : "OUT_BYTES" } }
}
},"upload1" : {
"filter" : { "term": { "IPV4_DST_ADDR":"192.168.0.159"} },
"aggs" : {
"downlod_bytes" : { "sum" : { "field" : "OUT_BYTES" } }
}
},"upload2" : {
"filter" : { "term": { "IPV4_SRC_ADDR":"192.168.0.159"} },
"aggs" : {
"downlod_bytes" : { "sum" : { "field" : "IN_BYTES" } }
}
}
}
I found there are some return documents didn't meet my requirement.
{
"_index": "logstash-2017.12.29",
"_type": "ntopng-*",
"_id": "AWCh1jPtnZ2m3739FTU7",
"_score": 1,
"_source": {
"IPV4_SRC_ADDR": "192.168.0.109", // not in my expectation
"IN_BYTES": 132,
"IPV4_DST_ADDR": "224.0.0.252", // not in my expectation
"OUT_BYTES": 0
}
}
the return document IPV4_SRC_ADDR or IPV4_DST_ADDR are not "192.168.0.159".
it seems fuzzy search, but I want to match_phrase 100%.
either IPV4_SRC_ADDR or IPV4_DST_ADDR is "192.168.0.159".
How should I modified my REST API .
thank you in advance!
You should map your IP fields using the ip data type
{
"mappings": {
"my_type": {
"properties": {
"IPV4_SRC_ADDR": {
"type": "ip"
},
"IPV4_DST_ADDR": {
"type": "ip"
}
}
}
}
}
Then you'll be able to match those addresses exactly using a simple term query:
"should": [
{
"term":{"IPV4_DST_ADDR":"192.168.0.159"}
},
{
"term":{"IPV4_SRC_ADDR":"192.168.0.159"}
}
],
UPDATE:
Given your mapping you can also use the .keyword sub-field, like this
{
"_source": {
"includes": [
"IPV4_DST_ADDR",
"IPV4_SRC_ADDR",
"IN_BYTES",
"OUT_BYTES"
]
},
"size": 100,
"query": {
"bool": {
"minimum_should_match": 1,
"should": [
{
"term": {
"IPV4_DST_ADDR.keyword": "192.168.0.159"
}
},
{
"term": {
"IPV4_SRC_ADDR.keyword": "192.168.0.159"
}
}
],
"must": {
"range": {
"LAST_SWITCHED": {
"gte": 1514543547
}
}
}
}
},
"aggs": {
"IN_PKTS": {
"sum": {
"field": "IN_PKTS"
}
},
"IN_BYTES": {
"sum": {
"field": "IN_BYTES"
}
},
"OUT_BYTES": {
"sum": {
"field": "OUT_BYTES"
}
},
"OUT_PKTS": {
"sum": {
"field": "OUT_PKTS"
}
},
"genres": {
"terms": {
"field": "L7_PROTO_NAME.keyword",
"order": {
"in_bytes": "desc"
}
},
"aggs": {
"in_bytes": {
"sum": {
"field": "IN_BYTES"
}
}
}
},
"download1": {
"filter": {
"term": {
"IPV4_DST_ADDR.keyword": "192.168.0.159"
}
},
"aggs": {
"download_bytes": {
"sum": {
"field": "IN_BYTES"
}
}
}
},
"download2": {
"filter": {
"term": {
"IPV4_SRC_ADDR.keyword": "192.168.0.159"
}
},
"aggs": {
"downlod_bytes": {
"sum": {
"field": "OUT_BYTES"
}
}
}
},
"upload1": {
"filter": {
"term": {
"IPV4_DST_ADDR.keyword": "192.168.0.159"
}
},
"aggs": {
"downlod_bytes": {
"sum": {
"field": "OUT_BYTES"
}
}
}
},
"upload2": {
"filter": {
"term": {
"IPV4_SRC_ADDR.keyword": "192.168.0.159"
}
},
"aggs": {
"downlod_bytes": {
"sum": {
"field": "IN_BYTES"
}
}
}
}
}
}

Acumatica Rest API to get sales order with line item detail

I was doing a demo and could easily create and retrieve orders but was not able to get the expand parameter to work
For example
I created order SO003615 with:
URI http://localhost/Acumatica6/entity/Default/6.00.001/SalesOrder
{
"OrderType": { value: "SO" },
"CustomerID" : { value : "ACTIVESTAF" } ,
"LocationID" : { value : "MAIN" },
"Description" : { value : "Sample Order"},
"Details" :
[
{
"InventoryID" : {value: "AACOMPUT01"},
"Quantity" : {value: 2},
"UOM" : {value: "EA"},
"UnitPrice" : {value: 1000.99}
},
{
"InventoryID" : {value: "AALEGO500"},
"Quantity" : {value: 1}
}
]
}
Then I tried to get order with
URI http://localhost/Acumatica6/entity/Default/6.00.001/SalesOrder/SO/SO003615?expand=Details
But the line items are not in the result. What am I missing?
{
"id": "37c15980-f71d-4496-882d-6e05e4a50061",
"rowNumber": 1,
"note": "",
"BillingAddressOverride": {
"value": false
},
"BillingContactOverride": {
"value": false
},
"CreditHold": {
"value": false
},
"Currency": {
"value": "USD"
},
"CustomerID": {
"value": "ACTIVESTAF"
},
"CustomerOrder": {},
"Date": {
"value": "2017-03-16T00:00:00-04:00"
},
"Description": {
"value": "Sample Order 6"
},
"DestinationWarehouseID": {},
"ExternalReference": {},
"Hold": {
"value": false
},
"IsTaxValid": {
"value": false
},
"LastModified": {
"value": "2017-03-17T01:05:56.74-04:00"
},
"LocationID": {
"value": "MAIN"
},
"NewCard": {
"value": false
},
"OrderedQty": {
"value": 3
},
"OrderNbr": {
"value": "SO003615"
},
"OrderTotal": {
"value": 2101.98
},
"OrderType": {
"value": "SO"
},
"PaymentCardIdentifier": {},
"PaymentMethod": {
"value": "CHECK"
},
"PaymentRef": {},
"PreferredWarehouseID": {},
"Project": {
"value": "X"
},
"RequestedOn": {
"value": "2017-03-16T00:00:00-04:00"
},
"ShippingAddressOverride": {
"value": false
},
"ShippingContactOverride": {
"value": false
},
"ShipVia": {},
"Status": {
"value": "Open"
},
"TaxTotal": {
"value": 0
},
"custom": {},
"files": []
}
It is $expand, not expand. Try using the following
http://localhost/Acumatica6/entity/Default/6.00.001/SalesOrder/SO/003615?$expand=Details