Editor REST api - users

Base URI

https://creator.printiki.com/api
Parameters
fields
string optional

You can choose the fields you want returned with the fields query parameter. This is really useful for making your API calls more efficient and fast. Should be a comma-separated string

Example:
fields=id,name,gender
groupby
string optional

You can group certain data sets by the field name provided as value for this parameter

Example:
groupby=country
orderby
string optional

You can order certain data sets by the field name provided as value for this parameter

Example:
orderby=id
limit
integer optional

Size of the record set requested

Max: 1,000
Default:
20
offset
integer optional

Index of record to start result set (used for pagination)

Default:
0
where
string optional

Conditions for result set in JSON encoded string. Result set will satisfy all provided conditions.

The following example would translate to:

conditionA = valueA AND conditionB = valueB AND (conditionC = valueC1 OR conditionC = valueC2)

Example:
where={"conditionA": "valueA", "conditionB": "valueB", "conditionC": ["valueC1", "valueC2"] }
Headers
X-Pagination-Next
string optional

API route to get next set of records

X-Pagination-Previous
string optional

API route to get previous set of records

X-Total-Records
integer optional

Total number of records available

Authorization
string required

Authorization is required to access user data

Example:
Bearer <auth_token>
Responses
200 OK

Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a PUT request, the response will contain an entity corresponding to the changed resource.

201 Created

The request has been fulfilled and resulted in a new resource being created.

204 No Content

The server successfully processed the request, but is not returning any content. Default response for DELETE requests.

400 Bad request
Applied to all operations

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized
Applied to all operations

Authorization error. Please reauthenticate and try again.

403 Forbidden
Applied to all operations

You don’t have necessary permissions for the resource.

405 Method Not Allowed

A request was made of a resource using a request method not supported by that resource; for example, using PUT on a read-only resource.

410 Gone

Indicates that the resource requested is no longer available and will not be available again.

501 Not Implemented
Applied to all operations

The requested route has not been setup correctly. Please contact support.

Documentation
Introduction

This API is a RESTful service which provides methods for accessing specific resources at canonical URLs and for searching and filtering sets of resources by various criteria. Our webapp is build on this API. The list of API methods below is not a complete list of all available methods.

All representations are encoded as JSON objects.

REST Verbs
  • GET: Used for retrieving resources. Safe and idempotent method.
  • POST: Used for creating new resources. Unsafe and non-idempotent method.
  • PUT: Used for changing the attributes of a model. Unsafe and idempotent method.
  • DELETE: Used for deleting resources. Unsafe and idempotent method.

Safe methods?

Safe methods are HTTP methods that do not modify resources.

Idempotent methods?

An idempotent HTTP method is a HTTP method that can be called many times without different outcomes.

Authentication

Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources. The bearer token is short-lived.

Request data

POST and PUT requests should send the data in the body of the request as JSON object.

All PUT and POST requests accept single objects as request data. Some methods also accept batch requests, for which the request data will be an array of objects.

Request for a single object

{
	"key1": "string1",
	"key2": 2,
	"key3": "string3"
}

Batch request data (i.e. POST /api/price)

[{
	"key1": "string1a",
	"key2": 2,
	"key3": "string3a
},
{
	"key1": "string1b",
	"key2": 2,
	"key3": "string3b"
}]
Response data

When a request is successful, a response body will typically be sent back in the form of a JSON object. An exception to this is when a DELETE request is processed, which will result in a successful HTTP 204 status.

The value of the response will generally be a JSON object for a request on a single object and an array of objects for a request on a collection of objects.

Response for a single object (i.e. /api/user/83654)

{
	"id": 83654,
	"first_name": "John",
	"last_name": "Doe"
}

Response for a collection of objects (i.e. /api/user)

[{
	"id": 83654,
	"first_name": "John",
	"last_name": "Doe"
},
{
	"id": 83655,
	"first_name": "Mickey",
	"last_name": "Mouse"
}]

GET requests without id parameters return a limited result set. The size of the result set is subject to the provided limit parameter in the request, with a maximum value of 1000. The index of the first record in the result set is subject to the offset parameter in the request.

GET requests (without id) will return three headers that can be used for pagination of the result set:

  1. X-Total-Records: The total number of records found in the database for the requested resource
  2. X-Pagination-Next: This header will be set when there are additional results available not included in the returned result set. The value is the API URL to get the next set of results.
  3. X-Pagination-Previous: This header will be set when there are previous results available. The value is the API URL to navigate back to the previous result set.
