IllegalLocationConstraintException occur while attempting to upload - aws-sdk

When I trying to upload a pdf generated in local pc to the aws Hong Kong s3 server, I get the following error :
The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.
May I know how can I define the region to ap-east-1?

Related

Message Routing in Azure IoT Hub returning application/octet-stream

I am routing messages from an Azure IoT Hub to a blob container (Azure Storage as a routing endpoint). The messages sent to the IoT Hub are of Content Type: 'application/json' and Content Encoding: 'UTF-8'. However, when they arrive in blob storage several of these messages are batched together into one file with Content Type 'application/octet-stream'. Thus, for instance Power BI is not able to read these files in JSON format when reading directly from the blob.
Is there any way to route these messages so that each single message is saved as a json file in the blob container?
Tl;dr : Please make use of the Encoding option to specify AVRO or JSON format & Batch Frequency/Size to control the batch.
"With an Azure Storage container as a custom endpoint, IoT Hub will write messages to a blob based on the batch frequency and block size specified by the customer. After either the batch size or the batch frequency is hit, whichever happens first, IoT Hub will then write the enqueued messages to the storage container as a blob. You can also specify the naming convention you want to use for your blobs, as shown below."
The below image shows how we navigate to the IoTHub's message routing section to add a custom endpoint of a blob storage account.
-The below image shows how we configure the settings of the batch count and the size. Also please make use of the Encoding section to specify the message format such as AVRO or JSON
Please leave a comment below to let us know if you need further help in this matter.
The message encoding needs to be done by the device stream or as part of a module to translate the protocol. Each protocol (AMQP, MQTT, and HTTP) uses a different method to encode the message from base64 to UTF-8.
To route messages based on message body, you must first add property 'contentType' (ct) to the end of the MQTT topic and set its value to be application/json;charset=utf-8. An example is shown below.
devices/{device-id}/messages/events/$.ct=application%2Fjson%3Bcharset%3Dutf-8
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support

Getting the URL for a bucket or an object using oci-java-sdk

I have already a code to retrieve the objects in the bucket using oci-java-sdk and this is working as expected. I would like to retrieve the URL of the file which was uploaded to the bucket in object storage and when I use this URL, this should redirect to the actual location without asking any credentials.
I saw preauthenticated requests but again i need to create one more request. I dont want to send one more request and want to get URL in the existing GetObjectResponse.
Any suggestions>
Thanks,
js
The URL of an object is not returned from the API but can be built using information you know (See Update Below!). The pattern is:
https://{api_endpoint}/n/{namespace_name}/b/{bucket_name}/o/{object_name}
Accessing that URL will (generally, see below) require authentication. Our authentication mechanism is described at:
https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/signingrequests.htm
Authentication is NOT required if you configure the bucket as a Public Bucket.
https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/managingbuckets.htm?TocPath=Services%7CObject%20Storage%7C_____2#publicbuckets
As you mentioned, Pre-authenticated Requests (PARs) are an option. They are generally used in this situation, and they work well.
https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/usingpreauthenticatedrequests.htm
Strictly speaking, it is also possible to use our Amazon S3 Compatible API...
https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/s3compatibleapi.htm
...and S3's presigned URLs to generate (without involving the API) a URL that will work without additional authentication.
https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html
Update: A teammate pointed out that the OCI SDK for Java now includes a getEndpoint method that can be used to get the hostname needed when querying the Object Storage API. https://docs.cloud.oracle.com/en-us/iaas/tools/java/1.25.3/com/oracle/bmc/objectstorage/ObjectStorage.html#getEndpoint--

Loading a BIM360 model from a deployed site returns 9: BAD_DATA_NO_VIEWABLE_CONTENT

I have some JavaScript that calls the function Autodesk.Viewing.Document.load(...). When I run this locally, I am able to successfully load a model, but when the code is deployed the exact same model returns the error
9: BAD_DATA_NO_VIEWABLE_CONTENT
Any ideas what the issue would be?
There are various reasons why loading a model from Forge could return the error code 9, for example:
you are loading a model that has not been processed using the POST job endpoint yet
the model has already been processed but the translation failed for some reason (use the GET :urn/manifest endpoint to check if you see "status": "success")
the model was translated successfully but there is no actual viewable content in it (e.g. a Revit model with no 2D sheets and no 3D views specified)
the model was translated successfully, but the output derivatives have been removed, either manually (using the DELETE :urn/manifest endpoint) or perhaps automatically after the original file was removed from a Forge OSS bucket

No Traces in Azure API Response

The Flag Ocp-Apim-Tracehas been set to true.
The API Response displays this information under the Trace Tab:
Trace location was not specified in the response or trace log is not
available.
Yet no traces are available. How does one resolve this?
To enable trace, you need to include "Ocp-Apim-Trace" and "Ocp-Apim-Subscription-Key" in request header.
If the API does not require subscription, you can still get admin subscription key in developer portal. This enforces that only admin can get tracing log. To get admin subscription key if you are an admin, go to Developer Portal -> Profile -> find your target API and copy the key.
The Ocp-Apim-Trace feature enables you to specify whether or not APIM should generate a trace file on blob storage.
Setting the header to 'true' within Postman for example, will give you back a HTTP Header in the response called Ocp-Apim-Trace-Location.
This will contain the URL to your trace file, which you can open in any browser.
You might want to install a plugin/extension to be able to format JSON files properly in order to make it easy to read.
Just setting the flag Ocp-Apim-Trace to true will not suffice.
One needs to set the subscription key as well as per this doc.
https://learn.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#Trace
So, for API's which do not have a subscription key, not sure how one can get the traces

vimeo - video request API oauth_timestamp issue

I am creating web application using struts framework with WASCE server. In that I want to load the vimeo videos when the user enter their username. So that I have created the application in vimeo developer site and got the apiKey, apiSecret, token and secret values. I have applied these values into my code. I got the correct(with video urls) JSON response when I run in local.
But Whan I deployed it into the deticated server and check the response I got,
{"generated_in":"0.0039","stat":"fail","err":{"code":"401","expl":"The oauth_timestamp
passed is either too far in the past or in the future. Vimeo thinks the current time is
1379053244","msg":"Invalid \/ expired token"}}
I have searched about this issue and got some solution as follows.
Looks like your server's time is set incorrectly. Vimeo's API is time-sensitive to
within a few minutes. You should be able to ask your hosting provider to
correct the server's time.
Ref: http://community.tubepress.com/topic/287-vimeo-no-videos-to-populate-this-tubepress-gallery/?p=989
So that I have checked server time. My local time is 11.00AM, Server Time is 23.00PM. Now I changed the server time to 11.00AM(Because 11.00AM is working in localhost).
But Still I am getting the same issue. Can anyone tell me what may be the problem and how can I fix this.
Note:
I have changed the local time to 23:00PM and I got that "Invalid expired token" resonse. So again change it to 11.00AM, I got a correct response.