I want to get the report as shown here https://prnt.sc/oG7ms7tOdVfH
The input is Country = USA
Date from and Date to
But this gives non US states and it doesnt summarize the resuly by state names (not the state IDs)
Can anyone help me to get the REST API?
curl "https://googleads.googleapis.com/v10/customers/${CUSTOMER_ID}/googleAds:searchStream" \
--header "Content-Type: application/json" \ --header "developer-token: ${DEVELOPER_TOKEN}" \
--header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
--data '{ "query": "
SELECT
PERFORMANCE COST
FROM LOCATION
WHERE
COUNTRY = 'USA' AND
segments.date BETWEEN 20220101 AND 20220430
" }'
Related
Why is iOS not delivering push notifications to my device?
I am sending a push notification using curl, like so:
curl -v \
--http2 \
--header "apns-push-type: alert" \
--header "apns-priority: 10" \
--header "authorization: bearer $jwt" \
--header "apns-topic: ${BUNDLEID}" \
--data '{"aps": {"content-available": 1, "interruption-level": "active"}, "alert": {"title":"title", "body": "body"}}' \
"${URL}"
Unfortunately, when I look in Console.app, I see the log:
[uk.orth.pushExampleTemporary] Received remote notification request FDCA-F040 [ waking: 0, hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 pushType: Alert]
[uk.orth.pushExampleTemporary] NOT requesting DUET deliver content-available, non-notifiying push notification FDCA-F040 [pushType: Alert willNotifyUser: 0]
[uk.orth.pushExampleTemporary] NOT delivering non-notifying push notification FDCA-F040 [pushType: Alert willNotifyUser: 0]
JSON structure problem
I've noticed that I set the data payload to be something slightly wrong 😢, which was caused by formatting my payload in bash instead of a type in programming language.
The line containing the payload (--data) should look like:
--data '{"aps": {"content-available": 1, "alert": {"title":"title", "body": "body"}}}' \
Avoiding this problem in the future
I've moved over to using a json file (ios_alert_message.json) to avoid these types of errors, using the curl command:
curl -v \
--http2 \
--header "apns-push-type: alert" \
--header "apns-priority: 10" \
--header "authorization: bearer $jwt" \
--header "apns-topic: ${BUNDLEID}" \
--header "Content-Type: application/json" \
--data #"$CURRENT_DIR/ios_alert_message.json" \
"${URL}"
Not getting Build job details/status of the PR when using Bitbucket API for any pull request
Here is my API URL:
https://example.com/rest/api/1.0/projects/{projectkey}/repos/{reposlug}/pull-requests/{pullrequestID}
How Build status looks like on GUI:
I also tried below methods to get the Build status but no luck
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
So I wanted to get whether build status of any PR whether it is Success or Fail
Thanks in Advance for your answers.
The build status is on the commit, not on the PR. First you should find the latest commit of the source branch by calling /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}. see the docs for more details
Once you have the commit id you can query the build-status api by calling /rest/build-status/1.0/commits/{commitId}. See the docs for more details
Using API 2.0
Get statuses: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/statuses
Set status: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses/build
Example:
curl --request GET \
--url https://api.bitbucket.org/2.0/repositories/piavita/com.piavita-vet.ios/pullrequests/300/statuses \
--header 'Authorization: Basic SecretKey' \
--header 'Content-Type: application/json'
curl --request POST \
--url https://api.bitbucket.org/2.0/repositories/piavita/com.piavita-vet.ios/commit/8619291af393/statuses/build \
--header 'Authorization: Basic SecretKey' \
--header 'Connection: keep-alive' \
--data '{\n "url": "http://jenkins.ddns.net:8080/job/jobName/123/",\n "state": "SUCCESSFUL",\n "key": "JENKINS"\n}'
curl -X PUT
-H "Content-Type: application/json"
-d
'{ “Owner”: { "id" : "root" } }'
-H 'Authorization: token XXX_Token_XXX'
'http://XXX_RT_URL_XXX/REST/2.0/ticket/6'
This command works for updating values of a ticket at the top level of JSON, but values such as 'Owner' fails. The documentation does not denote any method as to update these specific fields. What is the recommended way to update a ticket's Owner field via the Request Tracker REST API 2.0 (rt-extension-rest2)?
Try with the username as the value:
curl -X PUT
-H "Content-Type: application/json"
-d
'{ “Owner”: "root" }'
-H 'Authorization: token XXX_Token_XXX'
'http://XXX_RT_URL_XXX/REST/2.0/ticket/6'
That should accept a username or user ID.
First I got a token using curl command as shown here. Then used this token to authorize swagger and tried some endpoints, but all of them responded with
{
"status": 401,
"message": "Authentication failed",
"errorCode": 10,
"timestamp": 1490619586352
}
On server side I get this exception:
2017-03-27 13:31:16,149 [http-nio-0.0.0.0-8080-exec-9] ERROR o.t.s.s.s.m.token.RawAccessJwtToken - Invalid JWT Token io.jsonwebtoken.MalformedJwtException: Unable to read JSON value: ��!L��ȉ
I also tried this with curl, with the same results, using this syntax:
curl -X GET --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'X-Authorization: MY_TOKEN' 'http://MY_SERVER:MY_PORT/api/tenants?limit=3'
where I changed MY_TOKEN, MY_SERVER and MY_PORT appropriately for my server.
It seems that a parameter(Bearer) was missing from one of the headers. It should be --header 'X-Authorization: Bearer MY_TOKEN'. When I added it the responses were as expected. So the complete command for curl is:
curl -X GET --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'X-Authorization: Bearer MY_TOKEN' 'http://MY_SERVER:MY_PORT/api/tenants?limit=3'
When i used CURL post from console then its work but when i used linkedin gem method in controller then its not working and get error regarding access token. Where is wrong here not findout.
CURL Code
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"comment":"hello from google www.google.com! http://ibm.com","visibility":{"code":"anyone"}}' https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=AQVxxxxJXygzp_8Exxxxg7_7FaxxxxxxtWzBXAxxxxxa5z1MVK6-kubHJ5JIaGAxxxx234wndpAMc_CxmCsIHxxxxraleZqkU0t_WNEhxxxz8_cKpeOixxxxsd15-X-MdvzYVxxxx9hQ&format=json&title=linkedin HTTP/1.1
LinkedIn gem code
client = LinkedIn::Client.new(
config[:your_consumer_key],
config[:your_consumer_secret]
)
client.authorize_from_access(
config[:oauth_user_token],
config[:oauth_user_secret]
)
client.add_share(
comment: 'Good Morning',
content: {'submitted-url' => 'http://www.github.com/blazeeboy' }
)
Any one have a idea where is wrong here.
============= UPDATE =============
system 'curl -H "Content-Type: application/json" -H "authToken: auth_token" --data '{"comment":"hello from google www.google.com! http://google.com","visibility":{"code":"anyone"}}' https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=AQVxxxxygzp_8E3ySvg7_7FahixxxxxxtWzBXAja5OQ8a0wta5z1MVK6-kubHJ5JIxxxxwndpAMc_CxmCsIHxFlexxxxxleZqkU0t_WNxxxxmi7CMz8_cKpexxxx15-X-MdvzYVOxxxxm9hQ&format=json&title=linkedin HTTP/1.1'
Thanks
curl -H "Content-Type: application/json" -H "authToken: auth_token" --data '{}' https://api.linkedin.com/v1/people/~/shares
Try running this :
system "curl -H 'Content-Type: application/json' -H 'authToken: auth_token' --data '{'comment':'hello from google www.google.com! http://google.com','visibility':{'code':'anyone'}}' https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=AQVxxxxygzp_8E3ySvg7_7FahixxxxxxtWzBXAja5OQ8a0wta5z1MVK6-kubHJ5JIxxxxwndpAMc_CxmCsIHxFlexxxxxleZqkU0t_WNxxxxmi7CMz8_cKpexxxx15-X-MdvzYVOxxxxm9hQ&format=json&title=linkedin HTTP/1.1"
In rails when you use double quotes inside single quotes it gives error with some commands.
OR you can try like this :
`curl -H 'Content-Type: application/json' -H 'authToken: auth_token' --data '{'comment':'hello from google www.google.com! http://google.com','visibility':{'code':'anyone'}}' https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=AQVxxxxygzp_8E3ySvg7_7FahixxxxxxtWzBXAja5OQ8a0wta5z1MVK6-kubHJ5JIxxxxwndpAMc_CxmCsIHxFlexxxxxleZqkU0t_WNxxxxmi7CMz8_cKpexxxx15-X-MdvzYVOxxxxm9hQ&format=json&title=linkedin HTTP/1.1`