I have tried the below commands to get the excel file automatically from jira but I'm getting different data other than the filter data.
wget --user username--password pass -O test.xls --ignore-length=on http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000;
curl -D my-output.xml -u upgrade:hjjKl801 -X GET -H "Content-Type: application/json" http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000
Please help me here.
You have to set correct encoding header gzip :
curl -D my-output.xml -u upgrade:secret -X GET -H "Content-Type: application/json" -H "Accept-Encoding: gzip" "http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000"
Some notes:
Remove password from your example
-D flag for curl dumps headers, not output. Did you mean -o maybe?
Content-Type header can be skipped
To be on the safe side, put the url in double quotes
You can copy request from Google Chrome using developer tools
I can't get Wget work in my environment (permission denied error; maybe because of SSO?) but following curl command .
"D:\DSUsers\uid41890\Tools\curl.exe" -o C:\Users\uid41890\Documents\JIRA\search.csv -u uid41890:password -X GET "http://jiraurl:port/sr/jira.issueviews:searchrequest-csv-current-fields/17899/SearchRequest-17899.csv"
No need for Header options as mentioned in #grundic's answer.
Replace -D by -o in your original command and change the output file format from xml to csv for example.
You must use -O flag as:
curl -o excel.xls -O -u upgrade:hjjKl801 -X GET -H "Content-Type: application/json" http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000
Related
If I run below http script from the graph.microsoft.com docs, it works fine.
POST https://graph.microsoft.com/v1.0/groups/9746dce-f530182/members/$ref
Content-type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6Il9Y-pCiTwLhttVX5wg
{
"#odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/e7cb-2f96bba6"
}
where:
9746dce-f530182 = group-id,
e7cb-2f96bba6 = user-id and
eyJ0eXAiOiJKV1QiLCJub25jZSI6Il9Y-pCiTwLhttVX5wg = auth-token
I would like to run this as a bash script, so that I can automate the token generation and the POST call. My script looks like so.
CLIENT_ID='283f4d25-87bde0ef'
TENANT_ID='2d987312-a4ff5ea0'
CLIENT_SECRET='XSY8Q~4Ls-ahi'
GROUP_ID="9746dc-00182"
USER_ID='e7cb46-bbbba6'
AT_URL="https://login.microsoftonline.com/${TENANT_ID}/oauth2/token"
auth_response=$(curl -X POST -d 'grant_type=client_credentials&client_id='${CLIENT_ID}'&client_secret='$CLIENT_SECRET'&resource=https://graph.microsoft.com' $AT_URL | jq .)
token="$(echo $auth_response | jq -r .token_type) $(echo $auth_response | jq -r .access_token)"
curl -H "Authorization: $token" -H "Content-type: application/json" -d '{"#odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/'$USER_ID'"}' "https://graph.microsoft.com/v1.0/groups/$GROUP_ID/members/$ref"
But this fails with the below error. What am I missing?
{"error":{"code":"Request_BadRequest","message":"Unsupported resource type 'DirectoryObject' for operation 'Create'.","innerError":{"date":"2022-05-25T11:24:21","request-id":"e189dc-063e","client-request-id":"e189d-2e42063e"}}}
I managed to fis the issue by changing the last line of the script to the following. The problem was that the $ref at the end of the URL was treated as a bash variable.
curl -H "Authorization: $token" -H "Content-Type: application/json" -d '{"#odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/'${USER_ID}'"}' 'https://graph.microsoft.com/v1.0/groups/'$GROUP_ID'/members/$ref'
Hope this helps someone else.
The final script looks like below
CLIENT_ID='283f4d25-87bde0ef'
TENANT_ID='2d987312-a4ff5ea0'
CLIENT_SECRET='XSY8Q~4Ls-ahi'
GROUP_ID="9746dc-00182"
USER_ID='e7cb46-bbbba6'
AT_URL="https://login.microsoftonline.com/${TENANT_ID}/oauth2/token"
auth_response=$(curl -X POST -d 'grant_type=client_credentials&client_id='${CLIENT_ID}'&client_secret='$CLIENT_SECRET'&resource=https://graph.microsoft.com' $AT_URL | jq .)
token="$(echo $auth_response | jq -r .token_type) $(echo $auth_response | jq -r .access_token)"
curl -H "Authorization: $token" -H "Content-Type: application/json" -d '{"#odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/'${USER_ID}'"}' 'https://graph.microsoft.com/v1.0/groups/'$GROUP_ID'/members/$ref'
I have in my Flutter project APIs that use cookies and they don't work. I have enabled the interceptor that generates the curl:
CurlLoggerDioInterceptor (printOnSuccess: true)
with the following result:
curl -i \
-H "Accept: application / json" \
-H "Connection: keep-alive" \
-H "cookie: ci_session = uv0hts7fb8us0r7m5vvaa64p4o89u9he" \
-H "Authorization: 1652292531" \
"http://xxxxx.it"
And this works on shell. I don't understand, why the curl generated by Dart code works and the code itself doesn't work?
Regarding the code I've used all the solutions in this link (dio_cookie_manager, NetworkService, HTTP request instead of dio...) How do I make an http request using cookies on flutter?
With Dio is not possible, but with the following library yes:
flutter_curl: ^0.1.1
I am trying to create a service in hdfs-plugin. I am refering this link.
I have tried below curl command:
curl -H "Content-Type: application/json" -X POST -d '{"configs": {"password": "*****","username": "admin"},"description":"hdfsservice","isEnabled": true,"name": "hadoopdev","type": "test","version": 1}' http://localhost:6080/service/public/v2/api/service
When I ran this it didn't give any response, not even any error.
Can someone help me to know if this is the correct curl or not?
My current shell script is following:
#!/bin/sh
LINES_OF_CODE=10792
curl -i -X POST -H "Content-Type:application/json" http://a:bc#lb.mycompany.org/api/public/metrics/ -d '{"project_public_id":"myprojectid", "type":"loc", "value":'$LINES_OF_CODE', "platform":"ios"}'
but it is hardcoded... is there any way to count number of lines dynamically?
I'm trying to test making a post request with cURL passing a file into nested params, but having a hard time getting the flags/ordering correct:
curl -i -H "Authorization: <access_str>" -H "Accept: application/json"
-H "Content-Type: application/json" -X POST -d '{"data": {"photo":
"#/Users/colin/Desktop/mastiff.jpg"} }' localhost:3000/api/v1/blah/blah
I feel like I either need a --data-binary or -F or both maybe? The server is just getting the nested params as a string and not as a multipart file
{"data"=>{"photo"=>"#/Users/colin/Desktop/mastiff.jpg"}
curl -i -H "Authorization: <access_str>" -X POST -F
'data[photo]=#/Users/colin/Desktop/mastiff.jpg'
localhost:3000/api/v1/data/data/data
Don't even need to specify that it's JSON. Next step is trying to pass two photos in the same field. The problem now is that passing a second file results in a massive binary string.