I am working on an app where I need to retrieve images from URLS (for example http://foo.com/bar.png) and save them in mongodb. The app is built using angularjs and uses deployd for the API stuff. Here is the config.js file for the image collection:
{
"type": "Collection",
"properties": {
"image": {
"name": "image",
"type": "image/png",
"typeLabel": "image/png",
"required": true,
"id": "image",
"order": 0
}
}
}
I have tried searching but I was unable to find anything for images and deployd. I just need a simple way to retrieve images from URLs, save them in mongodb and then render them later on.
There's no column type image/png AFAIK. We can use string instead of it. Why not inserting the image as data uri?
{
"type": "Collection",
"properties": {
"image": {
"name": "image",
"type": "string",
"typeLabel": "string",
"required": true,
"id": "image",
"order": 0
}
}
}
Related
This seems to be the most authoritative documentation that I've found so far: https://docs.metaplex.com/nft-standard
{
"name": "Solflare X NFT",
"symbol": "",
"description": "Celebratory Solflare NFT for the Solflare X launch",
"seller_fee_basis_points": 0,
"image": "https://www.arweave.net/abcd5678?ext=png",
"animation_url": "https://www.arweave.net/efgh1234?ext=mp4",
"external_url": "https://solflare.com",
"attributes": [
{ "trait_type": "web", "value": "yes" },
{ "trait_type": "mobile", "value": "yes" },
{ "trait_type": "extension", "value": "yes" }
],
"collection": { "name": "Solflare X NFT", "family": "Solflare" },
"properties": {
"files": [
{
"uri": "https://www.arweave.net/abcd5678?ext=png",
"type": "image/png"
},
{
"uri": "https://watch.videodelivery.net/9876jkl",
"type": "unknown",
"cdn": true
},
{ "uri": "https://www.arweave.net/efgh1234?ext=mp4", "type": "video/mp4" }
],
"category": "video",
"creators": [
{ "address": "SOLFLR15asd9d21325bsadythp547912501b", "share": 100 }
]
}
}
These same docs state clearly that many fields are optional and should be omitted when not used. But which fields are required and which ones are optional?
Depends what you want to use it for. The simplest requirements I have used were:
{
"name": "Solflare X NFT",
"seller_fee_basis_points": 0,
"image": "https://www.arweave.net/abcd5678?ext=png",
"properties": {
"files": [
{
"uri": "https://www.arweave.net/abcd5678?ext=png",
"type": "image/png"
}
],
"category": "image",
"creators": [
{ "address": "SOLFLR15asd9d21325bsadythp547912501b", "share": 100 }
]
}
}
There is no reason to not include the rest as the cost of hosting this off-chain is minimal. I think most things would be optional but the important ones for an NFT would be the image attribute, as otherwise the NFT wont be able to be displated anywhere, and probably then the propertiess field because some wallets, DApps and marketplaces might use these fields to check file type. Creators should also be added if you want to receive royalties and without this field could result in your collection failing to be listed on marketplaces.
A short answer though, the minimum is not defined anywhere as removing certain things could break certain third party DApps. Depending how/where you want to use your NFT I would find out the requirements if you are desperately trying to minimise the metadata. Otherwise try to keep most of it.
I'm trying to create a custom connector for my API in Microsoft Flow so users can trigger flows based on a webhook implementation.
The authentication part seems to be working properly (I'm able to create connections). After creating a flow using my custom trigger, it never gets triggered. When checking the data on my end it seems that Flow was never able to register the subscription properly.
If I navigate to the management page for the flow, I get the following error message.
When I click on fix the trigger I get the following details where the Id parameter matches the id of the resource we're trying to subscribe to.
Here is the trigger definition:
{
"/AlertRules/{id}/webhooks": {
"x-ms-notification-content": {
"schema": {
"type": "object",
"properties": {
"Title": {
"type": "string",
"description": "Title"
},
"Text": {
"type": "string",
"description": "Text"
},
"Data": {
"type": "array",
"items": {
"$ref": "#/definitions/DataApi.Models.AlertEvent"
},
"description": "Data"
}
}
},
"description": ""
},
"post": {
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "string"
}
}
},
"x-ms-trigger": "single",
"operationId": "NewAlertEvent",
"summary": "When a new Alert Event is created or updated",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "AlertRules.AlertRule.ListAlertRule",
"value-path": "Id",
"value-collection": "value",
"value-title": "Description"
}
},
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "string",
"x-ms-visibility": "internal",
"title": "",
"x-ms-notification-url": true
},
"x-ms-visibility": "internal"
}
]
}
}
The description of my delete operation
{
"/AlertRuleSubscriptions({Id})": {
"delete": {
"tags": [
"AlertRuleSubscriptions.AlertRuleSubscription"
],
"summary": "Delete entity from AlertRuleSubscriptions",
"operationId": "AlertRuleSubscriptions.AlertRuleSubscription.DeleteAlertRuleSubscription",
"parameters": [
{
"in": "path",
"name": "Id",
"description": "key: Id",
"required": true,
"type": "string",
"format": "uuid",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
"x-ms-docs-key-type": "AlertRuleSubscription"
},
{
"in": "header",
"name": "If-Match",
"description": "ETag",
"type": "string"
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"$ref": "#/responses/error"
}
},
"x-ms-docs-operation-type": "operation"
}
}
}
And my post operation does reply with a Location header which matches the format of the delete operation described above.
My questions are:
What is missing in my trigger declaration?
How can I get more details on the subscription creation and the error Microsoft Flow is generating?
After some internal discussions with Microsoft we found two main issues.
First I updated the body parameter of the POST request to create the subscription to this.
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "object",
"properties": {
"callbackUrl": {
"type": "string",
"required": true,
"description": "callbackUrl",
"x-ms-notification-url": true,
"x-ms-visibility": "internal"
}
}
}
}
That is because the connector definitions don't support sending the callback URL in the body without using JSON formatting and because Flow was implemented using the Open API callback specification.
Second I updated my API to support the specification mentioned above.
Background
I am making a form using http://schemaform.io/
Setup
I am trying to make an array of objects that a user can make using a form. So, the user can add as many items into the array as they want.
The array of items contains a type, then another field depending on what the type was.
If the user clicks REST, I want it to offer a field called method.
If the user clicks SSH, I want it to offer a field called path.
Code so far
SCHEMA
{
"type": "object",
"title": "Command Asset",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"commands": {
"type": "array",
"title": "Actions",
"items": {
"type": "object",
"properties": {
"commandType": {
"title": "Command Type",
"type": "string",
"enum": [
"REST",
"SSH"
]
},
"path": {
"title": "Path",
"type": "string"
},
"method": {
"title": "Method",
"type": "string"
}
}
}
}
}
}
FORM
[
{
"type": "help",
"helpvalue": "<h5>Command</h5>"
},
"name",
{
"title":"Command",
"key": "commands",
"items": [
"commands[].commandType",
{
"type": "conditional",
"condition": "modelData.commands[0].commandType=='SSH'",
"items": [
{
"key": "commands[].path"
}
]
},
{
"type": "conditional",
"condition": "modelData.commands[0].commandType=='REST'",
"items": [
{
"key": "commands[].method"
}
]
}
]
}
]
One can test this code here: http://schemaform.io/examples/bootstrap-example.html
Question
As one can see, the code I have now makes all the items' secondary properties (path or method) dependent on the first item in the array's commandType (at [0]), but I want it to depend on the commandType of the corresponding item. So, if item one has commandType of REST, it offers a method field and if item two has a command type of SSH it offers a field of path and so on.
I found an answer.
Replace the [0] with [arrayIndex].
I found it from here: https://github.com/json-schema-form/angular-schema-form/commit/21f6d3ab64435b032456dfe19e03f96b29366320
I want to make schema of a simple API in Apache Avro, but issue is that my API has header field "Content-Type", and Avro disallows "-" in name.
Here is my JSON:
"headers": {"Content-Type": "application/x-www-form-urlencoded"}
Here is schema sample:
{
"name": "headers",
"type": {
"type": "record",
"name": "headers",
"fields": [
{ "name": "Content-type", "type": ["string", "null"] }
]
}
},
Represent the headers using an Avro map instead of record:
{
"name": "headers",
"type": {
"type": "map",
"values": "string"
}
},
Using Google BigQuery I need to manually create a table and load the data contained in the json file. I am using BigQuery UI, but unable to define the schema for the data, a sample of the same is given below. The problem comes with the json array as below.
{"Author": "Pranesh Nageshwar", "headline": "Train trashes crashed car", "charactercount": 1027, "dateLive": "2014-01-14", "keywords": ["train crash", "freight train", "online reporting page", "side road", "blue mountains", "new south wales", "australia", "blaxland", "new south wales", "australia", "crime stoppers", "springwood police station", "train tracks"], "id": "1226801299367"}
Arrays of values in BigQuery are represented as a field with a repeated mode. The schema you want is probably the following. If you copy and paste this into the box in the web UI, I think it will work.
[
{
"name": "author",
"type": "string"
},
{
"name": "headline",
"type": "string"
},
{
"name": "charactercount",
"type": "integer"
},
{
"name": "dateLive",
"type": "string",
},
{
"name": "keywords",
"type": "string",
"mode": "repeated"
},
{
"name": "id",
"type": "string"
}
]