Linkedin Api sample AdSupplyForecast does not work - linkedin

Nowadays I am working on Linkedin AdSupplyForecast api to follow at the below reference,
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/advertising-targeting/ad-supply-forecasts#find-supply-by-criteriav2
However the sample code does not work also I can not find any extra description about criteriaV2.
Standart Api sample at the below and response is '{"message":"Invalid HTTP Request","status":404}'
curl -H "Authorization:Bearer XX" -H "Content-Type:application/json" "https://api.linkedin.com/v2/adSupplyForecasts?q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A518121035&timeRange=(start: 1587639976000,end: 1589540776000)&campaignType=SPONSORED_UPDATES&competingBid=(bidType:CPM,bidPrice:(currencyCode:USD,amount:10))&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3AcountryGroup%3ANA))))),exclude:(or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%2810001%2C2147483647%29))))"
I modified it and like as at the below but it send server error '{"message":"Internal Server Error","status":500}', would you share with me a correct sample of it ?
curl --location --request GET 'https://api.linkedin.com/v2/adSupplyForecasts?q=criteriaV2&account=urn:li:sponsoredAccount:518121035&timeRange.start=1587639976000&timeRange.end=1589540776000&campaignType=SPONSORED_UPDATES&targetingCriteria.include=and:List%28%28or:%28{encoded%20urn:li:adTargetingFacet:locations}:List%28{encoded%20urn:li:countryGroup:NA}%29%29%29%29&targetingCriteria.exclude=or:%28{encoded%20urn:li:adTargetingFacet:staffCountRanges}:List%28{encoded%20urn:li:staffCountRange:%2810001,2147483647%29}%29%29' \ --header 'Authorization: XXX'

Related

How can i make GET request with this kind of API's on Sim800

I can do single line GET requests with sim800 but I couldn't understand to use this API.
curl --request GET \
--url 'https://api.collectapi.com/pray/all?data.city=istanbul' \
--header 'authorization: apikey 3tXXXMYAPIKEYq9:1RxvCMYAPIKEYgAG' \
--header 'content-type: application/json'
It shows me how to use it with curl but I can't understand how can I make this as single line on Sim800
AT+HTTPINIT<\r><\r><\n>OK<\r><\n>
AT+HTTPPARA="CID",1<\r><\r><\n>OK<\r><\n>
AT+HTTPPARA="URL","https://api.collectapi.com/pray/all?data.city=kahramanmaras"<\r><\r><\n>OK<\r><\n>
AT+HTTPPARA="USERDATA","authorization: apikey 3tvAtuSxxxxxx4zDlq9:1RxvC4fQTxxxxxGbgAG"<\r><\r><\n>OK<\r><\n>
AT+HTTPPARA="CONTENT","application/json"<\r><\r><\n>OK<\r><\n>
AT+HTTPACTION=0<\r><\r><\n>OK<\r><\n>
<\r><\n>
+HTTPACTION: 0,603,0<\r>
I'm doing something wrong but I don't understand :(
Try the at+httpread command to find out what is the error is it looks like a custom error rather than a HTTP error

How to get data with curl

I have a page which i need to submit a number and after that i get data from that number
page is like:
http://page/
and after submit form request URL changes to:
http://page/services/getData
but method is something like:
http://page/services/getData?method=search&1234
can someone helped me to pull data showed in http://page/services/getData?method=search&1234 with curl?
I've already tried:
curl -v -H "Content-Type: application/json" -X POST \ -d http://page/services/getData?method=search&1234
curl -o http://page/services/getData?method=search&1234
curl --data http://page/services/getData?method=search&1234
I was looking for hours but i just posted the question and i get what i wanted:
curl --request GET --url 'http://page/services/getData?method=search&1234'

WordPress 4.7 REST API Example Request does not work

I'm using successfully the WordPress 4.7 REST API in this way:
curl -H "Authorization: Basic mykey" -X POST --data-urlencode "title=Something" www.myhost.com/wp-json/wp/v2/posts/770
The example in the new docs suggests:
curl -X POST http://demo.wp-api.org/wp-json -d '{"title":"My New Title"}'
which obvious is a wrong endpoint. Adapting to
curl -H "Authorization: Basic mykey" -X POST www.myhost.com/wp-json/wp/v2/posts/770 --data-urlencode '{"title":"My New Title"}'
does not change the title but simply returns the post as JSON
Any idea?
Came over my own question, which I did resolve a long time ago. Just if someone struggles with this too.
First of course, posting data with curl requires the -d option an not the --data-urlencode. Second, the REST endpoint needs to know the type of data. Here JSON. So setting the correct Content Type is essential.
This is a complete example:
curl -H "Authorization: Basic mykey>" -H "Content-Type: application/json" -X POST -d '{"title":"Something"}' www.myhost.com/wp-json/wp/v2/posts/770

why the API generated by AM is not invoked as the following error logs

I configured the API by AM and I configured the Production Endpoint to https URL.After the API was published ,I invoked it by curl command as the following.
curl -X GET --header 'Accept: application/json' --header 'client-id: vnet40000001' --header 'Authorization: Bearer a1819578-550c-37bf-8da2-6c8b197a571f' 'https://localhost:8243/1.0.8/common8/claim?vid=462cdd20-d22f-11e6-8085-f5947f55f361'
the error logs as the following
<am:fault xmlns:am="http://wso2.org/apimanager"><am:code>101500</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Error in Sender</am:description></am:fault>
then what causes the problem?

MismatchSenderId even when it's correct

I'm following this tutorial https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/#send_a_request_from_the_command_line_for_fcm_to_push_a_message
I did everything as is instructed there so far. However when I do a curl request I get back
{"multicast_id":6771552758811002436,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
I checked it billion times I have put correct senderId in my manifest.json in "gcm_sender_id"
So why would I get such error?
Here are some more details.
In the tutorial it says to get the keys from FCM console in cloud messaging
This is how my manifest.json looks like
{
"name":"Push Notifications codelab",
"gcm_sender_id":"773185791049"
}
And this is how I send the request
curl --header "Authorization: key=AIzaSyCQHb2t8c3N255bH_CVmGych5QcNntFxYg" --header "Content-Type: application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"APA91bE4RJ7_9m2eJ_zlg1F90bLjVX8ctVpCBN24ElAXF--4wS_nnxg4LzkbJWeTe-peMN_StmOaQTEoGeCCNZE5Mssux3T-KbfGRVmRWzeQZM8opfUyv7FVjI9iEfETHG3O7i1qkIb-\"]}"

Resources