Error on add a teacher to a classroom - Failed Precondition - google-classroom

I've had problems to add teachers to a classroom. The problem happens in specific classrooms and I received a Precondition Error Message.
Request:
curl --request POST \
'https://classroom.googleapis.com/v1/courses/11115612909/teachers' \
--header 'Authorization: Bearer [YOUR_BEARER_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"userId":"ana.gomes#***"}' \
--compressed
Response:
{
"error": {
"code": 400,
"message": "Precondition check failed.",
"status": "FAILED_PRECONDITION"
}
}
I've already checked all the conditions described in the api reference, but everything is correct (quotas, group numbers, classroom numbers).

Related

Spring Boot and Spring Security Keyclock Integration - Error: connect ECONNREFUSED ::1:8180

I am doing Spring Cloud microservices development using link here - https://www.youtube.com/watch?v=LaZGedpfAyM&t=1279s and I was able to successfully make the GET request but for POST request I am getting the below error.
Source Code link - https://github.com/SaiUpadhyayula/springboot-microservices-project
I am not able to investigate as it seems as it seems issue at Keyclock?
CURL request -
curl --location --request POST 'http://127.0.0.1:8080/api/order' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwYkNvVGtKOE0tZmZLaXJ0OXRVRjFNSlFxVUJlaXA3YlJFVzY3akpBMmEwIn0.eyJleHAiOjE2MTg3NDk4MzUsImlhdCI6MTYxODc0OTUzNSwiYXV0aF90aW1lIjoxNjE4NzQ5Mzc3LCJqdGkiOiJmZDZmYmEwZC1kMjg5LTRjMDEtYTc5MS02NTU1MGJiOTJmOWIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgxODAvYXV0aC9yZWFsbXMvbWljcm9zZXJ2aWNlcy1yZWFsbSIsImF1ZCI6ImFjY291bnQiLCJzdWIiOiIzZGU0YmY1NC0xYjUxLTQwZDMtYTEzOC1iMTVlMDJiMzVjNTgiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJzcHJpbmctY2xvdWQtZ2F0ZXdheS1jbGllbnQiLCJzZXNzaW9uX3N0YXRlIjoiZTIzMGNkYzgtNDVhNi00YmE4LWJlMjMtMTkwNTEwMWQ1MzcyIiwiYWNyIjoiMCIsInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwibmFtZSI6InRlc3QgdXNlciIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3R1c2VyIiwiZ2l2ZW5fbmFtZSI6InRlc3QiLCJmYW1pbHlfbmFtZSI6InVzZXIiLCJlbWFpbCI6InRlc3R1c2VyQGdtYWlsLmNvbSJ9.DOeBxnCkL2jUuK_waq5JtOS-a3AD1y3C_hhirpA7lOU8xpgUujsXpjz3o53TJCAHHlxzC42wQ5oeFi6YXiSuuBRP9vpL6ePWYF3PtD2dgpZdkt5QT0BQiSjStGMY7xb4O8sd3BdRL_RkCpRx0GiV_rE4qZcQBHqdkarozOoq23GmbFD0XT5C119EUVjwn2ZirmPzFWYODJp6H5ExDEV1xm6cdZXBJZGSM4tINNaZheV9AkkpFpySt_CD74Hbj0KwbjJMCSGB5hNA0ZLEozjV14FinJrEUlcW8hBogY2Rd-XPqb0lwAlkqdLQKqu0AMWZrl0AoM7YaasZHvB7uZHG2Q' \
--header 'Cookie: SESSION=9328910f-b82e-4fc9-9019-8ae9259aef8e' \
--data-raw '{
"orderLineItemsList" : [
{
"skuCode" : "iPhone 12",
"price": 1230,
"quantity" : 1
}
]
}'

Graph API List Channel Messages Returnng UnknownError after Protected API Request Approved

I am unable to get a good response, and having hard time finding Docs. Can't find a way to lookup the inner error code at all either. I get a token using
curl -L -X POST 'https://login.microsoftonline.com/51bcb6e4-b738-4e87-a795-768e3f13b94f/oauth2/v2.0/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_id=5bbd5786-31d3-4d84-a8d0-a0dac6522f93' \ --data-urlencode 'scope=https://graph.microsoft.com/.default' \ --data-urlencode 'client_secret=<secret>' \ --data-urlencode 'grant_type=client_credentials'
and then take the access_token value, and do this
curl -L -X GET 'https://graph.microsoft.com/v1.0/teams/d89133ea-bf32-4957-8300-aa5e083f45c1/channels/19:5b075a993aee4b3fa8f23be2cbb3b514#thread.skype/messages' \ -H 'Authorization: Bearer <token value from above>'
But I get this error 403:
{ "error": { "code": "UnknownError", "message": "", "innerError": { "date": "2021-03-09T19:15:23", "request-id": "c9a8cf3a-b914-44a8-a66a-506634f09d77", "client-request-id": "c9a8cf3a-b914-44a8-a66a-506634f09d77" } } }
how can I troubleshoot? the url for the GET seems right, based on all my research. we are using resource specific consent permissions, but the app is installed in the channel that I am trying to list messages. from
This question will be tracked from here.

How to change 'Content-Type: image/jpeg' using curl command in restapi?

Any one help me how to change 'Content-Type: image/jpeg' format.
header='-H "Content-Type: application/json" -H "Authorization: Bearer '$token'" -H "x-api-key: '$key'"'
data='-d "{"image": "https://example.com/demo/img/hd-001.jpg"}"'
URL=https://variant.example.com/api/vi
i want to change content type to image/jpeg format.
i am getting bellow error.
{
"invalid_body",
body."
}
400: syntax error: operand expected (error token is "{

Okta application just redirect to a url

One of our requirements Is provision an app to an Okta user so he can click the app box and just redirect to an url with some query string parameters, no login required, is this possible using Okta?
You can add a Bookmark Application using the Apps API:
curl -v -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
-d '{
"name": "bookmark",
"label": "Custom Bookmark App",
"signOnMode": "BOOKMARK",
"settings": {
"app": {
"requestIntegration": false,
"url": "https://example.com/bookmark.htm?your=query&params=stuff"
}
}
}' "https://${org}.okta.com/api/v1/apps"
Then assign that app to a user:
curl -v -X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
-d '{}' "https://${org}.okta.com/api/v1/apps/:appId/users/:userId"
To add on to kevlened's accepted answer, you can add a bookmark app through the Admin UI by going to Applications >> Applications >> Add Application >> search for "bookmark" from the application templates and you'll get the option to add a Bookmark App. This works in Version 2018.07 and perhaps earlier.

How can I send a parse push to an installation id or device token

How can I use the Parse REST API to push to a specific deviceToken or installation Id? I make the request and it succeeds with a 200 response but I get no push.
curl -X POST \
-H "X-Parse-Application-Id: XYZ" \
-H "X-Parse-REST-API-Key: FOO" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceToken": "someId"
},
"data": {
"alert": "Willie Hayes injured by own pop fly."
}
}' \
https://api.parse.com/1/push

Resources