Thanks for your reply JRahm ,
I have tried a Post as opposed to a Put method call & the API return message is different. Maybe a hint at what im doing wrong ?
With Put:
{"code":400,"message":"Failed! exit_code (37).\n","errorStack":[],"apiError":26214401}
With Post:
{"code":400,"message":"Found unexpected URI tmapi_mapper/sys/file/ifile/MyFile.","errorStack":[],"apiError":1}
I can add that my authenticated user I get the API token with is a radius authenticated user and not local. The only diff ive seen with thee Curl examples ive followed/mentioned here + the python wrapper mentionred (which I tried to re-type to powershell as well) are that they use a local user with the "Authentication: Basic user:pass" header as opposed to 'X-F5-Auth-Token' in the header which im using.
I can manually create a system level iFile manually in the UI with this radius user (this is what im trying to automate via the API) & use the iControl Reest API to upload new content into the iFile, this works for me using the X-F5-Auth-Token radius user. So the writing of new content to an existing iFile works for me but not the creation thereof not.
I have access to a few/newer F5-LTM, my network SME granted me access to a V15.1.5 F5-LTM to rule out a possible issue with the F5 12.1.5 im working with at the minute (K69621049) which was resolved in revision 12.1.5 I initially thought that this was my issue. Both revisions of F5 I can test against (15.1.5 & 12.1.5) Im observing the exact same return codes from the API as at the top of this post.
Taken the above into account, can this be an issue for me that the radius / remote user might have an issue on this method of the API & is it worth asking my network SME to try create a local account to rule this out?
Ive tried constructing the "Authentication: Basic user:pass" header with my radius user but get a 401 authentication failed. So I feel I needed to specify this in the initial post but it was omitted due to loads of typing 🙂
Invoke-RestMethod : {"code":401,"message":"Authorization failed: user=https://localhost/mgmt/shared/authz/users/MyUser resource=/mgmt/tm/sys/file/ifile/MyFile verb=POST uri:http://localhost:8100/mgmt/tm/sys/file/ifile/MyFile
[REDACTEDIP]referrer:[REDACTEDIP]sender:[REDACTEDIP]","referer":"[REDACTEDIP]","restOperationId":122408205,"errorStack":["java.lang.SecurityException: Authorization failed: user=https://localhost/mgmt/shared/authz/users/ccfortinetsrv
resource=/mgmt/tm/sys/file/ifile/MyFile verb=POST uri:http://localhost:8100/mgmt/tm/sys/file/ifile/MyFile referrer:[REDACTEDIP] sender:[REDACTEDIP]","at
com.f5.rest.workers.EvaluatePermissions.failPermissionValidation(EvaluatePermissions.java:236)","at com.f5.rest.workers.EvaluatePermissions.completeEvaluatePermission(EvaluatePermissions.java:198)","at
com.f5.rest.workers.EvaluatePermissions.evaluatePermission(EvaluatePermissions.java:78)","at com.f5.rest.workers.ForwarderPassThroughWorker.onForward(ForwarderPassThroughWorker.java:227)","at
com.f5.rest.workers.ForwarderPassThroughWorker.onPost(ForwarderPassThroughWorker.java:502)","at com.f5.rest.common.RestWorker.callDerivedRestMethod(RestWorker.java:1120)","at com.f5.rest.common.RestWorker.callRestMethodHandler(RestWorker.java:1034)","at
com.f5.rest.common.RestServer.processQueuedRequests(RestServer.java:1355)","at com.f5.rest.common.RestServer.access$000(RestServer.java:45)","at com.f5.rest.common.RestServer$1.run(RestServer.java:316)","at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)","at java.util.concurrent.FutureTask.run(FutureTask.java:262)","at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)","at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)","at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)","at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)","at java.lang.Thread.run(Thread.java:748)\n"],"kind":":resterrorresponse"}
At line:1 char:11