API Methods
Authorization
POST /auth/login
GET /user/cognito
GET /auth/refresh
Login
POST /auth/login

Authentication

Open

Request body

Object
username
string required
Example:
test@printiki.com
password
string required
Example:
pa$sw0rd
locale
string

Two letter ISO code for selected country

Example:
nl
countryid
string

Unique number of country in database

Example:
150
currency
string

Three letter ISO code for selected currency

Example:
EUR

Responses

201 Created
Body
400 Bad request

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized

Authorization error. Please reauthenticate and try again.

403 Forbidden

You don’t have necessary permissions for the resource.

501 Not Implemented

The requested route has not been setup correctly. Please contact support.

Cognito
GET /user/cognito

Authentication

Bearer Token

Get parameters to identify user in AWS Cognito

Notes

The API will call GetOpenIdTokenForDeveloperId at the AWS Cognito API, and then return the two relevant parameters. See more information: https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetOpenIdTokenForDeveloperIdentity.html

Responses

200 OK
Body
Object
identityId
string

A unique identifier in the format REGION:GUID. Length Constraints: Minimum length of 1. Maximum length of 55. Pattern: [\w-]+:[0-9a-f-]+

Example:
eu-west-1:9145134e-764f-4399-ab8d-870b4ea6ea2c
token
string

An OpenID token.

Example:
eyJraWQiOiJldS13ZXN0LTExIiwidHlwIjoiSldTIiwiYWxnIjoiUlM1MTIifQ
400 Bad request

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized

Authorization error. Please reauthenticate and try again.

403 Forbidden

You don’t have necessary permissions for the resource.

501 Not Implemented

The requested route has not been setup correctly. Please contact support.

Refresh token
GET /auth/refresh

Authentication

Refresh Token

Responses

200 OK
Body
400 Bad request

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized

Authorization error. Please reauthenticate and try again.

403 Forbidden

You don’t have necessary permissions for the resource.

501 Not Implemented

The requested route has not been setup correctly. Please contact support.

User

API methods to work with user data.

GET /user/{userid}/photos
GET /user/{userid}/products
Get user photos
GET /user/{userid}/photos

Authentication

Bearer Token

Get all previously uploaded photos from the user

Path variables

userid
number required

Request parameters

orderby
string optional

You can order certain data sets by the field name provided as value for this parameter

Example:
orderby=id
limit
integer optional

Size of the record set requested

Max: 1,000
Default:
20
offset
integer optional

Index of record to start result set (used for pagination)

Default:
0
after
string optional

Filter records based on photodate field - select photos taken after this date

Example:
2019-01-01 00:00:00
before
string optional

Filter records based on photodate field - select photos taken before this date

Example:
2020-01-01 00:00:00
where
string optional

Conditions for result set in JSON encoded string. Result set will satisfy all provided conditions.

The following example would translate to:

conditionA = valueA AND conditionB = valueB AND (conditionC = valueC1 OR conditionC = valueC2)

Example:
where={"conditionA": "valueA", "conditionB": "valueB", "conditionC": ["valueC1", "valueC2"] }
search
string optional

Search conditions for result set in JSON encoded string. Result set will satisfy all provided conditions.

The following example would translate to:

conditionA LIKE %valueA% AND conditionB LIKE %valueB% AND (conditionC LIKE %valueC1% OR conditionC LIKE %valueC2%)

Example:
where={"conditionA": "valueA", "conditionB": "valueB", "conditionC": ["valueC1", "valueC2"] }
fields
string optional

You can choose the fields you want returned with the fields query parameter. This is really useful for making your API calls more efficient and fast. Should be a comma-separated string

Example:
fields=id,name,gender

Request headers

Authorization
string required

Authorization is required to access user data

Example:
Bearer <auth_token>

Responses

200 OK
Body
Array of Photo
400 Bad request

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized

Authorization error. Please reauthenticate and try again.

403 Forbidden

You don’t have necessary permissions for the resource.

501 Not Implemented

The requested route has not been setup correctly. Please contact support.

Get user products
GET /user/{userid}/products

Authentication

Bearer Token

Get all user generated products

Path variables

userid
string required

Request parameters

orderby
string optional

You can order certain data sets by the field name provided as value for this parameter

Example:
orderby=id
limit
integer optional

