$select parameter not working on Microsoft Graph API share calendar (cURL) - rest

When using the following URL in Microsoft Graph Explorer, I can see a list of my Calendar Event's with only the subject field returned as JSON.
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2022-06-17T16:37:48.171Z&enddatetime=2022-06-24T16:37:48.171Z&$select=subject
When doing the same for a resource's Calendar, all the information is returned instead of just the subject field.
curl -H "Authorization: Bearer <BEARER_TOKEN>" "https://graph.microsoft.com/v1.0/users/<CALENDAR_SMTP>/calendarView?startdatetime=2022-06-17T16:37:48.171Z&enddatetime=2022-06-24T16:37:48.171Z&$select=subject"
Am I doing something wrong in cURL or doesn't $select work on other users' calendars?
Any help would be appreciated.

Solved - Skipped the $ in cURL and it worked.
curl -H "Authorization: Bearer <BEARER_TOKEN>" "https://graph.microsoft.com/v1.0/users/<CALENDAR_SMTP>/calendarView?startdatetime=2022-06-17T16:37:48.171Z&enddatetime=2022-06-24T16:37:48.171Z&select=subject"

Related

Thingsboard : How to retrieve JWT Token and define expiry time?

I am just studying the Thingsboard IoT platform features.
And we know that to retrieve JWT Token for a user, we should POST following API command,
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{"username":"xxxxx#gmail.com", "password":"xxxxxx"}" "https://thingsboard.cloud/api/auth/login"
The timeout for this JWT token is set to "9000" sec by default.
How can we modify this Token expiry time?
Your help would be appreciated.
Thank you.
This should be configured as part of security.jwt.tokenExpirationTime
https://thingsboard.io/docs/user-guide/install/config/
You should probably need to use the refresh token to keep your session logged in via /auth/token

how to generate custom Auth token from api key

I am looking at the documentation at
[https://firebase.google.com/docs/reference/rest/auth/][1]
for how to exchange firebase id and refresh token with my API key.
In the documentation, I found the sample code and some explaination as below,
curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=[API_KEY]' \
-H 'Content-Type: application/json' \
--data-binary '{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}'
In the example above, you would replace [API_KEY] with the Web API Key of your Firebase project, [CUSTOM_TOKEN] with the generated custom Auth token.
Anyone know how can I get the "custom Auth Token" as mentioned in the above sample?
Thanks
Think it is explained here: https://firebase.google.com/docs/auth/admin/create-custom-tokens
And if you need to cook up something yourself then specifically: https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library

How to use Curl to make a POST request with Dropwizard

I have Dropwizard backend end and like to use curl to make a POST request with a Json body
I used Postman with the settings on the body tab raw radio button selected and on the drop down menu JSON(applicattion/json).I entered the body and was able to successfully create a POST request.
However when I used curl I get an error. I used
curl -v -X POST "localhost:8080/resource"
-H "Content-Type: application/json"
-d '{label1: "words1", label2: "words2"}'
I get the error message
{"code":400,"message":"Unable to process JSON"}
From my understanding it is curl that has an issue since Postman was able to create the POST request.
This
{label1: "words1", label2: "words2"}
is not JSON. Use
{"label1": "words1", "label2": "words2"}

How to POST an updated config.xml using Jenkins REST API?

I wanna write a groovy script to bulk update my job configuration using Jenkins REST API. But I am quite confused by its API doc (http://localhost:8080/jenkins/job/my_job_name/api/).
Fetch/Update config.xml
To programmatically obtain config.xml, hit this URL. You can also POST an updated config.xml to the same URL[http://localhost:8080/jenkins/job/my_job_name/config.xml] to programmatically update the configuration of a job.
How am I gonna POST an xml file to an url mentioned above?
The below curl command works for me.
curl --user $USER:$API_TOKEN -X POST http://localhost:8080/job/test/config.xml -H 'Content-Type: application/xml' --data-binary "#mymodifiedlocalconfig.xml"
curl -X POST -H 'Content-Type: application/octet-stream' http://<ip>/job/<job name>/config.xml --user uname:upass --data-binary #./test.xml
Many answers set Content-Type: application/xml, and it didn't work in my Jenkins. I try to set Content-Type: application/octet-stream and it work successfully.
I tried cURL and it worked.
curl -F "file=#updated_config.xml" "http://localhost:8080/jenkins/job/my_job_name/config.xml"
Note: U will need to toggle off "Prevent Cross Site Request Forgery exploits" in Jenkins config.

Uber Rush API Sandbox

Trying to test Uber Rush API (from localhost and from linux server).
Calling Token works - I get the token
trying to implement sanbox example:
curl -X "PUT /v1/sandbox/deliveries/{delivery_id}" \
-H "Authorization: Bearer <OAUTH TOKEN>" \
-d "{\"status\":\"en_route_to_pickup\"}"
with url https://sandbox-api.uber.com/
and I tried the same request with file_get_contents (in PHP)
So, I always get error "405 Method Not Allowed"
{"message":"Method not supported for this endpoint.","code":"method_not_allowed"}
What I need to do to get access to method from this sandbox example https://developer.uber.com/docs/rush/sandbox?
Corrent syntax
curl -X "PUT" -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" -d "{\"status\":\"en_route_to_pickup\"}" https://sandbox-api.uber.com/v1/sandbox/deliveries/DELIVERY_ID
EDIT: Updated to reflect both issues in your question...
You have a mismatch in your requests and an incorrect syntax for curl.
First off your CURL request is incorrectly specified. It should be:
curl -X "PUT" -H "Authorization: Bearer <OAUTH TOKEN>" -d "{\"status\":\"en_route_to_pickup\"}" https://sandbox-api.uber.com/v1/sandbox/deliveries/{delivery_id}
In addition, your curl command is trying to issue a PUT request to the uber sandbox PUT API. However, your PHP code is not setting the context correctly and so is probably issuing a GET request. I suspect that the server is therefore rejecting the request as a GET as not allowed to do this sort of operation.
To fix it, see Bad request using file_get_contents for PUT request in PHP. This should give you an example of how to pass in the necessary context to issue a PUT request using file_get_contents().