I am implementing LinkedIn multi-part video upload, and I am constantly getting HTTP 400 on final step to complete upload. So I successfully registered upload, and uploaded all chunks as well, but on final request to complete the upload it always fails with HTTP 400 with no error text.
REQUEST(I have shortened etags):
{"headers":{"Authorization":"Bearer MINE_TOKEN","Content-type":"application\/json","Accept":"*\/*"},"body":{"completeMultipartUploadRequest":{"mediaArtifact":"urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C5605AQFNb8_dDqQmGQ,urn:li:digitalmediaMediaArtifactClass:uploadedVideo)","metadata":"","partUploadResponses":[{"headers":{"ETag":"\/ambry-video\/signedId\/AQHX-ok3ZVEXKbzXbbNc4.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/AQHCRXYeFezDepnlaL9MT1c6ZEtTmbHLZW7l27uW3TB-7Hwp4fhPH3r_gisT7EE.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/AQF6qeurhH4SRX73lH95H4hb8kuk2ewWEZG0M.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/AQEEZ1TRc9-QWyjCwvNB0lA2E.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/AQG0tdOtE.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/AQHclPE.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/ZaABdsrBYs.bin"},"httpStatusCode":200},{"headers":{"ETag":"\/ambry-video\/signedId\/AQGU7oDvN9ssN_w.bin"},"httpStatusCode":200}]}}}
RESPONSE:
HTTP\/2 400 returned for \"https:\/\/api.linkedin.com\/v2\/assets?action=completeMultiPartUpload\
Only thing that I have noticed is empty metadata field in completing the upload, but I have received empty metadata on upload registration, and I have seen that it should be in response while registering upload, at least documentation states so -> https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/vector-asset-api#complete-multi-part-upload
Any help would be wellcome, and if you need some more info please let me know ! Thanks !
Related
I'm getting HTTP Status 405 – Method Not Allowed: "The method received in the request-line is known by the origin server but not supported by the target resource."
when I'm making the following REST API call
https://myantserver.example:5443/WebRTCAppEE/rest/v2/broadcasts/{id of my stream}/recording/true
Not sure what I'm doing wrong... Is there any setting I need to configure? The streams get saved just fine if i enable "Record Live Streams as MP4"
But I want to only record specific streams. If there was any way to "Record all livestreams where the stream ID includes a specific string" that would work as well.
Any suggestions appreciated, Thanks!
Solved it, the problem was that I was making a POST request instead of a PUT request
I have a DB table with a report_url column. As soon as a backend done with filling and storing a report it fills that column with S3 link. If the report was not yet stored, the column value is NULL by default. I also have Pyramid API where an endpoint is declared returning Response with body of report content. So, whenever the user makes request, according controller will be fired to get the report link and download the file and return it to user. However, if report is not done yet (report_url is NULL), I need to inform the user somehow. In this case front-end should receive HTTP status 400, but I have not figured out if this fits best. Or maybe 503 fits better here?
Have a look at available http status codes.
What you probably want is 404, specifically because of this line:
In an API, this can also mean that the endpoint is valid but the
resource itself does not exist.:
Full description:
404 Not Found
The server cannot find the requested resource. In the browser, this
means the URL is not recognized. In an API, this can also mean that
the endpoint is valid but the resource itself does not exist. Servers
may also send this response instead of 403 Forbidden to hide the
existence of a resource from an unauthorized client. This response
code is probably the most well known due to its frequent occurrence on
the web.
If the server is working on getting the report, 102 gets an honorable mention:
102 Processing (WebDAV)
This code indicates that the server has received and is processing the request, but no response is available yet.
it's not part of the standard, it's an extension, WebDAV.
400 status codes are used to let the user know something they did is not working. 500 status codes are used when something is going on with the server. That's how I understand it anyway.
In that way, if this is a "normal" execution of the API/program, perhaps a 200 status code would do just fine. E.g. just define the endpoint to return {"report_url": null} if it isn't ready, otherwise {"report_url": "an actual url"} and then give 200 in each case. And the receiving party handles it depending on if it is null or not. The pro of this method is, now the user can know that it is definitely a proper endpoint (and not an url typo, which would also give 404). However, you could make your own 404 page saying "report is not ready" or "report does not exist" for example. The con of this 200 method is some speed penalty since you have to send an unnecessary response body.
Disclaimer: I am not a web/http expert at all.
The correct HTTP status code is 202 - Accepted. The documentation says:
The 202 (Accepted) status code indicates that the request has been accepted for processing, but the processing has not been completed.
..
The representation sent with this response ought to describe the request's current status and point to (or embed) a status monitor that can provide the user with an estimate of when the request will be fulfilled.
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.
when i add profile of supplier on localhost working fine. and API POSt method is working fine.
but after publish of project on server getting 400 error when i add profile of supplier.
and in response getting this.
The requested resource does not support http method 'GET'.
with 400 status
i have attached images of errors.
Project url is :
https://localefood.maqssoft.com
test-user : supplier#gmail.com
password: a#123456A
This link has the same issue that i am looking for but not give the solution of problem.
https://forums.asp.net/t/2129791.aspx
enter image description here
Make a POST request with POSTMAN.
List item Use the same URL as you did for the GET request steps above, but now choose POST to be the selected HTTP method.
Click the Body tab just under the URL, then choose the raw radio
button and JSON (application/json) from the type dropdown menu:
You may note that a new Header gets automatically added to the
request. Requests that send data need a header telling the API what
kind of data is being sent. Click the Headers tab to see the
Content-Type: application/json header:
Click Send.
If you have recently submitted a request you may not be asked to
authenticate again. If you get an Unauthorized error, request a new
access token and click Send again.
I use the SoundCloud API to retrieve the stream URL for a streamable track.
I follow the redirect and I end up with an URL that looks like:
http://ec-media.soundcloud.com/eodihgiuh.128.mp3?<a string>
AWSAccessKeyId=<access key>
&Expires=<timestamp>
&Signature=<signature>
or
http://ak-media.soundcloud.com/euieuieie.128.mp3?
AWSAccessKeyId=<access key>
&Expires=<timestamp>
&Signature=<signature>
&__gda__=<a string>
Then I start streaming the MP3 data at this URL.
First I send a HEAD request to read the Content-Length header, so that I know how many GET requests I will have to send in order to play the whole song.
Then I send several partial GET requests, each one with a different Range header.
The problem is that sometimes the HEAD request returns a 403 status code, even though a GET request to the exact same URL returns with a 200 status code. It seems that this happens if and only if the host is ak-media.soundcloud.com.
Is this supposed to happen? I expected the HEAD request to return exactly the same headers as the GET request, only without the body response.
Cheers,
PB
P.S: I should probably mention that my code is not running on a computer, but on an audio device with a tiny 8-bit processor which has extremely limited resources.
Unfortunately, currently we only offer guaranteed proper response for GET requests.
As a hack, you could try to do requests with very short ranges.