go to post Rochdi Badis · Jul 20, 2022 Thanks but that will not return any records, knowing there a couple
go to post Rochdi Badis · Jul 20, 2022 repeating like this? didn't work it looks like you're putting double quotes not two single quotes?
go to post Rochdi Badis · Jul 19, 2022 I get 0 followed by some gibberish as below, so I guess it's zero, which mean the post didn't go through, but how come it does from their portal (swagger) and our code use to work and we haven't change anything ?
go to post Rochdi Badis · Jul 5, 2022 Thanks Robert but if you check my code above I already used csv and also tried 100 and still the same I get a tab delimited file rather than comma delimited that makes the columns glued to each other as in all columns as in one column (see attached below) see the file in a notepad and also the double quotes doesn't seems to work, the heading still includes the datatype Thanks
go to post Rochdi Badis · Jun 5, 2022 Hmmm, I was able to connect to their dev server with no issues, not sure it they use the same server for both Dev & live environments !? is there a path or a hotfix that I can run to upgrade TLS because upgrading Ensemble is not an option for the time being? Thanks
go to post Rochdi Badis · Jun 1, 2022 Never mind guys found the problem, i missed to put quit with a stauts as required (Quit $$$OK) Method OnTask() As %Status{S res= myclasdsQuit $$$OK}
go to post Rochdi Badis · May 30, 2022 Thanks Cristiano for you help. By the way do I need to add : D File.Open('R') before using copy From or just initialising the file is enough? Thx
go to post Rochdi Badis · May 28, 2022 I mean, just to put it simple and foget my code, how would you a post HTTPREQUEST for a JSON file given a file path? Thanks
go to post Rochdi Badis · May 28, 2022 So should I me converting my file into a %GlobalBinaryStream ? how can Correct my code because I'm not sure where or how to use %Save()? thanks
go to post Rochdi Badis · May 27, 2022 I already did but with no luck. But not sure why previous colleague hwo let the company is using %Net.MIMEPart, I haven't used this before I thought I need to send the JSON file is something like this: Set stream=##class(%FileBinaryStream).%New() Set stream.Filename=FilePath Do stream.LinkToFile(FilePath) if (CallbackHost ["VIBRA-API-DEV.AZUREWEBSITES.NET") { Set Httprequest=##class(%Net.HttpRequest).%New() Set Httprequest.SSLConfiguration="RTLS" Set Httprequest.Server="vibra-api-dev.azurewebsites.net" Set Httprequest.Timeout=30 Set Httprequest.Https=1 set Httprequest.ContentType="application/json" Do Httprequest.SetHeader("Accept","application/json") Do Httprequest.SetHeader("Accept-Language","en_US") Do Httprequest.SetHeader("Authorization","Bearer "_^Token) D Httprequest.EntityBody.Write(stream) Set tSc=Httprequest.Post("/API/SENSORS/VIBRATION") //S Out=Httprequest.HttpResponse.Data.ReadLine() Set StateCode=Httprequest.HttpResponse.StatusCode Quit StateCode would this work? thanks
go to post Rochdi Badis · May 27, 2022 Not 100% sure but I think it should be a JSON format so how can I change my code for JSON? sorry I'm a newbie, what do you mean encoding are referring to "text/plain" or "application/JSON" for example? Thanks
go to post Rochdi Badis · May 26, 2022 So in the future and in case I really need create a record with the same description on a unique indexed field, can I remove the UniqueIndex definition from the class definition do my change then put it back and compile rather than doing it through globals? also when rebuilding indexes from SMP, it says running at the background but there no notification when the rebuild has finished, is there a way to see the running process because I couldn't see it in Processes? Thanks
go to post Rochdi Badis · May 24, 2022 Hi Julius, Pls ignore my last message, I was just trying to attach a file to my message but didn't work. Thanks
go to post Rochdi Badis · May 24, 2022 what I sent is just a part of the full JSON as an example so it's not because it's missing part of it here is the full string, where I had to remove the brackets from beginning and end JSON [{"routeGuid":"531318d8-9967-445a-ae42-14e04244e0fb","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-20T23:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"0b955ee7-9a54-4b13-9af1-7019721faeab","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"8f9e85ab-31e7-4835-8969-6d72d142a2f1","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"68cea9d3-54cd-43f2-ae37-aaf47ed43e6b","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"7602764e-8951-451f-9653-ceb84834a1a6","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"8c9d66f8-b6ff-4eba-9529-c4aec6443751","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-20T15:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"88d2e472-a1e4-40b3-a108-f2d32a2023e5","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"116f2ac6-da5f-46da-a7c7-92d9eaf98c89","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"a878e527-f519-4aaa-bf5d-0d65f72de119","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"be570b14-0555-4b86-ab9f-e37c40c79216","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"2c661016-ebbd-4f26-b8e0-1ef63dc0b473","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-20T07:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"3a13e243-d6ed-4788-98b2-52e9213bee00","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"54969869-c4f6-43f6-a74a-2a67f9a73fc5","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"700af7d3-77b3-4a84-ba11-ea49602d6558","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"18dc3370-c291-468b-af1f-0361d95bb02c","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"8e11ea63-be68-4283-91a3-6586eb1172b3","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-19T23:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"35d0d2e7-1199-4c18-8941-4fff6dbdba1f","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"8044560c-94d2-4da7-87f5-07328d9e62c1","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"b636a2f5-d35f-4c82-9646-e09572336e23","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"9c9a4bf4-e8af-4b8d-9de2-a99cdff150ed","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"b8e5e096-c9bc-41c5-a1af-713301cb7545","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-19T15:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"a576d235-6eb6-4312-a1ff-7b1f767b88ce","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"654cf21e-daad-4a11-b676-86a7bc8a3360","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"2be4efc8-6616-4bff-87ba-30fe388a1b34","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"a5374d6c-311c-44d0-8d06-3a31f33dd3a8","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000}]},{"routeGuid":"9ea2968a-8deb-480c-9591-ffa18760b87f","sensorType":"MEMS TRIAXIAL","startDateTime":"2022-05-21T07:04:51.159Z","myProperty":0,"callbackHost":"https://vibra-api-dev.azurewebsites.net/api/sensors/vibration","collectionQuantity":1,"collectionInterval":0,"collectionTimeout":28140,"locationName":"Test Plant 1","locationGuid":"286c2dac-597d-41b0-8f6e-55f19fce9a9e","sensors":[{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"955529c5-36be-4f3e-b768-0e3b377804a7","sensorId":"001011","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"60a7cdb0-499e-4d02-b4d3-06ee58e40481","sensorId":"001001","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"e84eda78-1491-49af-9e34-d647e817a251","sensorId":"MY0087","sampleRate":5000,"numberOfSamples":30000},{"equipmentName":"TestAsset 1","equipmentGuid":"ca62ff12-37fe-47a3-a315-95a4c011d835","componentName":"TestMOTORComponent 1","componentGuid":"3a291bf6-1ffd-4e14-b265-4b973c7660df","jobGUID":"9bcd5fe6-6f05-4482-ad78-612f35c60b41","sensorId":"MY0088","sampleRate":5000,"numberOfSamples":30000}]}]
go to post Rochdi Badis · May 18, 2022 Nope, changed it to */* and didn't make any diffrence. in the Token there are "." & "_" special charachters not sure if that cause problem, I tried removed them but still no luck.
go to post Rochdi Badis · May 17, 2022 mybe you mean this d ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(SampleJsonData,,.list) ,I tried that but I got an empty list? in all cases, after doing the below, I should be able at lease read the JSON string but I'm getting an html file, so I'm missing something in my code? set Httprequest = ##class(%Net.HttpRequest).%New() Set Httprequest.SSLConfiguration="RTLS" Set Httprequest.Server="serverurl" Set Httprequest.Https=1 Set Httprequest.Timeout=30 set Httprequest.ContentType="application/json" Do Httprequest.SetHeader("Accept","text/plain") set Httprequest.Username="user" set Httprequest.Password="password" S stat= Httprequest.Get("someurl") Set Resp=Httprequest.HttpResponse.Data.Read()