Size of the record set requested

Max: 1,000
Default:
20
offset
integer optional

Index of record to start result set (used for pagination)

Default:
0
fields
string optional

You can choose the fields you want returned with the fields query parameter. This is really useful for making your API calls more efficient and fast. Should be a comma-separated string

Example:
fields=id,name,gender
where
string optional

Conditions for result set in JSON encoded string. Result set will satisfy all provided conditions.

The following example would translate to:

conditionA = valueA AND conditionB = valueB AND (conditionC = valueC1 OR conditionC = valueC2)

Example:
where={"conditionA": "valueA", "conditionB": "valueB", "conditionC": ["valueC1", "valueC2"] }
search
string optional

Search conditions for result set in JSON encoded string. Result set will satisfy all provided conditions.

The following example would translate to:

conditionA LIKE %valueA% AND conditionB LIKE %valueB% AND (conditionC LIKE %valueC1% OR conditionC LIKE %valueC2%)

Example:
where={"conditionA": "valueA", "conditionB": "valueB", "conditionC": ["valueC1", "valueC2"] }

Request headers

Authorization
string required

Authorization is required to access user data

Example:
Bearer <auth_token>

Responses

200 OK
Body
Array of Product
400 Bad request

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized

Authorization error. Please reauthenticate and try again.

403 Forbidden

You don’t have necessary permissions for the resource.

501 Not Implemented

The requested route has not been setup correctly. Please contact support.

Data Reference
Product

Record of user generated product.

Object
id
integer

Unique identifier for the project

Example:
254784
userid
integer

Userid reference to the owner of the project

Example:
25689
group
integer

Used for defining the type of offering this project is

Example:
101
typeid
integer

Used for defining the type of offering this project is

Example:
1001
themeid
integer

Id of theme that the user selected for this product

Example:
13
created_time
string

Date and time the user started the project

Example:
2020-05-26 12:58:52
read_token
string

Token used for sharing the project with others

Example:
n7Pe5LmUzFbT3W7IQAtD
thumbnail
string

URL of the product thumbnail image

Example:
https://demo-staging-snapshots.s3-eu-west-1.amazonaws.com/productimage/72/1330_AG3IowImxQhNk1bAgG3D/cover.jpg
core
integer

Core project definition this was built on. Used when making incompatible changes to the project json scheme.

Examples

{
    "id": 254784,
    "userid": 25689,
    "group": 101,
    "typeid": 1001,
    "themeid": 13,
    "created_time": "2020-05-26 12:58:52",
    "read_token": "n7Pe5LmUzFbT3W7IQAtD",
    "thumbnail": "https://demo-staging-snapshots.s3-eu-west-1.amazonaws.com/productimage/72/1330_AG3IowImxQhNk1bAgG3D/cover.jpg",
    "core": 1
}
User

Record of app user.

Object
id
integer

Unique identifier

Example:
1
affiliateid
integer

Id of tracker that user was coming from when creating account.

Default:
0
currency
string

Id of available currency that user is using

Example:
USD
countryid
integer

Id of the user’s country (defaults to IP detection)

Example:
25
first_name
string

First name of user

Example:
John
last_name
string

Last name of user

Example:
Doe
language
string

Locale of user (ISO code)

Example:
en_US
timestamp
string date

Date and time when creating user account

Example:
2015-01-01 23:24:02
email
string

Email address of user

Example:
johndoe@gmail.com
session_nr
integer

Number of times the user logged in

Example:
5
session_time
string

Last time the user logged in

temporary
integer

If this is a guest account

Examples

{
    "id": 1,
    "affiliateid": 1,
    "currency": "USD",
    "countryid": 25,
    "first_name": "John",
    "last_name": "Doe",
    "language": "en_US",
    "timestamp": "2015-01-01 23:24:02",
    "email": "johndoe@gmail.com",
    "session_nr": 5,
    "session_time": "",
    "temporary": 1
}
Photo

Photo imported by the user

Object
id
integer

Unique identifier for the photo

Example:
87392083
userid
integer

UserId reference to the owner of the photo

Example:
1324895
kbyte
integer

Kilobyte size of the full sized photo

Example:
1024
source
string

Source this photo was selected from

Examples:
uploadfacebookinstagram
full_url
string

URL of the full-sized photo

Example:
https://hema-user.s3-eu-west-1.amazonaws.com/1324895/uploads/87392083_ajz6fpm9JmZ7SsvvCo5k/full.jpg
full_width
integer

