Create Microsoft Teams with a service user failed in PowerAutomate - api

I try to create a Teams within Microsoft PowerAutomate. I'm using a service account and not a personal account.
When I try to create the Team I get the following error message:
Failed to execute Templates backend request CreateTeamFromTemplateRequest. Request Url:
https://teams.microsoft.com/fabric/emea/templates/api/team,
Request Method: POST, Response
Status Code: BadRequest, Response Headers: Strict-Transport-Security: max-age=2592000
x-operationid: ab1805082714544fae7c028c4bf6ca3b
x-telemetryid: 00-ab1805082714544fae7c028c4bf6ca3b-d35840089613e149-00
X-MSEdge-Ref: Ref A: 28FB6C881A1D4A659CE162BB06EB0F63 Ref B: VIEEDGE1108 Ref C: 2022-11-
23T10:55:35Z
Date: Wed, 23 Nov 2022 10:55:35 GMT
, ErrorMessage :
{"errors":[{"message":"Error when calling Middle Tier. Message: ''. Error
code: 'BadRequest'. Status code:
BadRequest.","errorCode":"Unknown"}],
"operationId":"ab1805082714544fae7c028c4bf6ca3b"}
When the user is global O365 Admin it works, but without those rights. I get this error message.
My question is what I'm doing wrong? What kind of rights need a service account to create Team? Only Global Admin?
Maybe somebody had a similar problem.
Thanks in advance Matthias

Related

Microsoft Graph AccessToken Renewal : "error_description":"AADSTS900144: The request body must contain the following parameter: 'resource'

I tried to renew the expired accesstoken using refresh token I getting the below error message.
{"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'resource'.\r\nTrace ID: \r\nCorrelation ID: \r\nTimestamp: 2022-10-20 05:09:46Z","error_codes":[900144],"timestamp":"2022-10-20 05:09:46Z","trace_id":"","correlation_id":"","error_uri":"https://login.microsoftonline.com/error?code=900144"}
can anyone explain what is the resource they are asking ?

Workday Rest API - POST Call For Work Email Change

I currently have a use case where I need to update work email for users in Workday using Workday Rest API. I have added all the required scopes and BP permissions but still have been receiving the below error when I try to do the POST staffing/workers/{ID}/workContactInformationChanges
{
"error": "not found: staffing",
"code": "S21"
}
Is there any additional permissions that need to be enabled in order to get access to the staffing api collection?
When I was setting up the connection to Workday I had included too much info in the connection URL and was getting this same error,
ex: https://wdX-impl-servicesX.workday.com/ccx/api/v1/XXXx1
Here is what I shortened it to:
ex: https://wdX-impl-servicesX.workday.com
This allowed the API call to construct the rest of the URL... otherwise it was constructing the URL incorrectly like this:
https://wdX-impl-servicesX.workday.com/ccx/api/v1/XXXx1/ccx/api/v1/XXXx1/filename

Telegram Bot API: getChatMember throws USER_ID_INVALID for valid user

I'm trying to find out if a specific User is present in a supergroup, in order to keep track of those who left.
For that, I'm calling the Bot API method getChatMember for each User and checking if their status is either Left or Kicked. However, I noticed that (recently?) I'm getting USER_ID_INVALID errors for many valid users that are either in the supergroup or have been in the past and then left. I also confirmed that those accounts are still active on Telegram.
Here's the HTTP request I'm sending:
POST https://api.telegram.org/botXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX/getChatMember HTTP/1.1
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
Content-Length: 46
Host: api.telegram.org
{"chat_id":-0000000000000,"user_id":000000000}
And here's the response I'm getting:
HTTP/1.1 400 Bad Request
Server: nginx/1.12.2
Date: Fri, 20 Apr 2018 04:17:32 GMT
Content-Type: application/json
Content-Length: 74
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection
{"ok":false,"error_code":400,"description":"Bad Request: USER_ID_INVALID"}
Any way I look at it, it looks like a perfectly valid request to me. And I haven't been able to find a common pattern between the users that throw this error.
What am I missing here?
EDIT: As #sean pointed out, having one of those users message the bot privately fixed the error for that particular user. But I'm absolutely sure that user was seen before because that's how I got his user ID. What could have caused the bot "forget" about him and how would I prevent this from happening in the future?
This error means your bot haven't seen this user before.
For instance, my user ID is 109780439, you can try getChatMember with #PublicTestGroup, it should response with 400 error.
And then, forward ANY of my message (e.g., this) to your bot, you will see the different result :)
You will create a variable who get your channel's result, like this:
$join : api.telegram.org/botYOURTOKEN/getchat .....
if($message && (strpos($join,'"status":"left"') or strpos($join,'"Bad Request: USER_ID_INVALID"') or strpos($join,'"status":"kicked"'))!== false) {
}

DRF JSON Token Authentication

I have to implement following features with RESTAPI:
register user
authorize user and get token
get user data by token
create user's post via token (Title, Body)
get user's posts via token
get all posts via token
user profile has to be customized - main fields are email/password
models.py:
http://pastebin.com/8V7CzrVi
serializers.py:
http://pastebin.com/W7Dn8Msn
views.py:
http://pastebin.com/L5ijkd5F
urls.py:
urlpatterns = [
url(r'^api/', include('app.urls')),
]
app.urls:
from .views import Register, UserList, UserDetail, PostList, PostDetail
from rest_framework_jwt.views import obtain_jwt_token
urlpatterns = [
url(r'^users/$', UserList.as_view(), name='user-list'),
url(r'^users/(?P<pk>[0-9]+)/$', UserDetail.as_view(), name='user-detail'),
url(r'^posts/$', PostList.as_view(), name='post-list'),
url(r'^posts/(?P<pk>[0-9]+)/$', PostDetail.as_view(), name='post-detail'),
url(r'^login/', obtain_jwt_token),
url(r'^register/$', Register.as_view()),
]
First question - please, review the code and tell, am I right in my realization? (THANKS A LOT for any corrections, hints and explanations)
Second one - how can I perform creating the post or viewing of post's list without any client code?
I mean following:
I am going into browserable API at api/register, enter email and password, hit post and get object of user
then I am going at api/login, enter email and password of the user just registered, hit post and get object with token - {'token': 'sometoken'}
then I am trying to create the post or get post's list, using httpie. In the console I enter -
http POST 127.0.0.1:8000/api/posts "Authorization: Token sometoken"
or
http GET 127.0.0.1:8000/api/posts "Authorization: Token sometoken"
and get:
HTTP/1.0 301 MOVED PERMANENTLY
Content-Type: text/html; charset=utf-8
Date: Sat, 03 Sep 2016 10:22:33 GMT
Location: http://127.0.0.1:8000/api/posts/
Server: WSGIServer/0.1 Python/2.7.11
X-Frame-Options: SAMEORIGIN
I do not understand how I can check every endpoint with using token.
Thanks!!!

Deleting Webhooks

I have a shop with permission to read|write both orders and products. I setup some Webhooks and now I want to delete them. I am getting back 401 errors.
Starting with 4 webhooks
Trying to delete webhook 1982492
Error nil, Failed. Response code = 401. Response message = Unauthorized.
Trying to delete webhook 1982494
Error nil, Failed. Response code = 401. Response message = Unauthorized.
Trying to delete webhook 1982496
Error nil, Failed. Response code = 401. Response message = Unauthorized.
Trying to delete webhook 1982498
Error nil, Failed. Response code = 401. Response message = Unauthorized.
Ended with 4 webhooks
So, how does one delete Webhooks set on products and orders?
Webhooks (and ScriptTags) that are created by an app are automatically removed when the app is uninstalled. It looks like that might be what is happening here.
If you are doing this in response to an app/uninstalled webhook, there is no reason. It's already handled!
If you remove the endpoint that the webhook connects to, it will be deleted after 19 attempts to connect to it.
From the shopify docs (http://wiki.shopify.com/WebHook#Automatic_Retries_and_Deletion)
If an error is returned or a timeout occurs when sending a webhook,
Shopify will retry the same request for 48 hours using an exponential
back-off approach. In total 19 attempts will be made to deliver the
information.
You can also just delete the app, it will remove the webhooks
Here’s a conversation with my Shopify console to show it working correctly:
$ shopify console
using iliketurtles.myshopify.com
irb(main):001:0> include ShopifyAPI
=> Object
irb(main):002:0> w = Webhook.create topic: "orders/create", address: "http://whatever.place.com", format: "json"
=> #<ShopifyAPI::Webhook:0x007f8ff1895778 #attributes={"topic"=>"orders/create", "address"=>"http://whatever.place.com", "format"=>"json", "id"=>2026848, "created_at"=>"2012-08-10T15:11:25-04:00", "updated_at"=>"2012-08-10T15:11:25-04:00"}, #prefix_options={}, #persisted=true, #remote_errors=nil, #validation_context=nil, #errors=#<ActiveResource::Errors:0x007f8ff18948c8 #base=#<ShopifyAPI::Webhook:0x007f8ff1895778 ...>, #messages={}>>
irb(main):003:0> w.destroy
=> #<Net::HTTPOK 200 OK readbody=true>
As others have mentioned, I think your issue is permissions related.