Trying to use the new POST API from linkedin, to get all the posts for an organization described in the doc here
Both CURL and HTTP requests gives me a 403 with the following message "Field Value validation failed in PARAMETER: Data Processing Exception while processing fields [/author]"
curl -X GET 'https://api.linkedin.com/rest/posts?author=urn%3Ali%3Aorganization%$XXXXX&isDsc=false&q=author&count=10' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: 202210' \
-H 'X-RestLi-Method: FINDER' \
-H 'Authorization: Bearer {TOKEN}'
Tried to remove the X-Restli-Protocol-Version header as per this thread, but didn't help much.
Thanks in advance !
Related
I am trying to access my Firestore database using cURL from a terminal session. I have read through the REST API documentation for Firestore and the Authentication documentation for authenticating Oauth and services accounts. I have set up a services accounts and IAM roles in API dashboard. I cannot determine from the documentation what the correct path and syntax and what do use for the API Key and the BEARER token. For example, I am trying to receive a json response for the USER xyz, document field FNAME that is stored in a Firestore DATABASE (note - where do i find the the databaseID?) that is in PROJECT testproject.
Here is the CURL command lists in the documentation -
curl \
'https://firestore.googleapis.com/v1beta1/%5BNAME%5D?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
curl --request POST \
'https://firestore.googleapis.com/v1beta2/%5BNAME%5D:exportDocuments?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{}' \
--compressed
Questions are - what do I use for the [YOUR_API_KEY] ?
What do I use for the [YOUR ACCESS TOKEN] -
I have tried the following from credentials for a Service account that I set up
Service account - Key - 3......................e76
Unique ID - 1............39
for the API KEY and the ACCESS TOKEN and get a 403 error back
I also have a Oauth credentials -
Client ID - 2.....113-95.......cpqrarqb.....qnrpc.apps.googleusercontent.com
Client Secret - L......lq
PATH
https://firestore.googleapis.com/v1/projects/{project_id}/databases/{database_id}/collectionGroups/{collectionId}/fields/{field_id}
Which didn't work either...
Again, I am trying to access and read and write data to my Firestore database using CURL - as a proxy for what will be my REST API's. Any help and assistance much appreciated.
From the curl commands you have pasted I understand that you want to export your firestore collections to a Cloud Storage bucket. Furthermore I understand you obtained the curl commands from the api explorer of the exports method.
To provide an api key value to [YOUR_API_KEY], you first need to create an api key in your GCP project; here is the process:
Go to the credentials section.
Click on the option at the top called 'Create Credentials'.
Select API key.
Copy and keep safe the value thrown by the Cloud Console (this is your api key).
If you want to know more about API keys, you can visit this.
To provide an oauth token value, you can do the following:
You can open Cloud Shell.
Run command gcloud auth application-default print-access-token.
Copy and keep safe the value thrown by Cloud Shell (this is your oauth token).
Please note that there are several ways to create an oauth token but the one I specified is the fastest one. You may also use the oauth playground to generate your token; keep in mind that the token is valid for 60 minutes.
As per the database id I have used (default) and here I include my curl statement:
curl --request POST \
'https://firestore.googleapis.com/v1/projects/[PROJECT_ID]/databases/(default):exportDocuments?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"collectionIds":["users"],"outputUriPrefix":"gs://[BUCKET_PATH]"}' \
--compressed
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'
I tried generating a cURL request from Postman (using code option of postman).
As the request contains an input pdf file, there are certain header properties that are being added by postman.
Below is the curl that is generated (almost similar, changed some header for security reasons), response received 500, internal Server Error, "Current request is not a multipart request"
http://localhost:8080/test \
-H 'Accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded,multipart/form-data; boundary=--------------------------895926775956600620357522' \
-H 'Some-Key: abcd' \
-H 'cache-control: no-cache' \
-F file=#/C:/path/to/my/file/abc.pdf
If you want to send the multipart request in Postman, you just need to do the following:
Don't specify a Content-Type in Header.
In Body tab of Postman you should select form-data and select file type
Read more here.
I am trying to send this HTTP request in Postman application:
curl -v https://api.someurl.com/z1/lists \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: authorization" \
-d '{ "list_id": "DXVBDAD" }'
Any body knows what -d stands for? and where should I put it in Postman?
The documentation says this:
(HTTP) Sends the specified data in a POST request to the HTTP server[...]
So this will be the body of your POST request. In Postman you have to put it into the 'body' field. There select 'raw' and then select 'application/json'.
Because that's the Content-Type of your request, specified with -H.
The -d or --data option makes the curl command send data in POST request to the server. This option makes the curl command pass data to the server using content-type (JSON in your case) just as the browser does when a user submits a form.
I'm using openam OAuth/OpenID for user authentication. As mentioned in the documentations, I could get SSOTokenID as a JSON object by making following HTTP request.
curl -X POST -H "X-OpenAM-Username: demo" -H "X-OpenAM-Password: changeit" -H "Content-Type: application/json" -d '' -k -v https://openam.example.com:8443/openam/json/authenticate?realm=/
Instead of that, I want to get SSOTokenID as the Set-Cookie header value of the HTTP response. Are there anyway that i can do it?
Assuming you are only using an authentication module that accepts a NameCallback and PasswordCallback (as you used in your example), then you can just use the legacy UI zero-page login , you need to disable XUI though
Using your example
curl -X POST -d 'IDToken1=demo&IDToken2=changeit' -k -v https://openam.example.com:8443/openam/UI/Login?realm=/