Butterfly
  • Butterfly
  • Introduction
  • Changelog
  • Admin Panel
  • Audit Logs
  • Cloud
  • Commands
  • Data Manager
  • Data Types
  • Database
  • Designs
  • Introduction
  • Features
  • File Storage
  • Frontend
  • Generators
  • Helpers
  • Installation
  • Items
  • Migrations
  • Modules
  • Notification
  • Performance
  • Queue
  • Security
  • Settings
  • Smarty Helpers
  • Streams
  • Testing
  • Tutorials
  • Upgrade
  • Usage of Validator
  • Webservice
  • Swagger API Documentation Generator
  • CLI Commands
Powered by GitBook
On this page

Webservice

Authentication

In order to use webservices, you need to log in to webservice.

Example:

curl --location --request POST '##BASE_URL##/api/auth/generateToken' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'api_key=##API_KEY##' \
--data-urlencode 'password=##PASSWORD##'

Response:

{
    "success": true,
    "token": "600dd1d69983a4.72658127-6ae75bff5b0a4de826de2a93510241a1",
    "expires_at": 1611522022
}

Then, you should use token in further requests,

HTTP_BUTTERFLY_API_KEY: Api Key of the authenticating user. HTTP_BUTTERFLY_ACCESS_TOKEN: Access token received from Authentication

Example:

curl --location --request POST '##BASE_URL##/api/upload/image' \
--header 'HTTP_BUTTERFLY_API_KEY: ##API_KEY##' \
--header 'HTTP_BUTTERFLY_ACCESS_TOKEN: 600dd1d69983a4.72658127-6ae75bff5b0a4de826de2a93510241a1' \
--form 'files[]=@"/Users/butterfly/examples/logos/test.jpeg"' \
--form 'files[]=@"/Users/butterfly/examples/logos/test2.png"'
PreviousUsage of ValidatorNextSwagger API Documentation Generator

Last updated 5 months ago