Width in pixels of the full-sized photo

Example:
2322
full_height
integer

Height in pixels of the full-sized photo

Example:
3239
url
string

URL of the medium-sized photo

Example:
https://hema-user.s3-eu-west-1.amazonaws.com/1324895/uploads/87392083_ajz6fpm9JmZ7SsvvCo5k/web.jpg
width
integer

Width in pixels of the medium-sized photo

Example:
889
height
integer

Height in pixels of the medium-sized photo

Example:
1240
thumb_url
string

URL of the thumbnail-sized photo

Example:
https://hema-user.s3-eu-west-1.amazonaws.com/1324895/uploads/87392083_ajz6fpm9JmZ7SsvvCo5k/thumb.jpg
thumb_width
integer

Width in pixels of the thumbnail-sized photo

Example:
100
thumb_height
integer

Height in pixels of the thumbnail-sized photo

Example:
140
fcx
integer nullable

Pixel column number where the facebox starts in the full-sized photo

Example:
356
fcy
integer nullable

Pixel row number where the facebox starts in the full-sized photo

Example:
245
fcw
integer nullable

Width of facebox in pixels in the full-sized photo

Example:
1045
fch
integer nullable

Height of facebox in pixels in the full-sized photo

Example:
509
title
string nullable

Photo caption (auto imported from sources as Facebook)

Example:
Chilling at the beach
externalId
string nullable

Unique identifier for the photo at the source of the photo (see source field)

Example:
49202093822394
token
string

20-character long string needed for access to the photo

Example:
ajz6fpm9JmZ7SsvvCo5k
photodate
string nullable

Date and time the photo was taken

Example:
2020-05-26 12:58:52
Methods: Get user photos

Examples

{
    "id": 87392083,
    "userid": 1324895,
    "kbyte": 1024,
    "source": "instagram",
    "full_url": "https://hema-user.s3-eu-west-1.amazonaws.com/1324895/uploads/87392083_ajz6fpm9JmZ7SsvvCo5k/full.jpg",
    "full_width": 2322,
    "full_height": 3239,
    "url": "https://hema-user.s3-eu-west-1.amazonaws.com/1324895/uploads/87392083_ajz6fpm9JmZ7SsvvCo5k/web.jpg",
    "width": 889,
    "height": 1240,
    "thumb_url": "https://hema-user.s3-eu-west-1.amazonaws.com/1324895/uploads/87392083_ajz6fpm9JmZ7SsvvCo5k/thumb.jpg",
    "thumb_width": 100,
    "thumb_height": 140,
    "fcx": 356,
    "fcy": 245,
    "fcw": 1045,
    "fch": 509,
    "title": "Chilling at the beach",
    "externalId": "49202093822394",
    "token": "ajz6fpm9JmZ7SsvvCo5k",
    "photodate": "2020-05-26 12:58:52"
}
Auth
Object
expires
string

Timestamp when access_token expires

Example:
1592318993
access_token
string

Token to be used as Bearer token as auhtorization in API calls

Example:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJoZW1hIiwiaWF0IjoxNTkyMzE4MDkzLCJleHAiOjE1OTIzMTg5OTMsImRhdGEiOnsiaWQiOjg3OCwiYWZmaWxpYXRlaWQiOjAsImN1cnJlbmN5IjoiRVVSIiwibGFuZ3VhZ2UiOiJubCIsImNvdW50cnlpZCI6MTUwLCJlbWFpbCI6ImJqb3JuK0Bzb3NvY2lvLmNvbSIsImZpcnN0X25hbWUiOiJCam9ybiIsImxhc3RfbmFtZSI6IitURVNURkxBRysiLCJ0ZW1wb3JhcnkiOjB9fQ.XAwidw3H_eTNnkiIE73k0JZyL_H1IGfc-dyWmr4dbgE
refresh_token
string

Token to be used to request a new access_token

Example:
1.13a200fcdcd2550070a5c0305f699c71ff9c4678a8d60a2a328cead793c827f5bd86245b8fb8d7bf20de52052b3a4433f1a1607619a78d6a465254d271dbca3df73ccd8c243dc5850a0aad957e1f8c77c075453312fc4150307295dd9874566a58b59e8a3b775e2a0614bc5c6d2dd34f316dff791dbb9cf4
token_type
string

Type of access_token returned

Example:
bearer