I'm trying to upload a video using multipart linkedin v2 asset upload api. After uploading all parts successfully. When i'm trying to complete the upload, it throws 401 error response.
Request
curl -v -X POST -H "Content-Type:application/json" -H "X-RestLi-Protocol-Version:2.0.0" "https://api.linkedin.com/v2/assets?action=completeMultiPartUpload&oauth2_access_token=xxxx" --data '{"completeMultipartUploadRequest":{"metadata":"abcdhjf lmmfk45322jnmdfmndk","partUploadResponses":[{"httpStatusCode":200,"headers":{"ETag":"d8b472e8f16603b7b6ca4a0cbb1653eb"}},{"httpStatusCode":200,"headers":{"ETag":"30a52d0e398863a1e47418c468ec8929"}},{"httpStatusCode":200,"headers":{"ETag":"92431e62823450eeb0def68024872882"}},{"httpStatusCode":200,"headers":{"ETag":"e6a9c6eacffd9d1f2532eac83d3208e3"}},{"httpStatusCode":200,"headers":{"ETag":"e6bfcf0807a71d63b48d58545101852c"}},{"httpStatusCode":200,"headers":{"ETag":"d355aa0d72c6787e9bfe5f66967c12ba"}},{"httpStatusCode":200,"headers":{"ETag":"1bc89f2c688b6abb970862a3326474fe"}},{"httpStatusCode":200,"headers":{"ETag":"9d89fff03e36ea12e4f0c842d3bb5431"}},{"httpStatusCode":200,"headers":{"ETag":"30f10c2baab55a0185eb396a06b86d39"}},{"httpStatusCode":200,"headers":{"ETag":"e1dc1eac95ab7ef51e38aeb7702b7e4f"}},{"httpStatusCode":200,"headers":{"ETag":"2365a3d1334953209611aef89739e751"}}],"mediaArtifact":"urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:abc123,urn:li:digitalmediaMediaArtifactClass:aws-userUploadedVideo)"}}'
Response
{"message":"com.linkedin.vector.assetmanager.logic.LogicLayerException: Enforced Tenant ACL result: false, for Tenant urn:li:digitalmediaTenant:5 and Method complete_multipartUpload","status":401}
Can anyone help to resolve this?
I had this issue and reached out to LinkedIn. They just told me they fixed it on their end, and when I try to complete my multipart upload requests now, it's working properly.
What is the expected value for Metadata field in Complete Multi-Part Upload? Is it the uploaded media ID or any token? If token then from where can we generate this token.
Related
So I was trying to use the LinkedIn Developer API to post some text with a image or multiple images at once.
So here's the issue
https://learn.microsoft.com/en-gb/linkedin/consumer/integrations/self-serve/share-on-linkedin
This is the DOCS for the share on LinkedIn that is completely working fine when am posting just text.
But the issue arises when I try to create Post with Image
https://api.linkedin.com/v2/assets?action=registerUpload This API is giving me an error like this.
{
"serviceErrorCode": 65600,
"message": "Invalid access token",
"status": 401
}
Even I refreshed the token to check if there was an issue with my token. My access token is working fine with sharing the text-only post.
If your above API works fine in case then you are registered for uploading file. Then you'll receive the below URL from the response. But they mentioned it with CURL and I want to send a cross-origin request from Axios. I tried a curl converter but that doesn't explain how we will upload the file with the request.
curl -i --upload-file /Users/peter/Desktop/superneatimage.png --header "Authorization: Bearer redacted" 'https://api.linkedin.com/mediaUpload/C5522AQGTYER3k3ByHQ/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQJbrN86Zm265gAAAWemyz2pxPSgONtBiZdchrgG872QltnfYjnMdb2j3A&app=1953784&sync=0&v=beta&ut=2H-IhpbfXrRow1'
I have the file either in URL or in Base64 format. I don't have a binary file present in my case. Well, I want to send a binary file too for a default case but for most requests, I'll be using the URL for the image.
Thanks for reading the whole question. Please help me with the information you have that can be useful for me.
I want to use the access API to manage tokens.
For example to get a list of all tokens by calling: GET /access/api/v1/tokens .
I am using an admin access token with an expiration period of 1 hour generated in the web uis Administration | Identity & Access | Access Tokens section as bearer token (I am able to call other endpoints using this token).
When trying to call the access API I get a "Status 404 Not Found" in Postman and the System Logs show "Request /access/api/v1/tokens should be a repo request and does not match any repo key"
Is there anything I missed? Do I need to specify headers or configure the token differently?
JFrog ref:
https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-GetTokens.1
Commercial license 7.35.2
Update: I called /artifactory/access/api/v1/tokens instead of /access/api/v1/tokens
Correcting the URL solved my problem.
My guess is you're using the wrong URL. This works for me:
curl https://<INSTANCEID>.jfrog.io/access/api/v1/tokens -H "Authorization: Bearer <TOKEN>"
Using the plugin, dropbox media importer in a wordpress app. I add the client key and secret after creating a personal dropbox app with full dropbox permission, I attempt to authorize the request but it returns an error that says invalided client_id or secret. When I try to do the curl request with the client_id & secret I get the same response.
Request:
curl -X POST https://api.dropboxapi.com/2/auth/token/from_oauth1 \
--header "Authorization: Basic <REDACTED>" \
--header "Content-Type: application/json" \
--data "{\"oauth1_token\": \"qievr8hamyg6ndck\",\"oauth1_token_secret\": \"qomoftv0472git7\"}"
Response:
{"error_summary": "invalid_oauth1_token_info/", "error": {".tag": "invalid_oauth1_token_info"}
The /2/auth/token/from_oauth1 endpoint you're attempting to use is only for exchanging existing OAuth 1 access tokens (e.g., as previously retrieved for use with the now-retired Dropbox API v1) for OAuth 2 access tokens.
If you're just integrating now, you wouldn't have any OAuth 1 access tokens, and so shouldn't be using this endpoint. (Accordingly, it's indicating that the oauth1_token and oauth1_token_secret values you're supplying are incorrect; the ones you're using are just copied from the documentation, but you would need to supply your real values.)
Instead, you should implement the Dropbox OAuth 2 app authorization flow. You can find more information in the documentation and guide.
I am getting 400 error message as shown in image below, when I try out the Translation API using Try it out link http://docs.microsofttranslator.com/text-translate.html
I am using the Access Key generated from Azure Portal for Cognitive Services Free trial.
MS Azure Portal Link
I have read on MS support blogs and I tried all the suggestions mentioned in them. But everytime, I get the 400 Status error as shown below.
Can someone please help me to resolve this issue??
You need to get an access token first (docs here) by doing a POST request:
curl --header 'Ocp-Apim-Subscription-Key: <YOUR-API-KEY>' --data "" 'https://api.cognitive.microsoft.com/sts/v1.0/issueToken'
And then use that token in the Authorization header. (appId has been deprecated).
curl -X GET --header 'Accept: application/xml' --header 'Authorization: Bearer <YOUR-TOKEN>' 'https://api.microsofttranslator.com/v2/http.svc/Translate?&text=this%20is%20my%20name&from=en&to=af'
You can use Microsoft Translator API in 2 ways (see the docs):
in 1 step: invoke (GET) https://api.microsofttranslator.com/V2/Http.svc/Translate?text=Neoliberismo&from=it&to=en, passing Ocp-Apim-Subscription-Key: your_subscription_key as request header
in 2 steps, with OAuth:
invoke (POST) https://api.cognitive.microsoft.com/sts/v1.0/issueToken, passing Subscription-Key=your_subscription_key as query parameter or better passing Ocp-Apim-Subscription-Key: your_subscription_key as request header
you'll get a token that expires after 10 minutes
invoke (GET) https://api.microsofttranslator.com/V2/Http.svc/Translate?text=Neoliberismo&from=it&to=en, passing Authorization: Bearer the_token as request header
I followed the Quick Start Guide on Marketo's site for their REST API. This went well. I was able to get a successful response from their website.
Request:
curl https://ABC-DEF-123.mktorest.com/rest/v1/lists.json?access_token=123:ab
Response:
{"requestId":"123#abcf7aff","result":[],"success":true}
However, when I tried the same request the next day, I received:
{"requestId":"123#abc6731ab6f","success":false,"errors":[{"code":"601","message":"Access token invalid"}]}
I logged into the Marketo admin and noticed that the token I copied and pasted out of the dialog box was different. I tried this new one and it worked.
(This is taken from the guide)
I came across another guide on their site that describes a different authentication process. Marketo Authentication Guide
This guide mentions the token that is returned from the API endpoint has an expiration so I suspect that all Marketo tokens expire (or I need to disable this). However, I have not been able to successfully make requests to this endpoint with my client ID and client secret.
Request:
curl https://ABC-DEF-123.mktorest.com/identity/oauth/token?grant_type=client_credentials&client_id=ACLIENTID&client_secret=ACLIENTSECRET
Response:
{"error":"unauthorized","error_description":"An Authentication object was not found in the SecurityContext"}
Any help in the right direction would be appreciated. Thanks in advance.
REST API tokens expire. So you typically will need to request a token for each session.
from your specific installed URL, like: MARKETOURL/identity/oauth/tokengrant_type=client_credentials&client_id=abc&client_secret=xyz
Which will result in (example):
{
"access_token": "1234",
"token_type": "bearer",
"expires_in": 3599,
"scope": "email#email.com"
}
You will need to start out your sessions with this request to do subsequent calls. I have code that runs this first and then requests a new token if it expires. The expires_in field is in seconds.
Source: http://developers.marketo.com/documentation/rest/authentication/
I was not able to figure out why my curl requests were failing, but I was able to successfully call the Marketo API with mrkt, a Ruby Gem for Marketo.
I've looked through the logs of what the gem is generating for requests and they appear to be exactly the same. But at least I now successfully calling Marketo.
You need to use following sequences.
grant_type= client_credentials
client_id =you will get Marketo admin where you generate token
client_secret=you will get Marketo admin where you generate token
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
GET <Identity URL>/oauth/token?grant_type=client_credentials&client_id=<Client Id>&client_secret=<Client Secret>
Your first call failed because your token expires every hour currently, according to Marketo's docs.
Your curl call to get a new token failed because curl (or something) was stripping off the auth arguments. Try wrapping the url in quotes.
curl "https://ABC-DEF-123.mktorest.com/identity/oauth/token?grant_type=client_credentials&client_id=ACLIENTID&client_secret=ACLIENTSECRET"
You can get more information about what curl is sending with the -v flag. Running this would have given you enough information to at least know that your entire url wasn't being passed down to the request.
curl -v https://ABC-DEF-123.mktorest.com/identity/oauth/token?grant_type=client_credentials&client_id=ACLIENTID&client_secret=ACLIENTSECRET