I'm trying to create a Slate application which uses the compass search endpoint.
I've managed to connect to the endpoint trough postman just fine using <host>/foundry-search/api/compass/v0/search, and get the desired results.
However in Slate I'm unable to get a 200 response with the same query, using search in the path, example:
{
"path": "search",
"method": "POST",
"bodyJson": {
"query": {},
"limit": 5
},
"extractors": {
"results": "$"
},
"headers": {
"Content-Type": "application/json",
"Content-Length": 64
}
}
Other compass endpoints work fine, its just the search one I cant manage to work out. For this query in particular I get 500, with errorCode INTERNAL. Is there any magic trick one needs to do for search?
From the layout of the request, it looks like the Compass datasource being queried has been configured with an HttpJson type. It's generally not recommended to query Foundry services through the HttpJson configuration as certain endpoints may only be considered internally supported, and liable to change at any time (which could possibly break your Slate application without warning).
Slate datasources that point to Foundry services should be configured as a ServiceApi type as they provide an easy editor layout that displays available supported endpoints, endpoint parameter inputs (with Handlebar support), and the expected parameter types.
Please contact your Palantir rep and ask for the Compass service to be configured as a ServiceApi with the search Compass endpoint enabled. Doing so will allow you to query any supported Compass endpoint without needing to worry about correctly formatting the HttpJson structure, or guessing which endpoint parameters are required.
Related
I'm migrating from Firebase where this was rather simple to do.
I'm building a custom api because the environment I need to build in will not let me use any official sdk's or anything, so this solely has to be done via rest type actions.
I essentially want to just post the username/password to aws cognito, and recieve an auth token that I can then append to the headers of future requests (to other api calls)
After hunting for quite a bit, almost all help has postman connecting to Amazon's login UI etc, and I cannot do that. It must completely handle the login process "behind the scenes" and not prompt the user with Amazon's own UI.
So, assuming this is possible:
What headers do I need (content-type etc)
How do I format the body json (or is it using something else?)
I assume I'd send it as "raw" body.
This is as far as I got so far and I'm scratching my head:
Url: https://[DOMAIN].auth.us-east-1.amazoncognito.com/oauth2/token
Body Json:
{
"ClientId": "1234etc",
"Password": "Password1_",
"UserAttributes": [
{
"Name": "email",
"Value": "test#test.com"
}
],
"Username": "test#test.com"
}
No idea if this is even the right format for the JSON I just scalped it from other posts.
Within a web client using the Forge API, I would like to get a JSON array of Revit elements in a model. Using the Design Automation API, I am creating an Activity that uses FilteredElementCollector to retrieve the elements, but once I have the elements I'm not sure the best way to retrieve those results in my web service. This Activity does not need to write back to an .rvt file.
The CountItApp tutorial writes the results to a results.txt file in cloud storage, and the web app then downloads that results.txt file and parses the results. On my web client I want to display these results, but file I/O does not seem like a very good solution for JSON data. A couple alternatives I've considered:
Write results to an external database and query that database in my web application once the WorkItem completes. As far as I know this is not possible due to Forge's restrictions on network access within an Activity.
Pass the results with the onComplete callback. I don't know if this is possible.
Design automation allows you to post a workitem with output arguments with POST callback. This allows you to receive the output data as application/json if your output file generated by your activity is a json file.
Design automation also allows you to specify a variable workitem.id in your output url. When your workitem completes we shall call this url with the variable expanded to the id of that workitem. This dynamic variable path allows you to determine the workitem id associated with that callback.
Here is how you could go about. First define an activity with such an output parameter (verb: post) with a hardcoded local name result.json:
"results": {
"zip": false,
"ondemand": false,
"verb": "post",
"description": "Results",
"required": true,
"localName": "results.json"
}
In your appbundle code save the json contents in a file with hardcoded name result.json to the current working folder.
using (StreamWriter sw = File.CreateText("result.json"))
{
sw.WriteLine(JsonConvert.SerializeObject(data, Formatting.Indented));
sw.Close();
}
Then you can post a workitem like so:
"result": {
"verb": "post",
"url": "https://www.yourserver.com/results/$(workitem.id)"
}
In your server implementation of the callback you will get the json contents as the payload. You may read the results and communicate back to the client corresponding to the workitem id, using sockets or any other means of communication you may have with your client.
I am trying to get weather forecasts data from OpenWeatherMap and integrate them in Orion by performing a registeration request.
I was able to register and get the API key from OpenWeatherMap, however, the latter returns a JSON file with all the data inside, which is not supported by ORION.
I have followed the step by step tutorial https://fiware-tutorials.readthedocs.io/en/latest/context-providers/index.html#context-provider-ngsi-proxy where they have acquired the data from OpenWeatherMap using NGSI proxy, an API key is required to be indicated in the docker-compose file as an environment variable, however, the data acquired is the "current data" and not forecast and also specific to Berlin.
I have tried to access the files inside the container "fiware/tutorials.context-provider" and try to modify and match the parameters to my needs but I feel like I am taking a long blocked path.
I don't think that's even considered as good practice but I have run out of ideas :(
Can anyone suggest how I could bring the forecast data to Orion and register it as a context provider?
Thank you in advance.
I imagine you aim to implement a context provider, able to speak NGSI with Orion.
OpenWeatherMap surely doesn't implement NGSI ...
If you have the data from OpenWeatherMap, as a JSON string, perhaps you should parse the JSON and create your entities using some select key-values from the parsed OpenWeatherMap? Save the entity (entities) locally and then register those keys in Orion.
Alternatively (easier but I wouldn't recommend it), create local entities with the entire OpenWeatherMap data as the value of an attribute of the entity:
{
"id": "id-from-OpenWeatherMap",
"type": "OpenWeatherMap",
"weatherData": {
"value":
...
}
...
}
Then you register id/weatherData in Orion.
I'm studying node.js and trying to implement the following task:
I have to get connection to existing https - for this purpose I decided to choose needle module:
needle.post('https://...', data, options, function (err, res, body){ });
I need to send a request to server as json object using these parameters:
{"action": "AuthenticationManagement", "method":"login", "data": [null, null], "type": "rpc", "tid": 1}
As I understand it, these parameters should be sent in terms of data within needle.post.
In case I have connected to the server, I need to get cookies from it (sessionID parameter, etc) and save it to file/keep it in memory
during my further operations with server. Looks like, cookies should be sent back in res.headers.
Properly end the session.
Any help will be much appreciated.
Needle does not support cookies yet. I 'd suggest using a different library rather than rolling your own implementation over needle.
Is anyone aware of method of accessing Google AppEngine Cloud Enpoints using ActionScript 3 without having to go through the JavaScript layer? I have been going on the docs and Google to find any tutorials or examples but did not find anything useful.
We don't have AS3 client libraries and currently there are none planned that I know of, so you'll have to rely on HTTP to make your REST calls.
TLDR; Use the APIs Explorer
If you visit
https://your-app-id.appspot.com/_ah/api/explorer
(replacing your-app-id with your actual application ID), then you'll be redirected to your own custom version of the Google APIs Explorer.
In it you can click on individual APIs and see the list of all available methods. Within a the page for each method, you can try out forming requests and the Explorer will suggest the correct values to use.
After you click "Execute", the full HTTP request (headers and all) and response will be printed on your page, which will show you which commands to use.
Description of how to use the Discovery Document
The Discovery Document for your API will contain all the information you need to construct a request.
To find the root for calling your API, check out the baseUrl key. It should be something like:
https://your-app-id.appspot.com/_ah/api/tictactoe/v1/
To figure out how to call a specific method, there are descriptions of every method, nested down as resources in the Discovery Document. For example, for the Tic Tac Toe Python sample, the board_get_move method has a name of board.getmove in the #endpoints.api decorator. This means the method getmove is owned by the resource board.
If you look in the resources.board.methods key in the Discovery Document you can see the getmove method:
"getmove": {
"id": "tictactoe.board.getmove",
"path": "board",
"httpMethod": "POST",
"description": "Exposes...",
"request": {
"$ref": "TictactoeApiMessagesBoardMessage"
},
"response": {
"$ref": "TictactoeApiMessagesBoardMessage"
}
}
Combining the path with our baseUrl we know requests will need to be sent to
https://your-app-id.appspot.com/_ah/api/tictactoe/v1/board
and from httpMethod we know requests will use the HTTP method POST.
Finally, to specify the request, we see a reference to a schema:
"$ref": "TictactoeApiMessagesBoardMessage"
Looking in the schemas.TictactoeApiMessagesBoardMessage key in the Discovery Document we see:
"TictactoeApiMessagesBoardMessage": {
"id": "TictactoeApiMessagesBoardMessage",
"type": "object",
"description": "ProtoRPC message definition to represent a board.",
"properties": {
"state": {
"type": "string"
}
}
}
so we know the payload must contain a single field called state and that field must be a string.