{"swagger":"2.0","info":{"version":"2.1.0","title":"4Trace-api","description":"The API for the 4TRACE IOT project"},"consumes":["application/json"],"produces":["application/json"],"paths":{"/oauth/token":{"post":{"tags":["Authentication"],"description":"return all data for authentication","operationId":"postAccessToken","produces":["application/json"],"parameters":[{"in":"query","required":true,"name":"grant_type","type":"string","description":"required default value 'password'"},{"in":"query","required":true,"name":"username","type":"string","description":"username"},{"in":"query","required":true,"name":"password","type":"string","description":"password"},{"in":"header","required":true,"name":"Authorization","type":"string","description":"required default value 'Basic dHJ1c3RlZCBjbGllbnQ6c2VjcmV0'"}],"responses":{"200":{"description":"data authentication","schema":{"$ref":"#/definitions/AuthenticationResponse"}}}}},"/api/4trace/capturexml":{"post":{"tags":["Capture Event"],"description":"capture event on xml file","operationId":"captureXml","consumes":["application/xml"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"xml_event","description":"xml containing informations.","required":true,"schema":{"type":"object","properties":{"data_1":{"type":"string","description":"content","example":"<test></test>"}}}}],"responses":{"200":{"description":"response","schema":{"$ref":"#/definitions/CaptureResponse"}}}}},"/api/4trace/queryevent":{"post":{"tags":["Query client"],"description":"Return events stored in the EPCIS repository","operationId":"queryEvent","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"query_parameters","description":"json containing informations.","required":true,"schema":{"type":"object","properties":{"queryParameters":{"type":"array","items":{"type":"object","properties":{"parameterQuery":{"type":"string","description":"content","example":"GLN"},"type":{"type":"string","description":"content","example":null},"value":{"type":"string","description":"content","example":"7340923094360"},"authorizationTypeId":{"type":"string","description":"content","example":"8"},"geEventTime":{"type":"string","description":"content","example":"2017-18-12 15:19:51"},"ltEventTime":{"type":"string","description":"content","example":"2017-18-12 15:19:53"},"geRecordTime":{"type":"string","description":"content","example":"2017-18-12 15:20:02"},"ltRecordTime":{"type":"string","description":"content","example":"2017-18-12 15:20:06"},"eqAction":{"type":"string","description":"content","example":"OBSERVE"},"eqDisposition":{"type":"string","description":"content","example":"urn:epcglobal:cbv:disp:active"},"eqBizStep":{"type":"string","description":"content","example":"urn:epcglobal:cbv:bizstep:accepting"},"eqAnyKey":{"type":"string","description":"content","example":"nttdata:epcis#hash"},"eqAnyValue":{"type":"string","description":"content","example":"873ecf0aeb3a7517b660bfbf8b6fb260440ba63607781071a51f9c879f4ff777"}}}}}}}],"responses":{"200":{"description":"response","schema":{"$ref":"#/definitions/QueryResponse"}}}}},"/api/4trace/capturejson":{"post":{"tags":["Capture Event"],"description":"capture event on json file","operationId":"captureJson","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"json_event","description":"json containing the event.","required":true,"schema":{"type":"object","required":["aggregationEvent","objectEvent"],"properties":{"aggregationEvent":{"type":"array","items":{"type":"object","properties":{"eventTime":{"type":"string"},"eventTimeZoneOffset":{"type":"string"},"parentId":{"type":"string"},"epcList":{"required":["epc"],"properties":{"epc":{"type":"array","items":{"type":"string"}}},"type":"object"},"disposition":{"type":"string"},"bizLocation":{"required":["id","location"],"properties":{"id":{"type":"string"},"location":{"type":"string"}},"type":"object"}}}},"objectEvent":{"type":"array","items":{"type":"object","properties":{"eventTime":{"type":"string"},"eventTimeZoneOffset":{"type":"string"},"parentId":{"type":"string"},"epcList":{"required":["epc"],"properties":{"epc":{"type":"array","items":{"type":"string"}}},"type":"object"},"disposition":{"type":"string"},"bizLocation":{"required":["id","location"],"properties":{"id":{"type":"string"},"location":{"type":"string"}},"type":"object"},"status":{"type":"string"},"temperature":{"type":"string"}}}}}}}],"responses":{"200":{"description":"response","schema":{"$ref":"#/definitions/CaptureResponse"}}}}},"/api/timestamp/filedetail":{"post":{"tags":["BlockChain Module"],"description":"get blockchain receipt","operationId":"get receipt","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"ots","description":"hash ots file","required":true,"schema":{"type":"object","required":["otsFile"],"properties":{"otsFile":{"type":"string"}}}}],"responses":{"200":{"description":"response","schema":{"type":"object","properties":{"otsFile":{"type":"string"}}}}}}},"/api/events/{event-id}/verify":{"put":{"tags":["BlockChain Module"],"summary":"verify event on blockchain","description":"Service useful to check status of previously submitted event <br/><i>Precondition</i><ul><li><i>ADMIN </i> - no preconditions </li><li><i>ENDUSER</i> - hash or certificateFile belongs to logged user</li></ul>","produces":["application/json"],"parameters":[{"name":"authorization","in":"header","description":"ID token received after login in Authorization Server","required":true,"type":"string"},{"in":"path","name":"event-id","type":"string","required":true}],"responses":{"200":{"description":"response","schema":{"$ref":"#/definitions/VerifyModelResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Input hash not found or hash not belonging to blockchainPlatform"}},"deprecated":false}},"/api/4trace/queryeventsubscription":{"post":{"tags":["Query client subscription"],"description":"Subscription query events in the EPCIS repository","operationId":"queryeventsubscription","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"queryEventSubscription","description":"json containing informations.","required":true,"schema":{"type":"object","required":["subscriptionId","dest","schedule","initialRecordTime","reportIfEmpty","queryParameter"],"properties":{"subscriptionId":{"type":"string","example":"name"},"dest":{"type":"string","example":"http://address:port/SubscriptionTestServlet"},"schedule":{"type":"string","example":"0 0/1 * 1/1 * ? * (cron expression)"},"initialRecordTime":{"type":"string","example":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"},"reportIfEmpty":{"type":"string","example":"true or false"},"queryParameter":{"required":["parameterQuery","type","value","serial","authorizationTypeId","geEventTime","ltEventTime","geRecordTime","ltRecordTime","eqAction","eqDisposition","eqBizStep","eqAnyKey","eqAnyValue","parentId"],"properties":{"parameterQuery":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"},"serial":{"type":"string"},"authorizationTypeId":{"type":"number"},"geEventTime":{"type":"string"},"ltEventTime":{"type":"string"},"geRecordTime":{"type":"string"},"ltRecordTime":{"type":"string"},"eqAction":{"type":"string"},"eqDisposition":{"type":"string"},"eqBizStep":{"type":"string"},"eqAnyKey":{"type":"string"},"eqAnyValue":{"type":"string"},"parentId":{"type":"string"}},"type":"object"}}}}],"responses":{"200":{"description":"response","schema":{"type":"object","properties":{"SubscriptionID":{"type":"string"}}}}}}},"/api/4trace/queryeventunsubscription/{subscriptionID}":{"get":{"tags":["Query client subscription"],"description":"Unubscription query events in the EPCIS repository","operationId":"queryeventunsubscription","produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"path","name":"subscriptionID","type":"string","required":true,"description":"name/id query subscription"}],"responses":{"200":{"description":"response","schema":{"type":"object","properties":{"Subscription {subscriptionID}":{"type":"string"}}}}}}},"/api/4trace/getqueryeventsubscription":{"get":{"tags":["Query client subscription"],"description":"Get all subscription query events in the EPCIS repository","operationId":"getqueryeventsubscription","produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"}],"responses":{"200":{"description":"response","schema":{"type":"string","example":"{subscriptionID},{subscriptionID}"}}},"x-swagger-router-controller":"ZWave"}},"/api/hyperledger/registerUserOnCA":{"post":{"tags":["BlockChain Module"],"description":"register user on Organizzation's Certificate Autority","operationId":"register user on CA","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"user","description":"detail of user to register","required":true,"schema":{"type":"object","required":["username","organization"],"properties":{"username":{"type":"string"},"organization":{"type":"string"}}}}],"responses":{"200":{"description":"response","schema":{"type":"object","properties":{"response_code":{"type":"string"},"response_message":{"type":"string"}}}}}}},"/api/hyperledger/saveData":{"post":{"tags":["BlockChain Module"],"description":"save data on ledger","operationId":"save data on ledger","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"data","description":"data to save","required":true,"schema":{"type":"object","required":["data","organization","channel"],"properties":{"data":{"type":"string"},"organization":{"type":"string"},"channel":{"type":"string"}}}}],"responses":{"200":{"description":"response","schema":{"type":"object","properties":{"response_code":{"type":"string"},"response_message":{"type":"string"}}}}}}},"/api/hyperledger/readData":{"get":{"tags":["BlockChain Module"],"description":"read data from ledger","operationId":"read data from ledger","produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"}],"responses":{"200":{"description":"response","schema":{"type":"object","properties":{"response_code":{"type":"string"},"response_message":{"type":"string"}}}}}}},"/api/4trace/users":{"get":{"tags":["Users"],"summary":"User List","description":"This service return the user list at requestt <br/><i>Precondition</i><ul><li><i>SUPER-ADMIN</i> - Municpaly </li><li><i>ADMIN</i> - Voluntary and charity associations  </li><li><i>ADMIN</i> -Superstores (Supermarket, large retailers )</li>","consumes":["application/xml"],"produces":["application/json"],"parameters":[{"in":"header","required":true,"name":"access_token","type":"string","description":"field access_token returned from /oauth/token service"},{"in":"body","name":"xml_event","description":"xml containing informations.","required":true,"schema":{"type":"object","properties":{"data_1":{"type":"string","description":"content","example":"<test></test>"}}}}],"responses":{"200":{"description":"response","schema":{"$ref":"#/definitions/CaptureResponse"}}}}}},"definitions":{"AuthenticationResponse":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string"},"refresh_token":{"type":"string"},"expires_in":{"type":"string"},"scope":{"type":"string"}},"description":"ok"},"CaptureResponse":{"type":"object","properties":{"code":{"type":"integer","description":"<ul><li>0 - Success</li><li>18 - Invalid Input</li><li>99 - Technical Error</li><li>3 - Invalid Token</li></ul>TODO complete all scenarios"},"data":{"type":"object","properties":{"resultCapture":{"type":"string","example":"{\"eventCaptured\":4}"},"hashFile":{"type":"string","example":"3560aeb4bdf8b112fc27f1dd539376b5"},"timestamp":{"type":"string","example":"2017-12-18 14:29:04"},"eventId":{"type":"integer","example":20}}}},"description":"ok"},"QueryResponse":{"type":"object","properties":{"code":{"type":"number"},"data":{"properties":{"objectEventList":{"type":"array","items":{"type":"object","properties":{"objectEvent":{"properties":{"eventTime":{"type":"string"},"recordTime":{"type":"string"},"eventTimeZoneOffset":{"type":"string"},"baseExtension":{"properties":{"eventId":{"type":"string"}},"type":"object"},"epcList":{"properties":{"epc":{"type":"array","items":{"type":"string"}}},"type":"object"},"action":{"type":"string"},"bizStep":{"type":"string"},"owner":{"type":"string"},"hash":{"type":"string"},"stamp":{"type":"string"},"otsFile":{"type":"string"},"bitcoinAttestation":{"type":"string"},"merkleRoot":{"type":"string"},"status":{"type":"string"}},"type":"object"},"xml":{"type":"string"}}}},"aggregationEventList":{"type":"array","items":{"type":"object","properties":{"aggregationEvent":{"properties":{"eventTime":{"type":"string"},"recordTime":{"type":"string"},"eventTimeZoneOffset":{"type":"string"},"parentId":{"type":"string"},"childEpcs":{"properties":{"epc":{"type":"array","items":{"type":"string"}}},"type":"object"},"action":{"type":"string"},"bizStep":{"type":"string"},"disposition":{"type":"string"},"bizLocation":{"properties":{"id":{"type":"string"}},"type":"object"},"owner":{"type":"string"},"hash":{"type":"string"},"stamp":{"type":"string"},"otsFile":{"type":"string"},"bitcoinAttestation":{"type":"string"},"merkleRoot":{"type":"string"},"status":{"type":"string"}},"type":"object"},"xml":{"type":"string"}}}}},"type":"object"}}},"VerifyModelResponse":{"type":"object","properties":{"code":{"type":"integer","description":"<ul><li>0 - Success</li><li>18 - Invalid Input</li><li>99 - Technical Error</li><li>3 - Invalid Token</li></ul>TODO complete all scenarios"},"data":{"type":"object","properties":{"status":{"type":"string","example":"PENDING_ATTESTATION","enum":["INCOMPLETE","PENDING_ATTESTATION","COMPLETE"]},"transactionId":{"type":"string"}}}}}},"schemes":["https"],"host":"virtserver.swaggerhub.com","basePath":"/retse/4Trace/1.0.0"}