Nordic Layers · Nordic Byte

API ஆவணம்

Nordic Layers என்பது https://app.layers.nordicbyte.co.uk இல் HTTPS வழியாக இயங்கும் REST API. திட்டம் என்பது லேயர்களின் JSON ஆவணம்; செயல்பாடுகள் மூலம் அதை மாற்றி, படமாக ஏற்றுமதி செய்கிறீர்கள். உலாவி எடிட்டரும் இதே API-யைப் பயன்படுத்துகிறது.

அங்கீகாரம்

உங்கள் கணக்குப் பலகையில் API விசையை உருவாக்கி, ஒவ்வொரு /v1 கோரிக்கையிலும் அனுப்புங்கள். விசைகள் nl_key_ என்று தொடங்கும்.

Authorization: Bearer nl_key_…

வழக்கமான செயல்முறை

  1. பதிவேற்றம் ஒவ்வொரு படத்தையும் POST /v1/assets மூலம், கோப்பையே கோரிக்கை உடலாக அனுப்பி (PNG, JPEG, WebP, GIF, BMP அல்லது TIFF). பதிலில் அதன் id இருக்கும்.
  2. உருவாக்கம் ஒரு திட்டத்தை POST /v1/projects மூலம், width, height, background உடன். முதல் steps ஐ அதே அழைப்பில் அனுப்பலாம்.
  3. திருத்தம் POST /v1/projects/{id}/run மூலம்: ஒரு செயல்பாட்டை {"op": …} ஆகவோ பலவற்றை {"steps": [...]} ஆகவோ. GET /v1/projects/{id}/preview மூலம் பாருங்கள், இது இலவசம்.
  4. ஏற்றுமதி POST /v1/projects/{id}/export மூலம். பதிலில் கோப்பின் URL இருக்கும்; "response": "image" கொடுத்தால் படமே வரும்.

முதல் கோரிக்கை

கிரேடியன்ட்டும் தலைப்பும் கொண்ட 1080×1080 திட்டத்தை உருவாக்கி, WebP ஆக ஏற்றுமதி செய்யுங்கள்:

curl -X POST https://app.layers.nordicbyte.co.uk/v1/projects \
  -H "Authorization: Bearer $NL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "First post",
    "width": 1080,
    "height": 1080,
    "steps": [
      {"op": "layer.addFill", "gradient": {"colors": ["#1E3A5F", "#64B5F6"], "angle": 135}},
      {"op": "text.add", "content": "Hello, layers", "fontName": "Segoe UI", "fontSize": 110, "bold": true, "color": "#FFFFFF"},
      {"op": "effects.set", "shadow": {"opacity": 0.4, "distance": 12, "size": 24}}
    ]
  }'

# → {"project": {"id": "…", …}}

curl -X POST https://app.layers.nordicbyte.co.uk/v1/projects/$PROJECT_ID/export \
  -H "Authorization: Bearer $NL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "webp",
    "quality": 90
  }'

எண்ட்பாயின்ட்கள்

மெத்தட்பாத்என்ன செய்கிறது
GET/healthசேவை நிலை
GET/v1/opsஒவ்வொரு செயல்பாட்டினதும் அதன் அளவுருக்களினதும் பட்டியல் (பொது)
POST/v1/assets?name=photo.jpgபடத்தைப் பதிவேற்றுங்கள்; உடலே கோப்பு
GET/v1/assetsஉங்கள் படங்களின் பட்டியல், எந்தத் திட்டம் அவற்றைப் பயன்படுத்துகிறது என்பதுடன்
DELETE/v1/assets/{id}படத்தை நீக்குங்கள்
POST/v1/projectsதிட்டத்தை உருவாக்குங்கள் (கேன்வாஸ், அல்லது முழு ஆவணம், விருப்பப் படிகளுடன்)
GET/v1/projectsஉங்கள் திட்டங்களின் பட்டியல்
GET/v1/projects/{id}ஒரு திட்டம் அதன் ஆவணத்துடன்
PUT/v1/projects/{id}/documentமுழு ஆவணத்தையும் மாற்றுங்கள்
POST/v1/projects/{id}/runஒரு செயல்பாட்டை அல்லது படிகளின் பட்டியலைப் பயன்படுத்துங்கள்
POST/v1/projects/{id}/undoகடைசி மாற்றத்தைச் செயல்தவிர்
POST/v1/projects/{id}/redoமீண்டும் செய்
GET/v1/projects/{id}/preview?size=1024இலவச PNG முன்னோட்டம், நீண்ட பக்கம் size px வரை
POST/v1/projects/{id}/exportPNG, JPEG அல்லது WebP ஏற்றுமதி; இந்தக் கோப்புக்கு மட்டும் விருப்பப் படிகள்
POST/v1/renderமுழு ஆவணத்தின் நிலையற்ற ரெண்டர்
GET/v1/exportsஉங்கள் ஏற்றுமதிகளின் பட்டியல்
GET/v1/exports/{id}/fileஏற்றுமதியைப் பதிவிறக்குங்கள்
DELETE/v1/projects/{id}திட்டத்தை நீக்குங்கள்

