Forum Discussion
Sending PUT method call through Power Query (M)
Hi v-juanli-msft,
Thank you for your response.
It looks like out of the three links you mentioned, the first two use Contents=Text.ToBinary() as a solution to turn the Web.Contents into a POST and the third looks like a powershell solution.
Maybe I am not reading the posts right, could you provide some more specifics?
Thanks!
Has anyone found a solution to this issue?
Tried WebAction.Request (which seems to be the only possible interface to do a PUT request) and all I get is errors pushed back (see below)...
I'm testing to just try to get webaction to work but it's crapping out on the request itself....
The lack of documentation and examples for the power query/M language is brutal and what you can do within power query is more of a mystery than anything. Someone from Microsoft with knowledge, please chime in...
NOTES:
1) Web.Contents works BUT only supports POST and GET request methods, need access to PUT and DELETE methods
2) Data repository is located behind an oData api
3) Working from within power query advance query editor.
4) Tried OData.Feed as well but the reponse from the api does not have have response header set so that craps out as well AND don't know if it supports allrequest methods as well!
let
Source = Text.FromBinary(
WebAction.Request("GET","https://myurl.com/db/table",
[
Headers=[Accept="application/json",ContentType="application/json",user="***************",password="***********************"]
]
)
),
FixJsonRecords="[" & Text.Replace(Text.Replace(Source,"}{","},{"),"{""queryType"":""select""},","") & "]",
fixResult=Table.FromRecords(Json.Document(FixJsonRecords))
in
fixResult
***** Error *****
Error Message:
Object reference not set to an instance of an object.
Stack Trace:
at Microsoft.Mashup.Host.Document.Evaluation.EvaluationResult.CreateExceptionResult(Exception exception)
at Microsoft.Mashup.Host.Document.Analysis.PackageDocumentAnalysisInfo.PackagePartitionAnalysisInfo.FormulaMetadataRecorder.RecordException(FormulaAnalyzerScope scope, Exception exception, DateTime staleSince, Boolean sampled)
at Microsoft.Mashup.Host.Document.Analysis.PackageDocumentAnalysisInfo.PackagePartitionAnalysisInfo.SetPreviewValue(EvaluationResult2`1 result, Func`1 getStaleSince, Func`1 getSampled)
at Microsoft.Mashup.Host.Document.Analysis.CachingDocumentAnalysisInfo.CachingPartitionAnalysisInfo.SetPreviewValue(EvaluationResult2`1 result, Func`1 getStaleSince, Func`1 getSampled)
at Microsoft.Mashup.DocumentHost.DocumentAnalyzer.Analyze(IPartitionAnalysisInfo partitionInfo, AccessRecorder recorder, EvaluationResult2`1 result, Action`1 callback)
at Microsoft.Mashup.DocumentHost.DocumentAnalyzer.<>c__DisplayClass10.<BeginAnalyzeDocumentPartition>b__d(EvaluationResult2`1 result)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose(Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose[T](Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.LimitedDocumentEvaluatorFactory.Evaluation`1.Complete(EvaluationResult2`1 result)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose(Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose[T](Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.LimitedDocumentEvaluatorFactory.Evaluation`1.Complete(EvaluationResult2`1 result)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose(Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose[T](Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.DocumentEvaluator.<>c__DisplayClass3`1.<BeginGetResult>b__0(EvaluationResult2`1 result)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose(Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.Interface.EvaluationResultExtensions.InvokeThenOnDispose[T](Action`1 callback, EvaluationResult2`1 result, Action action)
at Microsoft.Mashup.Evaluator.LimitedDocumentEvaluatorFactory.Evaluation`1.Complete(EvaluationResult2`1 result)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.RemoteEvaluation`1.TryComplete(EvaluationResult2`1 result)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.PreviewValueSourceRemoteEvaluation.GetResult(Boolean enableFirewall)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.RemoteEvaluation.Evaluate(Boolean enableFirewall)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.EvaluationThread(Object state)
at Microsoft.Mashup.Evaluator.GlobalizedEvaluatorThreadPool.<>c__DisplayClass4.<Start>b__3(Object s)
at Microsoft.Mashup.Evaluator.EvaluatorThreadPool.EvaluatorThread(Object state)
at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass2.<CreateThreadStart>b__0(Object o)
at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass15.<CreateAction>b__14(Object o)