செயல்பாடுகள்

ஒவ்வொரு செயல்பாடும் op மற்றும் அதன் அளவுருக்கள் கொண்ட ஆப்ஜெக்ட். லேயர்கள் id அல்லது பெயரால் குறிப்பிடப்படும்; layer இல்லையெனில் செயலில் உள்ள லேயர் பயன்படுத்தப்படும். பெயர்களில் எழுத்து வடிவமும் இடைவெளிகளும் புறக்கணிக்கப்படும், எனவே "Linear Dodge (Add)" மற்றும் "linearDodge" ஒரே பிளெண்ட் மோடு. steps உடன் அவை வரிசையாக இயங்கி முதல் பிழையில் நிற்கும் ("stopOnError": false இல்லையெனில்); அதற்கு முந்தைய படிகள் பயன்படுத்தப்பட்டே இருக்கும்.

லேயர்கள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
layer.addcolor, nameAlias of layer.addFill (the web has no empty pixel layers).
layer.addFillcolor | gradient {colors: [..], angle, type: linear|radial}, name, above, atBottomA colour or gradient layer the size of the canvas.
layer.addImageasset_id | color, name, rect | origin | center, width, height, fit (stretch|contain|cover), fitCanvas (contain|cover), above, atBottom, opacity, blendModeAdd an uploaded image (asset_id) or a solid colour (color).
layer.cliplayerClip a layer to the one below it (clipping mask).
layer.deletelayer | layersDelete layers.
layer.duplicatelayer, nameCopy a layer above itself.
layer.getlayerOne layer with all its settings.
layer.list—Layers from bottom to top.
layer.movelayer, above | below (layer), toTop, atBottom, index, offsetReorder a layer.
layer.renamelayer, nameRename a layer.
layer.selectlayerMake a layer the active one.
layer.setBlendModelayer | layers, blendMode (normal, darken, multiply, colorBurn, linearBurn, lighten, screen, colorDodge, linearDodge, overlay, softLight, hardLight, difference, exclusion, subtract, divide, hue, saturation, color, luminosity)Blend mode.
layer.setFilllayer, color | gradientChange a fill layer's colour or gradient.
layer.setImagelayer, asset_id, fit (stretch|contain|cover)Replace a layer's image and keep its box (templates).
layer.setOpacitylayer | layers, opacityLayer opacity, 0 to 1.
layer.setVisiblelayer | layers, visibleShow or hide layers.
layer.uncliplayerRelease a clipping mask.

உரை

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
text.addcontent, fontName, fontSize, color, alignment, leading, bold, italic, boxWidth, origin | center, nameAdd a text layer.
text.defaults—Fonts on the server and whether complex scripts are shaped.
text.setlayer, content, fontName, fontSize, color, alignment, leading, bold, italic, boxWidthChange a text layer.

வடிவங்கள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
shape.addshape, rect | from+to, color, cornerRadius, lineWidth, nameAdd a rectangle, ellipse or line.
shape.setlayer, color, cornerRadius, lineWidthChange a shape layer.

உருமாற்றம்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
transform.fliplayer | layers, axis (horizontal|vertical)Flip horizontally or vertically.
transform.movelayer | layers, dx, dy | to [x, y]Move by dx/dy or to a point.
transform.rotatelayer | layers, angleRotate by an angle (degrees, clockwise).
transform.scalelayer | layers, factor | percent | width | heightScale around each layer's centre.
transform.setlayer | layers, x, y, width, height, rotation, flipX, flipYBox, rotation and flips.

லேயரில் அட்ஜஸ்ட்மென்ட்கள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
adjust.blackWhitelayer | layers, reds, yellows, greens, cyans, blues, magentas, tint, tintHue, tintSaturationNon-destructive blackWhite on a layer (adds it or updates it).
adjust.brightnessContrastlayer | layers, brightness, contrastNon-destructive brightnessContrast on a layer (adds it or updates it).
adjust.clearlayer | layersRemove every adjustment and filter from a layer.
adjust.colorBalancelayer | layers, shadows, midtones, highlights, preserveLuminosityNon-destructive colorBalance on a layer (adds it or updates it).
adjust.curveslayer | layers, rgb, red, green, blueNon-destructive curves on a layer (adds it or updates it).
adjust.exposurelayer | layers, exposure, offset, gammaNon-destructive exposure on a layer (adds it or updates it).
adjust.gradientMaplayer | layers, shadows, highlights, reversedNon-destructive gradientMap on a layer (adds it or updates it).
adjust.grainlayer | layers, amount, size, seedNon-destructive grain on a layer (adds it or updates it).
adjust.hueSaturationlayer | layers, hue, saturation, lightness, colorizeNon-destructive hueSaturation on a layer (adds it or updates it).
adjust.invertlayer | layers, no settingsNon-destructive invert on a layer (adds it or updates it).
adjust.levelslayer | layers, black, white, gamma, outputBlack, outputWhiteNon-destructive levels on a layer (adds it or updates it).
adjust.removelayer | layers, kindRemove one adjustment or filter from a layer.

ஃபில்டர்கள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
filter.addNoiselayer | layers, amount, gaussian, monochromatic, seedNon-destructive addNoise on a layer (adds it or updates it).
filter.gaussianBlurlayer | layers, radiusNon-destructive gaussianBlur on a layer (adds it or updates it).
filter.motionBlurlayer | layers, angle, distanceNon-destructive motionBlur on a layer (adds it or updates it).
filter.pixelatelayer | layers, sizeNon-destructive pixelate on a layer (adds it or updates it).
filter.sharpenlayer | layers, amount, radius, thresholdNon-destructive sharpen on a layer (adds it or updates it).
filter.vignettelayer | layers, amount, midpoint, roundness, feather, colorNon-destructive vignette on a layer (adds it or updates it).

அட்ஜஸ்ட்மென்ட் லேயர்கள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
adjustmentLayer.addkind, settings…, name, aboveAn adjustment layer: changes everything below it.
adjustmentLayer.getlayerAn adjustment layer's settings.
adjustmentLayer.setlayer, settings…Change an adjustment layer (partial).

லேயர் மாஸ்க்குகள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
mask.addlayer, reveal | hide | rect | ellipse (rect) | gradient (from, to) | asset_id (+ rect), feather, invert, cornerRadiusAdd or replace a layer mask.
mask.blurlayer, radiusFeather the layer mask.
mask.deletelayerRemove the layer mask.
mask.invertlayerInvert the layer mask.
mask.setEnabledlayer, enabledTurn the layer mask on or off.

லேயர் எஃபெக்ட்கள்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
effects.copyfrom, layer | layersCopy effects from one layer to others.
effects.getlayerA layer's effects.
effects.removelayer | layers, kindsRemove effects (all, or the ones named).
effects.setlayer | layers, shadow {…}, stroke {…}, outerGlow {…}, colorOverlay {…}Set effects (partial): shadow, outerGlow, stroke, colorOverlay.
effects.setEnabledlayer, kind, enabledTurn one effect on or off.

கேன்வாஸ்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
canvas.croprect [x, y, width, height]Crop the canvas to a rectangle.
canvas.imageSizewidth and/or height, or percentScale the whole document.
canvas.setBackgroundcolorBackground colour, or null for transparent.
canvas.sizewidth, height, anchor (topLeft…bottomRight, default center)Change the canvas without scaling layers.

திட்டம்

செயல்பாடுஅளவுருக்கள்என்ன செய்கிறது
project.state—The whole document.

பிளெண்ட் மோடுகள்

எழுத்துரு குடும்பங்கள்

டெம்ப்ளேட்கள்

ஏற்றுமதி அழைப்பில் steps கொடுங்கள்; அவை திட்டத்தின் நகலில் அந்தக் கோப்புக்கு மட்டும் பயன்படுத்தப்படும். ஒரு டெம்ப்ளேட், பல கோப்புகள்: text.set மூலம் உரையையும் layer.setImage மூலம் புகைப்படத்தையும் மாற்றுங்கள்; இது லேயரின் பெட்டியை அப்படியே வைத்திருக்கும்.

curl -X POST https://app.layers.nordicbyte.co.uk/v1/projects/$TEMPLATE_ID/export \
  -H "Authorization: Bearer $NL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "png",
    "steps": [
      {"op": "text.set", "layer": "Title", "content": "Nueva colección"},
      {"op": "layer.setImage", "layer": "Photo", "asset_id": "photo_dunes"}
    ]
  }'

நிலையற்ற ரெண்டர்

POST /v1/render முழு document ஐ (project.document இல் திரும்பி வருவது போல), விருப்ப steps மற்றும் ஏற்றுமதி விருப்பங்களை ஏற்கும்; திட்டத்தைச் சேமிக்காது. "response": "image" உடன் பதில் படக் கோப்பாகவே இருக்கும்.

curl -X POST https://app.layers.nordicbyte.co.uk/v1/render \
  -H "Authorization: Bearer $NL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": {"width": 1200, "height": 630, "background": "#1E3A5F", "layers": ["…"]},
    "format": "png",
    "response": "image"
  }' \
  -o card.png

பிழைகள்

பிழைகள் JSON-இல் நிலையான code மற்றும் உங்கள் கணக்கின் மொழியில் detail செய்தியுடன் வரும். தோல்வியடைந்த படி எந்த அளவுரு தவறு என்று சொல்லும். திட்டத்தின் ரெண்டர்கள் தீர்ந்தால் API 402 மற்றும் quota_renders உடன் பதிலளிக்கும்.

வரம்புகள்