NAV
shell php python ruby

MomaPIX REST Service 2.0

Introduction

Welcome to the documentation for the MomaPIX REST service 2.0, an online platform that provides digital asset management solutions for professionals and companies.

MomaPIX is a cloud-based platform that allows users to store, organize, and share their digital assets such as photos, videos, and documents. The MomaPIX API REST is a powerful tool that enables developers to integrate the platform's functionality into their own applications and workflows.

This documentation serves as a comprehensive guide for developers who want to use the MomaPIX API REST to create custom applications or extend the platform's capabilities. It includes detailed information on the API's endpoints, parameters, and authentication methods, as well as examples of how to use the API in popular programming languages.

Whether you're an experienced developer or new to the world of APIs, this documentation will provide you with everything you need to know to get started with the MomaPIX API REST. From uploading and managing assets to creating and editing metadata, you'll find all the information you need to build powerful and efficient applications that leverage the full power of the MomaPIX platform.

We hope this documentation proves to be a valuable resource in your development journey, and we look forward to seeing the innovative applications and workflows you create with the MomaPIX API REST.

Releases

Supported version

Only the current release of our API is actively developed and supported. Older releases are maintained until the end-of-life date, after which the connection using that release will no longer be available. We strongly encourage all developeds to migrate to the latest release of our API, as it offers improved performance, security, and features.

VersionReleasedEnd-of-developEnd-of-life
2.0Apr 2023--
1.0Dec 2020Dec 2022Dec 2023

Changelog

April 2024 - Version 2.1.0

April 2023 - Version 2.0.0

Requirements

Information exchange

The MomaPIX RESTful Web Service requires the use of the JSON API 1.1 specifications when exchanging information. This format defines the structure and organization of data to ensure consistency and compatibility across API requests and responses.

When making requests to the MomaPIX API, developers must include the appropriate HTTP headers to indicate the data format. Specifically, the Content-Type headers must be set to "application/vnd.api+json" and Accept headers must be set to application/vnd.api+json; version=2.0 to ensure the API can handle the data appropriately.

Content-Type: application/vnd.api+json

Accept: application/vnd.api+json; version=2.0

Detailed information about the HTTP negotiation and content structure is available in the JSON API 1.0 specification, which developers are encouraged to read.

It's important to note that each JSON document sent or received in the body of an HTTP request or response must comply with a specific JSON schema.

Before making a request to an endpoint, developers can use the OPTIONS verb to retrieve information about the supported methods and the available resources for the specified endpoint. The OPTIONS response will include links to the JSON schemas used to validate the body of each requests. By following the link, developers can access the schema and use it to validate the data sent.

Authentication and Authorization

To use MomaPIX RESTful Web Service, the application must provide the API KEY assigned to the developer by the MomaPIX host administrator. The API KEY must be included in the header of each HTTP request as follows:

Apikey: <your-api-key>

After the first successful connection, the authorization level will be bound to a personal Bearer Token. The Bearer Token must be provided in the HTTP request header for each subsequent connection, as follows:

Authorization: Bearer <token-id>

Bearer tokens have a limited lifetime, which is indicated by the ExpiresIn field in the GET session response. This field specifies the duration, in seconds, of the access token. For example, if the ExpiresIn value is 3600, the access token will expire in one hour from the time the response was generated.

It is possible to obtain specific authorization for specific RESTful services by providing a login and password.

While the API KEY is used to authenticate your application, the login and password are used for service authorization.

Pagination, Sorting and filtering

In modern web development, it is common for web applications to retrieve large amounts of data from RESTful APIs. When the requested data includes several items, it is essential to implement pagination to avoid performance issues, improve user experience, and minimize the server response time. Pagination divides the response into several pages, displaying only a subset of the results at a time.

In addition to pagination, sorting and filtering are also important techniques to organize and retrieve data from RESTful APIs efficiently. Sorting allows the returned data to be ordered according to specific criteria, while filtering limits the returned data based on specific conditions.

In this chapter, we will discuss the concepts of pagination, sorting, and filtering in the context of MomaPIX RESTful APIs.

Pagination

MomaPIX RESTful API allows users to request only a subset of items from a larger set of data. This strategy is implemented using pagination, which divides the data into multiple pages based on a predefined number of items per page. To navigate between pages, the developer can specify the page[number] parameter. If available, the page[size] parameter can be used to define the number of items per page.

Sorting

MomaPIX RESTful API allows developers to sort the retrieved data based on certain criteria. The sort parameter can be used to define the sorting order of the items. By default, the items are sorted in descending order. However, to sort in ascending order, a minus (-) symbol can be added before the sort value.

Filtering

MomaPIX RESTful API provides a filter query parameter to help users filter data. The filter query parameter is used to restrict the data returned based on certain criteria. MomaPIX RESTful API will only return data that satisfies the specified filter conditions. If the filters or filter values are not supported by the resource, they will be ignored.

Dealing with languages

The HTTP protocol provides a mechanism to indicate the preferred language for the content returned in a response. This is achieved through the use of the Accept-language header field, which allows developers to specify which languages is preferred. If language options are available (i.e. the MomaPIX archive developers are querying does support multiple language metadata and/or multiple language query string), the server will try to satisfy the request as best as possible and if it's not able to do so will fall back to the default language.

Here's an example of an HTTP Accept-Language header to specify English as the preferred language but also indicate that Italian content is acceptable if English is not available:

Accept-Language: en-US,en;q=0.5,it;q=0.3

The Accept-language header parameter full syntax and semantics are defined by the RFC5646 standard.

Naming Convention

The naming convention used for endpoints and object types in this API follows a standard practice to ensure consistency and clarity for developers. The following guidelines were followed:

Object Type Naming Convention

All object types in the API have a singular name. Examples of object types include item, event, and lightbox.

Endpoint Naming Convention

Endpoints for retrieving a single object always have a singular name. For example, the endpoint to retrieve a single item is /rest/item/<id>. This endpoint retrieves an item based on its unique identifier.

Endpoints for retrieving collections of objects always have a plural name. For example, the endpoint to retrieve a collection of items is /rest/search/items. This endpoint retrieves a collection of items that match certain criteria.

Getting details about capabilities

The OPTIONS HTTP verb is a standard HTTP method that is used by web servers to inform client applications about the HTTP methods and headers that are supported for a particular resource. In the case of MomaPIX, the OPTIONS method can be used to determine what methods are available for a particular endpoint, what headers are required or allowed and other information related to the endpoint's behavior.

When a developer sends an OPTIONS request to a MomaPIX endpoint, the server responds with an HTTP 200 OK status code and a set of headers that describe the endpoint's capabilities. These headers can include Allow, which specifies the HTTP methods that are allowed for the resource, and Access-Control-Allow-Headers, which lists the headers that are allowed in the request.

More information about the capabilities of the endpoint are included in the response body. For each method supported, developers will find a link to a validation JSON schema and a description of how to use the request and what the response means. If developers follow the link to the JSON schema, they can use it to make sure the data you send is in the right format. Refers to the output generated by an OPTIONS request to get deeper details about the capabilities of each endpoint.

Quick start

Here's a step-by-step guide to help developers interact with the MomaPIX RESTful service:

  1. Get your API Key: To use the MomaPIX RESTful service, developers need to have an API key assigned to him by the MomaPIX host administrator. This key is used to authenticate applications and must be included in the header of each HTTP request as follows: Apikey: <your-api-key>

  2. Fetch your Bearer Token: After the first successful connection, the authorization level will be bound to a personal Bearer Token. The Bearer Token must be provided in the HTTP request header for each subsequent connection as follows: Authorization: Bearer <token-id>. Bearer tokens have a limited lifetime, which is indicated by the ExpiresIn field in the GET session response. This field specifies the duration, in seconds, of the access token.

  3. Get specific authorization using login and password: If the client application need specific authorization for specific RESTful services, it must authenticate using a login and password. The API Key is used to authenticate your application, while the login and password are used for service authorization.

  4. Explore the API: Once developers have the API KEY and Bearer Token, they can start exploring the available endpoints. Client application can connect to an endpoint using the appropriate HTTP verb (GET, POST, PUT, DELETE, etc.) and providing the necessary parameters. Additionally, developers can use the HTTP OPTIONS verb to retrieve important information about the endpoint, such as the available methods and expected parameters. This can be helpful for understanding the capabilities of the endpoint and how to interact with it.

Here is a summary of some of the available endpoints:

API reference

Session

GET POST DELETE

First connection to fetch Bearer Token

GET /rest/session

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/session"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/session"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/session"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/session"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/session"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
response = http.request(request)

After obtaining the API key from the MomaPIX host administrator, the next step is to fetch the bearer token. This can be done using a GET request to the /rest/session endpoint with the API key included in the Apikey header.

This will return a response with a json body that contains the bearer token that you will need to use in subsequent requests.

You should store this bearer token securely, as it represents your authorization to access the MomaPIX RESTful service. Bearer tokens have a limited lifetime, which is indicated by the ExpiresIn field in the response. This field specifies the duration, in seconds, of the access token. For example, if the ExpiresIn value is 3600, the access token will expire in one hour from the time the response was generated.

To keep your session alive or check the status of session, you can use the /rest/session resource supplying the Bearer-token header valued with the token in use. The server will return a 200 OK response and a JSON body that describes the status of the session. If you connect to /rest/session endpoint without providing the bearer token, a new one will be allocated and the current authorization will not be valid anymore.

Response

# Response

{
    "data": {
        "type": "session",
        "id": "u4gfc3abum2t0jp34b3bbvcuba",
        "attributes": {
            "TokenId": "u4gfc3abum2t0jp34b3bbvcuba",
            "ExpiresIn": 604800,
            "InteractiveTimeout": 604800,
            "LoggedIn": false,
            "Name": null
        }
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body including the following information:

Login

POST /rest/session

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X POST -d '{
        "data": {
            "id": "u4gfc3abum2t0jp34b3bbvcuba",
            "type": "session",
            "attributes": {
                "username": "client1",
                "password": "client1"
            }
        }
    }'  \
    -g "http://sandbox.my.momapix.com/testme/rest/session"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/session"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
        "data": {
            "id": "u4gfc3abum2t0jp34b3bbvcuba",
            "type": "session",
            "attributes": {
                "username": "client1",
                "password": "client1"
            }
        }
    }');

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/session"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}

data = '{
        "data": {
            "id": "u4gfc3abum2t0jp34b3bbvcuba",
            "type": "session",
            "attributes": {
                "username": "client1",
                "password": "client1"
            }
        }
    }'

response = requests.post('http://sandbox.my.momapix.com/testme/rest/session"', headers=headers, data=data)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/session"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
request.body = '{
        "data": {
            "id": "u4gfc3abum2t0jp34b3bbvcuba",
            "type": "session",
            "attributes": {
                "username": "client1",
                "password": "client1"
            }
        }
    }'
response = http.request(request)

To request authorization, you need to send a POST request to the /rest/session resource. You must provide your username and password in the request body, in JSON format, with the following attributes:

Response

# Response

{
    "data": {
        "type": "session",
        "id": "u4gfc3abum2t0jp34b3bbvcuba",
        "attributes": {
            "TokenId": "u4gfc3abum2t0jp34b3bbvcuba",
            "ExpiresIn": 604800,
            "InteractiveTimeout": 604800,
            "LoggedIn": true,
            "Name": "Client One"
        }
    }
}
Success

If your authentication is successful, the server will return an HTTP response with status code 200 OK and the Bearer token in the response body.

Logout

DELETE /rest/session

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X DELETE \
    -g "http://sandbox.my.momapix.com/testme/rest/session"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/session"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/session"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.delete('http://sandbox.my.momapix.com/testme/rest/session"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/session"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

To log out from the web application, you need to make a request to the rest/session resource with the HTTP method "DELETE" and an empty body. This request will end the current session and log out the user.

When you make a "DELETE" request to the rest/session resource, you need to provide the Bearer-token header along with the standard headers. The Bearer-token header is used to authenticate the request and to verify that the user making the request is authorized to log out.

In summary, to log out from the web application, you need to make a "DELETE" request to the rest/session resource with the Bearer-token header. This request will terminate the current session and log out the user.

Response

# Response

{
    "data": {
        "type": "session",
        "id": "u4gfc3abum2t0jp34b3bbvcuba",
        "attributes": {
            "TokenId": "u4gfc3abum2t0jp34b3bbvcuba",
            "ExpiresIn": 604800,
            "InteractiveTimeout": 604800,
            "LoggedIn": false,
            "Name": null
        }
    }
}
Success

Once the server receives the "DELETE" request with the Bearer-token header, it will terminate the current session and log out the user. The server will then return a response with a status code of 200 OK, indicating that the session has been successfully terminated, or a 403 Forbidden if you provide an incorrect token.

Items

GET POST PATCH DELETE

An ITEM refers to the primary resource stored in a MomaPIX archive, which typically contains a visual file (e.g., image or video) along with its associated metadata. However, it can also be any type of file. The management of items is carried out via the /rest/item endpoint, which is accessible through typicals HTTP methods.

  1. GET: The GET method in MomaPIX is used to retrieve information about a specific item. A GET request to the /rest/item/<id> endpoint will return a representation of the item along with its metadata in the response body. This method is used to fetch data about an item from the server.

  2. POST: The POST method in MomaPIX is used to create a new item in the archive. A POST request to the /rest/items endpoint with the item data in the request body will create a new item on the server. This method is used to add a new item to the archive.

  3. PATCH: The PATCH method in MomaPIX is used to update the metadata of an existing item. A PATCH request to the /rest/item/<id> endpoint with the updated metadata in the request body will modify the metadata of the specified item on the server. This method is used to update the metadata of an item.

  4. DELETE: The DELETE method in MomaPIX is used to remove an item from the archive. A DELETE request to the /rest/item/<id> endpoint will delete the specified item from the archive. This method is used to remove an item from the archive.

Let's deep explain each method.

Retrieving information about a specific item

GET /rest/item/<id>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/item/2241642"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/item/2241642"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/item/2241642"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/item/2241642"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/item/2241642"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

The GET method is used to retrieve information about a specific item. The id specified in the url refers to the identifier of the item riequested.

Response

# Response

{
    "data": {
        "type": "item",
        "id": 2241642,
        "attributes": {
            "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320005c377209da89dc5b59261db0102ebd453610903f3da54fb9aa40b125330f0a22/Preview2241642.jpg",
            "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320005c377209da89dc5b59261db0102ebd453610903f3da54fb9aa40b125330f0a22/Image2241642.jpg",
            "xsize": 3300,
            "ysize": 2200,
            "id_event": 699108,
            "id": 2241642,
            "mime_type": "image/jpeg",
            "archive": "photo",
            "license": "RM",
            "title": "Udienza generale del mercoledi'",
            "caption": "Citta' del Vaticano 11/04/2018, udienza generale del mercoled\u00ec'. Nella foto papa Francesco con alcuni migranti richiedenti asilo",
            "date": "2018-04-11"
        }
    }
}
Success

If the request is successful, an HTTP 200 OK status code and an item object resource will be returned in the JSON response body. The list of attribute returned in the item object resource is a partial list of valued attribute available on the server. The list of attributes returned can be customize using the query parameter fileds[item] valued with a comma separated list of wished attributes. Use the special value all to retrieve all the attributes available.

The following is an example of attributes belonging to an item object resource returned by the rest/items endpoint:

name description
url_thumb_l url of image preview
url_thumb_m url of image thumbnail
url_stream_m url of video preview
xsize width in pixel
ysize height in pixel
id_event id of the related event
id id of the item
mime_type mime type of the current item
file_size file size of the current item
file_name original file name of the current item
file_extension original file extension of the current item
uploaded_date upload date and time of the file
lastupdate_date last udate and time of the file
creation_date creation date of the file
archive type of item (photo,video,audio,text)
license license of the item (RM for right-managed, RF for royalty-free, CF for copyright free

An unsuccessful request returns an HTTP 40x status code and a JSON body describing the error occurred.

Uploading a new item

POST /rest/item

Request

# Request

curl -s \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -F "userfile=@/tmp/rh941670.jpg" \
    -X POST \
    -g "http://sandbox.my.momapix.com/testme/rest/item"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/item"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: multipart/form-data" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, [
        'userfile' => new CURLFile('/tmp/rh941670.jpg'),
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/item"'

headers = {
    'Content-Type': 'multipart/form-data' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}

data = {
};

files = {
    'userfile' : ('rh941670.jpg', open('/tmp/rh941670.jpg', 'rb'))
}

response = requests.post('http://sandbox.my.momapix.com/testme/rest/item"', headers=headers, data=data, files=files)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/item"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "multipart/form-data"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
request.set_form_data(
        'userfile' => UploadIO.new(File.open('/tmp/rh941670.jpg'), 'application/octet-stream', 'rh941670.jpg'),
)
response = http.request(request)

To upload a new file, you must send an HTTP POST request to the /rest/items endpoint of the server. The server requires authentication and authorization headers (Api Key and Authorization) as usual and an unusual Content-Type header valued with multipart/form-data.

To specify the file to be uploaded, you need to provide its location on the local machine. This file will be transmitted to the server as part of the request body. The POST body should have the file itself as the minimal content.

The server will perform several checks and, if no test will fail, it will store the file for later use assigning a unique id and a event id according to the server rules . If the file is an image containing IPTC header information, the server will utilize that information to catalog the new item.

Furthermore, it is also possible to include any additional attribute that is defined on the server along with the POST body. For instance, if you want to upload a file in the private section of the archive, you can post the pair "section=private"; if you wish to assign a title to the item (overwriting IPTC default title information) you can post the pair "title=...."; if you wish to assign a specific id_event to the item (overwriting the one assigned by the system) you can post the pair "id_event=....". Overall, by including additional attributes in the post request, you can customize the upload process to meet your specific requirements and make the most out of the server's capabilities.

If you want to specify the ID that will be assigned to the new file (and you are certain that the proposed ID has not already been allocated), you can include the special attribute id_original by posting the pair "id_original=....".

Response

# Response

{
    "data": {
        "type": "item",
        "id": 2241833,
        "attributes": {
            "url_thumb_l": "http://sandbox.d0.momapix.com/testme/3200076413013e6ef6fab633d37c0818d7785e0d0462aab95c236a8a107909a7deb2b/Preview2241833.jpg",
            "url_thumb_m": "http://sandbox.d0.momapix.com/testme/3200076413013e6ef6fab633d37c0818d7785e0d0462aab95c236a8a107909a7deb2b/Image2241833.jpg",
            "xsize": 1500,
            "ysize": 1000,
            "id_event": 699119,
            "id": 2241833,
            "mime_type": "image/jpeg",
            "archive": "photo",
            "license": "RM",
            "title": "- nuovo servizio caricato da supplier1 il 05-02-2024 001",
            "date": "2024-02-05"
        },
        "links": {
            "event": "http://sandbox.my.momapix.com/testme/event/it/1/699119"
        }
    }
}
Success

When the request is sent and it is successful, the server will respond with a JSON response body containing an item object resource and an HTTP 200 OK status code. The item object resource will include all the attributes of the item that was uploaded. Additionally, the JSON response body will contain a link to the event with which the uploaded item has been associated.

Updating the metadata of an existing item

PATCH /rest/item/<id>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X PATCH -d '{
        "data": {
            "id": 2241833,
            "type": "item",
            "attributes": {
                "title": "this is the new title",
                "section": "trash"
            }
        }
    }'  \
    -g "http://sandbox.my.momapix.com/testme/rest/item/2241833"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/item/2241833"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
        "data": {
            "id": 2241833,
            "type": "item",
            "attributes": {
                "title": "this is the new title",
                "section": "trash"
            }
        }
    }');

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/item/2241833"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}

data = '{
        "data": {
            "id": 2241833,
            "type": "item",
            "attributes": {
                "title": "this is the new title",
                "section": "trash"
            }
        }
    }'

response = requests.patch('http://sandbox.my.momapix.com/testme/rest/item/2241833"', headers=headers, data=data)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/item/2241833"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
request.body = '{
        "data": {
            "id": 2241833,
            "type": "item",
            "attributes": {
                "title": "this is the new title",
                "section": "trash"
            }
        }
    }'
response = http.request(request)

To modify an item that has been previously uploaded to the archive, you need to send a PATCH request to the endpoint /rest/item/<id>. In the body of the request, you should include a JSON object that describes the new values for the attributes associated with the item. The JSON object should conform to the structure of an item object resource and should only include the attributes for which you wish to update the value.

Response

# Response

null
Success

When the request is successful, the server will respond with an HTTP status code of 204, which means that there is no content to be returned in the response body. The absence of a response body is a standard way of indicating that the requested operation has been successfully completed, and that no further information needs to be conveyed.

Removing an item from the archive

DELETE /rest/item/<id>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X DELETE \
    -g "http://sandbox.my.momapix.com/testme/rest/item/2241833"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/item/2241833"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/item/2241833"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.delete('http://sandbox.my.momapix.com/testme/rest/item/2241833"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/item/2241833"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

The DELETE operation is used to delete a resource on the server using the HTTP DELETE method. It is used when the client wants to delete a specific resource on the server.

The client must sends a DELETE request to the server endpoint /rest/item/<id> where the id refers to the resource to be deleted. The server then deletes the resource and returns a response indicating whether the deletion was successful or not.

It is also important to note that not all resources can be deleted. Some resources may be protected and require special privileges to be deleted. The server will respond with an error code if the user is not authorized to perform the deletion operation.

A general guideline is that an item should be moved to the trash section before it can be deleted.

Response

# Response

null
Success

Upon a successful request, the server will return an HTTP status code of 204, indicating that the response body is empty. However, if an error occurs, the server will respond with an HTTP status code of 4xx, and the response body will include an error object resource describing the type of error that occurred.

Events

GET

An EVENT is a collection of ITEMS having some common characteristics . Such a set of items share an attribute named id_event that must be used in order to fetch information about a specific event.

Retrieving the list of events

GET /rest/events

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/events"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/events"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/events"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer mnr6hl21kqkkq1lsce237r286e' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/events"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/events"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer mnr6hl21kqkkq1lsce237r286e"
response = http.request(request)

The REST service accessible at the address /rest/events is designed to provide a chronological list of the latest events that have been uploaded. Clients can make requests to this service using standard GET methods to retrieve the list of events. The service responds with a JSON representation of the data.

The list of events is sorted in chronological order, with the most recent events appearing first. Each event in the list includes details such as the date and time it was uploaded, the title of the event, and any other relevant information.

Query Parameters:

Pagination is controlled by two parameters in the URL: page[size] and page[number]. The page[size] parameter specifies the number of events to be included in each page of results. For example, if a client sets page[size] to 10, each page of results will include 10 events.

The page[number] parameter specifies which page of results to return. For example, if a client sets page[number] to 2, the service will return the second page of results, which includes the events that follow the first page. The /rest/events response also includes links to the previous and next pages of results (as well as links to the first and last pages of results).

Fields Filtering:

The /rest/events service also supports a query parameter called fields[event], which allows clients to limit the fields that are returned for each event. This can be useful when clients only need to display a subset of the available data.

The fields[event] parameter can be set to a comma-separated list of field names that should be included in the response. For example, if a client sets fields[event] to "title,date", the service will only include the event title and date fields in the response.

If the client sets fields[event] to "all", then all available fields for each event will be returned.

Response

# Response

{
    "meta": {
        "total": 738,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "event",
            "id": 699118.3,
            "attributes": {
                "numberofitemsinevent": 1,
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/32000a057d6b1c260013e6ffce370a546354451d7c90d7fa087a5b5f20fbf9ee6dbbe/Preview2241780.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/32000a057d6b1c260013e6ffce370a546354451d7c90d7fa087a5b5f20fbf9ee6dbbe/Image2241780.jpg",
                "text": null,
                "title": "- nuovo servizio caricato da root il 27-02-2023 001",
                "date": "2023-02-27"
            },
            "links": {
                "self": "http://sandbox.my.momapix.com/testme/rest/event/699118.3"
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/events?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/events?page[number]=1&page[size]=100",
        "next": "http://sandbox.my.momapix.com/testme/rest/events?page[number]=2&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/events?page[number]=8&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a collection of event objects resource or an empty array if no event is available.

A event objects resource data is qualified by:

A event attributes object has at least the following properties:

Retrieving information about an event

GET /rest/event/<id>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/event/699108"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/event/699108"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/event/699108"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer mnr6hl21kqkkq1lsce237r286e' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/event/699108"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/event/699108"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer mnr6hl21kqkkq1lsce237r286e"
response = http.request(request)

Use the GET method to retrieve information about a specific event. This endpoint supports the use of query parameters for setting pagination and fields filtering. The available keys are listed below:

Keys Possible value Default Description
page[number] positive integer 1 The page number to show
page[size] positive integer beetween 1 and 999 100 The pagination size. Not all values are accepted. This number will be always rounded to the next or the max value supported. Some supported value can be 10,16,20,25,32,50,64,96,100,200,250.
fields[item] comma separated strings Fields (related to returned items) to be included in the response JSON body. By default, in order to optimize the use of bandwidth, only a subset of attributes are returned. More optimization can be reached specifing a smaller subset. The all special value let you ask for the complete list of available fields.
fields[event] comma separated strings Fields (related to fetched event) to be included in the response JSON body. By default, in order to optimize the use of bandwidth, only a subset of attributes are returned. More optimization can be reached specifing a smaller subset. The all special value let you ask for the complete list of available fields.

An example of fully qualified request to the /rest/events endpoint is the following:

https://<server address>/rest/event/100010

The meaning of this request is:

An example of fully qualified request to the /rest/events endpoint with query parametes is the following:

https://<server address>/rest/event/100010?page[number]=1&page[size]=10&fields[item]=all&fields[event]=date,title`

The meaning of this request is:

Response

# Response

{
    "meta": {
        "total": 32,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": {
        "type": "event",
        "id": 699108,
        "attributes": {
            "numberofitemsinevent": 32,
            "url_thumb_l": "http://sandbox.d0.momapix.com/testme/3200076de87aff776addcb0f6f05f7036dcbff6cfe84b6682aaa669523170128cde13/Preview699108.jpg",
            "url_thumb_m": "http://sandbox.d0.momapix.com/testme/3200076de87aff776addcb0f6f05f7036dcbff6cfe84b6682aaa669523170128cde13/Image699108.jpg",
            "text": null,
            "title": "Udienza generale del mercoledi'",
            "date": "2018-04-11"
        },
        "relationships": {
            "items": {
                "links": {
                    "self": "http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items?page[number]=1&page[size]=100",
                    "related": "http://sandbox.my.momapix.com/testme/rest/event/699108/items?page[number]=1&page[size]=100"
                },
                "data": [
                    {
                        "type": "item",
                        "id": 2241642
                    },
                    ...
                    ...
                    ...
                ]
            }
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/event/699108?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/event/699108?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/event/699108?page[number]=1&page[size]=100"
    },
    "included": [
        {
            "type": "item",
            "id": 2241642,
            "attributes": {
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320005c377209da89dc5b59261db0102ebd453610903f3da54fb9aa40b125330f0a22/Preview2241642.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320005c377209da89dc5b59261db0102ebd453610903f3da54fb9aa40b125330f0a22/Image2241642.jpg",
                "xsize": 3300,
                "ysize": 2200,
                "id_event": 699108,
                "id": 2241642,
                "mime_type": "image/jpeg",
                "archive": "photo",
                "license": "RM",
                "title": "Udienza generale del mercoledi'",
                "caption": "Citta' del Vaticano 11/04/2018, udienza generale del mercoled\u00ec'. Nella foto papa Francesco con alcuni migranti richiedenti asilo",
                "date": "2018-04-11"
            }
        },
        ...
        ...
        ...
    ]
}
Success

A successful request returns an HTTP 200 OK status code and an event object resource JSON response body.

The event object resource includes the following strutured object:

name content
type Always set to "events"
id Always set to event id
attributes An attributes object with information about the event. The list of returned attributes is set according to the fields[event] query parameter.
relationships A relationships object containing meta-information about the pagination status (meta object), a set of link for fetching first, last, next and previous pool of related resources (link object), and an array with the list of related items returned in the included section.
included An array of items object resource. The list of attributes returned for each resource will be set according to the field[items] query parameter.

The default attribute object returned by the rest/events endpoint includes the following attributes:

name description
url_thumb_l url of preview used to represent the event. It coincides with the preview of the first item of the event.
url_thumb_m url of thumbnail used to represent the event. It coincides with the thumbnail of the first item of the event.
xsize width in pixel of item used to represent the event.
ysize height in pixel item used to represent the event.
numberofitemsinevent number of items belonging to the event.
text a text, could be very long (usually an article), describing the event.

Other attributes may be returned according to the server configuration and the value of the query parameter fields[event].

An unsuccessful request returns an HTTP 40x status code and a JSON body describing the error occurred.

Fetching the list of items in an event

GET /rest/event/<event identifier>/relationships/items

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer mnr6hl21kqkkq1lsce237r286e' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer mnr6hl21kqkkq1lsce237r286e"
response = http.request(request)

This HTTP API endpoint returns the relationships between the specified event and its associated items, <event identifier> being the unique identifier of the event for which you want to retrieve the relationships. Pagination is supported using the page[size] and page[number] query paramenter.

Response

# Response

{
    "meta": {
        "total": 32,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/event/699108/relationships/items?page[number]=1&page[size]=100"
    },
    "data": [
        {
            "type": "item",
            "id": 2241642
        },
        ...
        ...
        ...
    ]
}
Success

The data attribute returned contains an array of JSON objects, each representing a relationships between the event identified by and the items related to it. Each object has the following attributes:

Fetching the content of an event

GET /rest/event/<event identifier>/items

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/event/699108/items"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/event/699108/items"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer mnr6hl21kqkkq1lsce237r286e" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/event/699108/items"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer mnr6hl21kqkkq1lsce237r286e' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/event/699108/items"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/event/699108/items"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer mnr6hl21kqkkq1lsce237r286e"
response = http.request(request)

This HTTP API endpoint returns a list of all items associated with the event identified by <event identifier>. Pagination is supported using the page[size] and page[number] query parameter. Use the query filter fields[item] to limit or estend the list of attribute returned,

Response

# Response

{
    "meta": {
        "total": 32,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/event/699108/items?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/event/699108/items?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/event/699108/items?page[number]=1&page[size]=100"
    },
    "data": [
        {
            "type": "item",
            "id": 2241642,
            "attributes": {
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320005c377209da89dc5b59261db0102ebd453610903f3da54fb9aa40b125330f0a22/Preview2241642.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320005c377209da89dc5b59261db0102ebd453610903f3da54fb9aa40b125330f0a22/Image2241642.jpg",
                "xsize": 3300,
                "ysize": 2200,
                "id_event": 699108,
                "id": 2241642,
                "mime_type": "image/jpeg",
                "archive": "photo",
                "license": "RM",
                "title": "Udienza generale del mercoledi'",
                "caption": "Citta' del Vaticano 11/04/2018, udienza generale del mercoled\u00ec'. Nella foto papa Francesco con alcuni migranti richiedenti asilo",
                "date": "2018-04-11"
            }
        },
        ...
        ...
        ...
    ]
}
Success

The data attribute returned contains an array of JSON objects, each representing an item object resource associated with the event.

Lightboxes

GET

In the context of the MomaPIX Digital Asset Management (DAM) software, a lightbox is a feature that allows users to collect and organize a selection of digital assets (such as images, videos, and documents) into a virtual container or "box".

Lightboxes are useful when users want to group together specific assets for a particular purpose, such as to create a presentation, to share with a client or team member, or to use in a marketing campaign. Lightboxes can also be used as a way to temporarily save and organize assets for future reference.

With the MomaPIX DAM software, users can easily create lightboxes by selecting assets from the library and adding them to a new or existing lightbox. They can also customize the lightbox's name or the description and define the image that will rapresent the lightbox, i.e. the cover of the lightbox.

Once a lightbox has been created, users can view its contents, download the assets or share the lightbox with others via a unique URL. The MomaPIX DAM software also allows desk users to collaborate on lightboxes of customer users by editing and populate them with the content of their interest.

Fetching a collection of lightboxes

GET /rest/lightboxes

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/lightboxes"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightboxes"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightboxes"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/lightboxes"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightboxes"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

This endpoint provides access to the list of resources available in the user's lightbox. The response is a JSON object containing an array of resource objects. The lightboxes are returned sorted by creation date, with the most recently created lightboxes appearing first. This connnection require proper authentication.

Query Parameters:
Fields Filtering:

To retrieve only certain fields of the lightbox resource object, use the fields[lightbox] query parameter with a comma-separated list of fields to include in the response. Use the "all" value to request the full list of available properties.

Response

# Response

{
    "meta": {
        "total": 12,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "lightbox",
            "id": 235,
            "attributes": {
                "description": "The title of this new lightbox",
                "subject_date": "2024-02-03",
                "xsize": 3000,
                "ysize": 2012,
                "numberofitemsinlightbox": 2,
                "url_thumb_m": "http://sandbox.d1.momapix.com/testme/320009fd720dfb339e1905e9a7475161075662aaa930ed0d2ac27be6229ed34bbc9fc/Image2239273.jpg",
                "url_thumb_l": "http://sandbox.d1.momapix.com/testme/320009fd720dfb339e1905e9a7475161075662aaa930ed0d2ac27be6229ed34bbc9fc/Preview2239273.jpg"
            },
            "links": {
                "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/235"
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/lightboxes?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/lightboxes?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/lightboxes?page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a collection of lightbox objects resource belonging to the logged-in user or an empty array if no lightbox is available.

A lightbox objects resource data is qualified by:

A lightbox attributes object has at least the following properties:

Fetching a lightbox

GET /rest/lightbox/<id_lightbox>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/lightbox/15"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightbox/15"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightbox/15"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/lightbox/15"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightbox/15"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

This endpoint provides access to a lightbox and its related items.

URL Parameters:

Query Parameters
Filtering

To retrieve only certain fields of the lightbox resource object or its related items, use the fields[lightbox] and fields[item] query parameter with a comma-separated list of fields to include in the response. Use the "all" value to request the full list of available properties.

Response

# Response

{
    "meta": {
        "total": 16,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": {
        "type": "lightbox",
        "id": 15,
        "attributes": {
            "numberofitemsinlightbox": 16,
            "xsize": 2107,
            "ysize": 3000,
            "description": "default",
            "subject_date": "0000-00-00",
            "text": null,
            "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320008ba3c3b3a444cce35d086162fc7c23cdb6c989f8b5149140cb2190a9bd81e5ab/Image2240610.jpg",
            "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320008ba3c3b3a444cce35d086162fc7c23cdb6c989f8b5149140cb2190a9bd81e5ab/Preview2240610.jpg"
        },
        "relationships": {
            "items": {
                "links": {
                    "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items?page[number]=1&page[size]=100",
                    "related": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/items?page[number]=1&page[size]=100"
                },
                "data": [
                    {
                        "type": "item",
                        "id": 2240610
                    },
                    ...
                    ...
                    ...
                ]
            }
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/15?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/lightbox/15?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/lightbox/15?page[number]=1&page[size]=100"
    },
    "included": [
        {
            "type": "item",
            "id": 2240610,
            "attributes": {
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320008ba3c3b3a444cce35d086162fc7c23cdb6c989f8b5149140cb2190a9bd81e5ab/Preview2240610.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320008ba3c3b3a444cce35d086162fc7c23cdb6c989f8b5149140cb2190a9bd81e5ab/Image2240610.jpg",
                "xsize": 2107,
                "ysize": 3000,
                "id_event": 699072,
                "id": 2240610,
                "mime_type": "image/jpeg",
                "archive": "photo",
                "license": "RM",
                "title": "Premiere del film The Guernsey Literary and Potato Peel Pie Society",
                "caption": "09/04/2018 Londra, premiere del film The Guernsey Literary and Potato Peel Pie Society, nella foto Jessica Brown Findlay e Lily James",
                "date": "2018-04-09"
            }
        },
        ...
        ...
        ...
    ]
}
Success

A successful request returns the HTTP 200 OK status code and a single lightbox objects.

The returned JSON object contains the following sections:

Creating a lightbox

POST /rest/lightbox/<id_lightbox>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X POST -d '{
        "data": {
            "type": "lightbox",
            "attributes": {
                "description": "The title of this new lightbox"
            },
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2239272"
                        },
                        {
                            "type": "item",
                            "id": "2239273"
                        }
                    ]
                }
            }
        }
    }'  \
    -g "http://sandbox.my.momapix.com/testme/rest/lightbox"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightbox"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
        "data": {
            "type": "lightbox",
            "attributes": {
                "description": "The title of this new lightbox"
            },
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2239272"
                        },
                        {
                            "type": "item",
                            "id": "2239273"
                        }
                    ]
                }
            }
        }
    }');

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightbox"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}

data = '{
        "data": {
            "type": "lightbox",
            "attributes": {
                "description": "The title of this new lightbox"
            },
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2239272"
                        },
                        {
                            "type": "item",
                            "id": "2239273"
                        }
                    ]
                }
            }
        }
    }'

response = requests.post('http://sandbox.my.momapix.com/testme/rest/lightbox"', headers=headers, data=data)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightbox"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
request.body = '{
        "data": {
            "type": "lightbox",
            "attributes": {
                "description": "The title of this new lightbox"
            },
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2239272"
                        },
                        {
                            "type": "item",
                            "id": "2239273"
                        }
                    ]
                }
            }
        }
    }'
response = http.request(request)

A new lightbox can be created by sending a POST request to the /rest/lightbox endpoint. The request MUST include a single lightbox object as primary data with at least the attribute 'type' set to 'lightbox'. The lightbox object MAY contains an attributes object and a relationships object.

The JSON attribute object MAY include the following attributes:

Others attributes MAY be supported. Check the json schema linked in the output of the OPTIONS request to get the detailed list of available attributes.

Creating an empty lightbox does not require any reletionship to be declared. If you wish to create and populate lightbox with items, an array of relationships object identifier MAY be included in the JSON body

Each relationships object identifier MUST include the following attributes:

Response

# Response

{
    "meta": {
        "total": 2,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": {
        "type": "lightbox",
        "id": 246,
        "attributes": {
            "numberofitemsinlightbox": 2,
            "xsize": 3000,
            "ysize": 2012,
            "description": "The title of this new lightbox",
            "subject_date": "2024-02-05",
            "text": null,
            "url_thumb_m": "http://sandbox.d1.momapix.com/testme/320009fd720dfb339e1905e9a7475161075662aaa930ed0d2ac27be6229ed34bbc9fc/Image2239273.jpg",
            "url_thumb_l": "http://sandbox.d1.momapix.com/testme/320009fd720dfb339e1905e9a7475161075662aaa930ed0d2ac27be6229ed34bbc9fc/Preview2239273.jpg"
        },
        "relationships": {
            "items": {
                "links": {
                    "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/246/relationships/items?page[number]=1&page[size]=100",
                    "related": "http://sandbox.my.momapix.com/testme/rest/lightbox/246/items?page[number]=1&page[size]=100"
                },
                "data": [
                    {
                        "type": "item",
                        "id": 2239273
                    },
                    ...
                    ...
                    ...
                ]
            }
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/246?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/lightbox/246?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/lightbox/246?page[number]=1&page[size]=100"
    },
    "included": [
        {
            "type": "item",
            "id": 2239273,
            "attributes": {
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320009fd720dfb339e1905e9a7475161075662aaa930ed0d2ac27be6229ed34bbc9fc/Preview2239273.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320009fd720dfb339e1905e9a7475161075662aaa930ed0d2ac27be6229ed34bbc9fc/Image2239273.jpg",
                "xsize": 3000,
                "ysize": 2012,
                "id_event": 698463,
                "id": 2239273,
                "mime_type": "image/jpeg",
                "archive": "photo",
                "license": "RM",
                "title": "Bombardamenti nel distretto di Douma",
                "caption": "07/04/2018 Damasco. L'esercito siriano ha preso d'assalto con fitti bombardamenti le linee di frontiera dell'esercito islamico nel distretto di Douma nel Ghouta orientale",
                "date": "2018-04-08"
            }
        },
        ...
        ...
        ...
    ]
}
Success

A successful request returns the HTTP 201 Created status code and a body describing the resource collection created.

Updating a lightbox

PATCH /rest/lightbox/<id_lightbox>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X PATCH -d '{
        "data": {
            "type": "lightbox",
            "id": 246,
            "attributes": {
                "description": "This is the chaged title"
            }
        }
    }'  \
    -g "http://sandbox.my.momapix.com/testme/rest/lightbox/246"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightbox/246"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
        "data": {
            "type": "lightbox",
            "id": 246,
            "attributes": {
                "description": "This is the chaged title"
            }
        }
    }');

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightbox/246"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}

data = '{
        "data": {
            "type": "lightbox",
            "id": 246,
            "attributes": {
                "description": "This is the chaged title"
            }
        }
    }'

response = requests.patch('http://sandbox.my.momapix.com/testme/rest/lightbox/246"', headers=headers, data=data)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightbox/246"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
request.body = '{
        "data": {
            "type": "lightbox",
            "id": 246,
            "attributes": {
                "description": "This is the chaged title"
            }
        }
    }'
response = http.request(request)

Use /lightbox/<lightbox identifier> endpoint with PATCH method to update a specific lightbox.

The PATCH URI string MUST include the following attributes:

The PATCH request body MUST include a single lightbox object as primary data. The lightbox object MUST contain type and id members followed by the attributes object.

The attributes object MUST include all the atributes that are supposed to be uptaded. Missing attributes will be kept unchanged.

Response

# Response

null
Success

A successful request returns the HTTP 204 No Content status code and an empty body.

Deleting a lightbox

DELETE /rest/lightbox/<id_lightbox>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X DELETE \
    -g "http://sandbox.my.momapix.com/testme/rest/lightbox/246"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightbox/246"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightbox/246"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.delete('http://sandbox.my.momapix.com/testme/rest/lightbox/246"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightbox/246"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Use /lightbox/<lightbox identifier> endpoint with DELETE method to delete a specific lightbox.

The URI string MUST include the following attributes:

Response

# Response

null
Success

A successful request returns the HTTP 204 No Content status code and an empty body

Fetching the list of items in a lightbox

GET /rest/lightbox/<lightbox identifier>/relationships/items

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

This HTTP API endpoint returns the relationships between the specified lightbox and its associated items, <lightbox identifier> being the unique identifier of the lightbox for which you want to retrieve the relationships. Pagination is supported using the page[size] and page[number] query parameter.

Response

# Response

{
    "meta": {
        "total": 16,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/relationships/items?page[number]=1&page[size]=100"
    },
    "data": [
        {
            "type": "item",
            "id": 2240610
        },
        ...
        ...
        ...
    ]
}

Fetching the content of a lightbox

GET /rest/lightbox/<lightbox identifier>/items

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/lightbox/15/items"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/lightbox/15/items"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/lightbox/15/items"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/lightbox/15/items"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/lightbox/15/items"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

This HTTP API endpoint returns a list of all items associated with the lightbox identified by <lightbox identifier>. Pagination is supported using the page[size] and page[number] query parameter. Use the query filter fields[item] to limit or estend the list of attribute returned,

Response

# Response

{
    "meta": {
        "total": 16,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/items?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/items?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/lightbox/15/items?page[number]=1&page[size]=100"
    },
    "data": [
        {
            "type": "item",
            "id": 2240610,
            "attributes": {
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/320008ba3c3b3a444cce35d086162fc7c23cdb6c989f8b5149140cb2190a9bd81e5ab/Preview2240610.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/320008ba3c3b3a444cce35d086162fc7c23cdb6c989f8b5149140cb2190a9bd81e5ab/Image2240610.jpg",
                "xsize": 2107,
                "ysize": 3000,
                "id_event": 699072,
                "id": 2240610,
                "mime_type": "image/jpeg",
                "archive": "photo",
                "license": "RM",
                "title": "Premiere del film The Guernsey Literary and Potato Peel Pie Society",
                "caption": "09/04/2018 Londra, premiere del film The Guernsey Literary and Potato Peel Pie Society, nella foto Jessica Brown Findlay e Lily James",
                "date": "2018-04-09"
            }
        },
        ...
        ...
        ...
    ]
}
Success

The data attribute returned contains an array of JSON objects, each representing an item object resource associated with the event.

Adding, updating or deleting the content of a lightbox

POST https://prova.momapix.com/rest/lightbox/<id>/relationships/items

PATCH https://prova.momapix.com/rest/lightbox/<id>/relationships/items

DELETE https://prova.momapix.com/rest/lightbox/<id>/relationships/items


/* Add */

curl https://prova.momapix.com/rest/lightbox/15/relationships/items \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version:2.0" \
    -H "Authorization: Bearer tv020jdssst6cbecsf7vnavajd" \
    -X POST -d '{
          "data": [
                { "type": "item", "id": "2239272" },
                { "type": "item", "id": "2239273" }
            ]
        }'

/* Update */

curl https://prova.momapix.com/rest/lightbox/15/relationships/items \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version:2.0" \
    -H "Authorization: Bearer tv020jdssst6cbecsf7vnavajd" \
    -X PATCH -d '{
          "data": [
                { "type": "item", "id": "2239272" },
                { "type": "item", "id": "2239273" }
            ]
        }'


/* Delete */

curl https://prova.momapix.com/rest/lightbox/15/relationships/items \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version:2.0" \
    -H "Authorization: Bearer tv020jdssst6cbecsf7vnavajd" \
    -X DELETE -d '{
          "data": [
                { "type": "item", "id": "2239272" },
                { "type": "item", "id": "2239273" }
            ]
        }'

/* Add */

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://prova.momapix.com/rest/lightbox/15/relationships/items");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ",
    "Content-Type: application/vnd.api+json",
    "Accept: application/vnd.api+json; version:2.0",
    "Authorization: Bearer tv020jdssst6cbecsf7vnavajd"
));
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
      "data": [
            { "type": "item", "id": "2239272" },
            { "type": "item", "id": "2239273" }
        ]
    }');
$response = curl_exec($ch);
curl_close($ch);

/* Uptade */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://prova.momapix.com/rest/lightbox/15/relationships/items");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");

$headers = array();
$headers[] = "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ";
$headers[] = "Content-Type: application/vnd.api+json";
$headers[] = "Accept: application/vnd.api+json; version:2.0";
$headers[] = "Authorization: Bearer tv020jdssst6cbecsf7vnavajd";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$data = array(
  'data' => array(
    array('type' => 'item', 'id' => '2239272'),
    array('type' => 'item', 'id' => '2239273')
  )
);
$payload = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

/* Delete */



/* Add */

import requests

headers = {
    "Apikey": "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ",
    "Content-Type": "application/vnd.api+json",
    "Accept": "application/vnd.api+json; version:2.0",
    "Authorization": "Bearer tv020jdssst6cbecsf7vnavajd"
}

data = {
    "data": [
        { "type": "item", "id": "2239272" },
        { "type": "item", "id": "2239273" }
    ]
}

response = requests.post("https://prova.momapix.com/rest/lightbox/15/relationships/items", headers=headers, json=data)

/* Update */

import requests
import json

url = 'https://prova.momapix.com/rest/lightbox/15/relationships/items'
headers = {
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ',
    'Content-Type': 'application/vnd.api+json',
    'Accept': 'application/vnd.api+json; version:2.0',
    'Authorization': 'Bearer tv020jdssst6cbecsf7vnavajd'
}
data = {
    "data": [
        { "type": "item", "id": "2239272" },
        { "type": "item", "id": "2239273" }
    ]
}
payload = json.dumps(data)

response = requests.patch(url, headers=headers, data=payload)
print(response.text)


/* Delete */

import requests

url = 'https://prova.momapix.com/rest/lightbox/15/relationships/items'
payload = {
    'data': [
        {'type': 'item', 'id': '2239272'},
        {'type': 'item', 'id': '2239273'}
    ]
}
headers = {
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ',
    'Content-Type': 'application/vnd.api+json',
    'Accept': 'application/vnd.api+json; version:2.0',
    'Authorization': 'Bearer tv020jdssst6cbecsf7vnavajd'
}

response = requests.delete(url, json=payload, headers=headers)
print(response.text)


/* Add */

require 'net/http'
require 'uri'

uri = URI.parse("https://prova.momapix.com/rest/lightbox/15/relationships/items")
header = {
    "Apikey" => "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ",
    "Content-Type" => "application/vnd.api+json",
    "Accept" => "application/vnd.api+json; version:2.0",
    "Authorization" => "Bearer tv020jdssst6cbecsf7vnavajd"
}
data = '{"data": [{ "type": "item", "id": "2239272" }, { "type": "item", "id": "2239273" }]}'

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = data

response = http.request(request)

/* Update */

require 'uri'
require 'net/http'
require 'openssl'
require 'json'

url = URI("https://prova.momapix.com/rest/lightbox/15/relationships/items")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Patch.new(url)
request["Apikey"] = '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ'
request["Content-Type"] = 'application/vnd.api+json'
request["Accept"] = 'application/vnd.api+json; version:2.0'
request["Authorization"] = 'Bearer tv020jdssst6cbecsf7vnavajd'
data = {
  "data": [
    { "type": "item", "id": "2239272" },
    { "type": "item", "id": "2239273" }
  ]
}
payload = JSON.generate(data)
request.body = payload

response = http.request(request)
puts response.read_body


/* Delete */

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://prova.momapix.com/rest/lightbox/15/relationships/items')
payload = {
    data: [
        { type: 'item', id: '2239272' },
        { type: 'item', id: '2239273' }
    ]
}.to_json
headers = {
    'Apikey' => '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ',
    'Content-Type' => 'application/vnd.api+json',
    'Accept' => 'application/vnd.api+json; version:2.0',
    'Authorization' => 'Bearer tv020jdssst6cbecsf7vnavajd'
}

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(uri.path, headers)
request.body = payload

response = http.request(request)
puts response.body


You can insert, update or remove the content of a lightbox using POST, PATCH or DELETE method on the /lightbox/<lightbox identifier>/relationships/items endpoint. The request MUST include a top-level member named data containing a resource identifier object corresponding to the related resource that you are going to create, update or dalete.

The resource identifier object MUST include:

Response

A successful request returns the HTTP 204 No Content status code and an empty body

GET

MomaPIX archives store and organize data and information that can be searched using MomaPIX Query Language (MQL), a standard language through REST API services. To search the archive, users submit an MQL instruction using the filter query parameter via HTTP GET request. MQL allows users to specify keywords and attribute values to match against the database. Additional query parameters can be used to fine-tune the results. Pagination, filtering and sorting are supported.

The primary object stored in a MomaPIX archive is the item. Items are organized into events and can be collected into lightboxes. Users can search for items, events, and lightboxes using the respective endpoints /rest/items, /rest/events, and /rest/lightboxes

Whatever search you intend to do, the heart of the request is represented by the MQL string. Read the following dedicated chapter to get started.

MomaPIX Query Language

MQL (MomaPIX Query Language) is the language used to send a search request to a MomaPIX archive. An MQL statement consists of two essential parts:

An MQL string MUST be URL-encode according to RFC 3986 and must be forwarded to the server as the value of the filter key in the HTTP GET query string .

filter=<MQL string>

Searching by keywords

The keywords part is mandatory. Blank search is usually not allowed. There may be exceptions to this rule depending on the MomaPIX archive. The special character % is used (if supported by the server configuration) as a keyword to specify that you are going to search in the whole archive.

The keywords part consists of one or more words separated by space.

The keywords part can also be used to search by id or by file name.

All the terms indicated in the keywords part are searched within the general index of the momapix database.

It is possible to use particular operators to modify the default logic with which the search is carried out.

The available operators are listed below.

Rule Example Results
the space between words implies default AND logic star wars match any records with both the words star and wars
operator | can be used to switch to the OR logic star | wars match any records with at least one of the words star and wars
round brackets can be used for grouping words audience | (star wars) match any records with the word audience OR both the words star and wars
operator - implements the NOT logic start -wars match any records with the word star and without the word wars
operator " can be used for exact search of sentences "star wars is back" match any records with the exact phrase "star wars is back"
operator @ can be used to specify the db field to be searched @caption star match any records with the word star in the caption. Use the OPTIONS method to know the list of avaliable fields.
colon (:) and double quote(") are reserved characters and can't be used in the keywords string "star wars: a new hope" syntax error!

Here's an example MQL string that uses some of these operators:

"star wars is back" | @caption star | (audience friday -pope)

The full meaning of this search is:

Filtering results with attributes

The attribute:value pairs part is optional but, if present, MUST always precede the keywords part. attribute and value MUST be separated by colon. attribute:value pairs MUST be separated by space.

Some very generic attributes and their possible values usually availables are the following:

Attribute Value Description
position 1
2
4
8
portrait orientation
landscape
squared
panoramic

Values can be combined using a binary OR operation, so 3 means portrait or landscape orientation. Setting this attribute to value 15 or not using this attribute:value pair is equivalent.
license 1
2
4
Rights-managed license
Royalty free
Copyright free

Values can be combined using a binary OR operation, so 3 means Rights-managed or Royalty free orientation.
media_type 1
2
4
8
Photo
Video
Audio
Text

Values con be combined using a binary OR operation
image_size 1
2
3
4
5
6
At least 70MB
At least 48MB
At least 24MB
At least 15MB
At least 5MB
At least 1MB

This filter only have meaning for images. It refers to the size in memory.
subject_date YYYYMMDD-YYYYMMDD
YYYYMMDD-
-YYYYMMDD
YYYYMMDD
Search within a date interval
Search after a date
Search before a date
Search in a particular date

Here's an example MQL string that uses some of these attributes for tuning a keywords search:

media_type:1 license:6 position:2 subject_date:20180101- "star wars is back" | star | (audience wednesday -pope)*

The full meaning of this search is:

Many other attributes can be available according to the server configuration. Use the OPTIONS method to retrieve details.

Searching for items

GET /rest/search/items

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion:1&fields[item]=title,caption,date&page[number]=1&page[size]=100"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion:1&fields[item]=title,caption,date&page[number]=1&page[size]=100"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion:1&fields[item]=title,caption,date&page[number]=1&page[size]=100"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion:1&fields[item]=title,caption,date&page[number]=1&page[size]=100"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion:1&fields[item]=title,caption,date&page[number]=1&page[size]=100"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

To perform a search within the MomaPIX database, users can employ the /rest/search/items endpoint and use the GET method followed by query parameters to submit a search request and retrieve matching items. The query parameters key-value pairs that specify search criteria.

The available keys are listed below for reference.

Keys Possible value Default Description
page[number] positive integer 1 The page number to show
page[size] positive integer beetween 1 and 999 100 The pagination size. Not all values are accepted. This number will be always rounded to the next or the max value supported. Some supported value can be 10,16,20,25,32,50,64,96,100,200,250. Check with the OPTIONS method to get details information.
sort date,relevance The sort criteria to be applied to the results. Check with the OPTIONS method to get details information.
fields[item] comma separated strings Fields (related to returned items) to be included in the response JSON body. By default, in order to optimize the use of bandwidth, only a subset of attributes are returned. More optimization can be reached specifing a smaller subset. The all special value let you ask for the complete list of available fields. Check the /search endpoint with the OPTIONS method to get detailed list of available value.
filter MQL String Keywords and attributes to be matched against the db. Read the MQL chapter to better understand the syntax

Non-existent keys will be ignored. Invalid MQL String will generate an error. Invalid value for other existing keys will generate an error.

Response

# Response

{
    "meta": {
        "total": 2543,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "item",
            "id": 2241780.3,
            "attributes": {
                "title": "- nuovo servizio caricato da root il 27-02-2023 001",
                "date": "2023-02-27"
            },
            "links": {
                "self": "http://sandbox.my.momapix.com/testme/rest/item/2241780.3"
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion%3A1&fields[item]=title%2Ccaption%2Cdate&page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion%3A1&fields[item]=title%2Ccaption%2Cdate&page[number]=1&page[size]=100",
        "next": "http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion%3A1&fields[item]=title%2Ccaption%2Cdate&page[number]=2&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/search/items?filter=postion%3A1&fields[item]=title%2Ccaption%2Cdate&page[number]=26&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of items object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Searching for events

GET /rest/search/events

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion:1+%&fields[item]=title,caption,date&page[number]=1&page[size]=100"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion:1+%&fields[item]=title,caption,date&page[number]=1&page[size]=100"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion:1+%&fields[item]=title,caption,date&page[number]=1&page[size]=100"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion:1+%&fields[item]=title,caption,date&page[number]=1&page[size]=100"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion:1+%&fields[item]=title,caption,date&page[number]=1&page[size]=100"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

The MomaPIX database allows users to search for events by using the /rest/search/events endpoint and the GET method. Users can submit a search request with query parameters to retrieve events that match their search criteria. All events with at least one item that matches the search request will be returned. The query parameters used for searching for items are also applicable for searching events, with the addition of one specific parameter listed below.

Keys Possible value Default Description
fields[event] comma separated strings Fields (related to returned events) to be included in the response JSON body. By default, in order to optimize the use of bandwidth, only a subset of attributes are returned. More optimization can be reached specifing a smaller subset. The all special value let you ask for the complete list of available fields. Check the /search endpoint with the OPTIONS method to get detailed list of available value.

Non-existent keys will be ignored. Invalid MQL String will generate an error. Invalid value for other existing keys will generate an error.

Response

# Response

{
    "meta": {
        "total": 738,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "event",
            "id": 699118.3,
            "attributes": {
                "numberofitemsinevent": 1,
                "url_thumb_l": "http://sandbox.d0.momapix.com/testme/32000a057d6b1c260013e6ffce370a546354451d7c90d7fa087a5b5f20fbf9ee6dbbe/Preview2241780.jpg",
                "url_thumb_m": "http://sandbox.d0.momapix.com/testme/32000a057d6b1c260013e6ffce370a546354451d7c90d7fa087a5b5f20fbf9ee6dbbe/Image2241780.jpg",
                "text": null,
                "title": "- nuovo servizio caricato da root il 27-02-2023 001",
                "date": "2023-02-27"
            },
            "links": {
                "self": "http://sandbox.my.momapix.com/testme/rest/event/699118.3"
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion%3A1%20%25&fields[item]=title%2Ccaption%2Cdate&page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion%3A1%20%25&fields[item]=title%2Ccaption%2Cdate&page[number]=1&page[size]=100",
        "next": "http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion%3A1%20%25&fields[item]=title%2Ccaption%2Cdate&page[number]=2&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/search/events?filter=postion%3A1%20%25&fields[item]=title%2Ccaption%2Cdate&page[number]=8&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of events object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body an empty collection.

Searching for lightboxes

GET /rest/search/lightboxes

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description,subject_date&page[number]=1&page[size]=100"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description,subject_date&page[number]=1&page[size]=100"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description,subject_date&page[number]=1&page[size]=100"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description,subject_date&page[number]=1&page[size]=100"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description,subject_date&page[number]=1&page[size]=100"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

The MomaPIX database allows users to search for lightboxes by using the /rest/search/lightboxes endpoint and the GET method. Users can submit a search request with query parameters to retrieve lightboxes that match their search criteria. All lightboxes with at least one item that matches the search request will be returned. The description of the lightbox will be searched as well. The query parameters used for searching for items are also applicable for searching lightboxes, with the addition of one specific parameter listed below.

Keys Possible value Default Description
fields[lightbox] comma separated strings Fields (related to returned lightboxes) to be included in the response JSON body. By default, in order to optimize the use of bandwidth, only a subset of attributes are returned. More optimization can be reached specifing a smaller subset. The all special value let you ask for the complete list of available fields. Check the /search endpoint with the OPTIONS method to get detailed list of available value.

Non-existent keys will be ignored. Invalid MQL String will generate an error. Invalid value for other existing keys will generate an error.

Response

# Response

{
    "meta": {
        "total": 2,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "lightbox",
            "id": 16,
            "attributes": {
                "subject_date": "0000-00-00",
                "description": "trump meeting of 25-02-2019 10:46:00"
            },
            "links": {
                "self": "http://sandbox.my.momapix.com/testme/rest/lightbox/16"
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description%2Csubject_date&page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description%2Csubject_date&page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/search/lightboxes?filter=meeting&fields[lightbox]=description%2Csubject_date&page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of items object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body an empty collection.

Download

POST GET

To download files from a MomaPIX archive, you can connect to the /rest/download endpoint using the appropriate available HTTP methods.

The POST method is used to request the creation of a downloadable object, which can either be an item or a collection of items. If an item is requested, then the file that represents the item is retrieved. If a collection of items is requested, then a zip file containing all the requested item is retrieved.

After the downloadable object is created, the GET method can be used to initiate the download process.

The OPTIONS method can also be used to request information about available format for the downloaded items.

So, to download a file from a MomaPIX site, two requests are required: a POST request followed by a GET request. More details about this process can be found below.

Requesting a downloadable object

POST /rest/download

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X POST -d '{
        "data": {
            "type": "download",
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2241641",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        },
                        {
                            "type": "item",
                            "id": "2241640",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        }
                    ]
                }
            }
        }
    }'  \
    -g "http://sandbox.my.momapix.com/testme/rest/download"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/download"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
        "data": {
            "type": "download",
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2241641",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        },
                        {
                            "type": "item",
                            "id": "2241640",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        }
                    ]
                }
            }
        }
    }');

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/download"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}

data = '{
        "data": {
            "type": "download",
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2241641",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        },
                        {
                            "type": "item",
                            "id": "2241640",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        }
                    ]
                }
            }
        }
    }'

response = requests.post('http://sandbox.my.momapix.com/testme/rest/download"', headers=headers, data=data)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/download"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
request.body = '{
        "data": {
            "type": "download",
            "relationships": {
                "items": {
                    "data": [
                        {
                            "type": "item",
                            "id": "2241641",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        },
                        {
                            "type": "item",
                            "id": "2241640",
                            "outputFormat": "jpg",
                            "outputSize": "low"
                        }
                    ]
                }
            }
        }
    }'
response = http.request(request)

Use the /rest/download endpoint and the POST method to request the creation of a downloadable object. Use the body of the request to transmit a JSON specifing details about the wished content.

The JSON request body MUST include the following attributes:

"items" -> "data" -> [list of item entities]

An item entities MUST include the following attributes:

An item entities MAY include the following attributes:

None of the above attributes are necessarily managed by the MomaPIX server. Use the OPTIONS method to know details available on the MomaPIX installation you are connecting to.

Response

# Response

{
    "data": {
        "type": "download",
        "id": "c8f4785dd11f2858461bfcc820436995",
        "attributes": {
            "expirationTime": "2024-02-05 23:01:00 UTC",
            "downloadLimit": 1
        },
        "links": {
            "self": "http://sandbox.my.momapix.com/testme/rest/download?h=c8f4785dd11f2858461bfcc820436995"
        }
    }
}
Success

A successful request returns the HTTP 201 Created status code and a JSON body describing the downloadable object created; it's identified by the Id attribute reported in the JSON response. The link attribute contains the complete uri to use for fetching the downloadable object. The same link is returned within the header in the Location attribute.

A partial successful request returns the HTTP 201 Created status code and a JSON body describing the downloadable object (the same description available after a successful request) plus a meta attributes describing the error occurred. This situation accurrs when only a subset of the requested items are available for download.

If none of the items requested are availables for download an HTTP 403 Forbidden error is returned with a JSON body describing the error occurred.

Fetching the downloadable object

GET /rest/download

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/download?h=c8f4785dd11f2858461bfcc820436995"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/download?h=c8f4785dd11f2858461bfcc820436995"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/download?h=c8f4785dd11f2858461bfcc820436995"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/download?h=c8f4785dd11f2858461bfcc820436995"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/download?h=c8f4785dd11f2858461bfcc820436995"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Use the /rest/download endpoint and the GET method followed by the one-time hash code identifier obtained during the previous POST call to start downloading the object.

Response

# Response

null
Success

A successful request returns an HTTP 200 OK status code and the requested file to be locally saved.

An unsuccessful request return an HTTP 40x status code and a JSON body describing the error occurred.

Reports

GET

The Reports endpoint is a comprehensive resource within the API, designed to provide a detailed and structured overview of various user interactions and activities within the system. This endpoint is instrumental for administrators and analysts seeking insights into user behavior, system usage, and content engagement. It primarily focuses on gathering and compiling reports related to downloads, searches, and other significant actions performed by users.

Each /rest/report/<endpoints> is equipped with robust features such as pagination, sorting, and filtering, which are crucial for managing and navigating through large datasets. Users can utilize query parameters like page[number] and page[size] to navigate through paginated results, ensuring that the data is presented in manageable chunks. The sort parameter allows for the ordering of reports based on specific criteria, providing a structured view of the data. Additionally, the fields[<endpoint>] parameter can be used to specify particular fields of interest within the reports, optimizing the relevance of the data retrieved. The filter query parameter offers a powerful way to narrow down the results, returning only the reports that meet certain conditions. These capabilities make the /rest/report/<endpoints> resources highly adaptables and efficients, thereby facilitating effective data retrieval and management of extensive datasets.

To fully grasp the specific filters available and their application, it's crucial to understand that the details can vary across different installations. To obtain accurate information tailored to your unique setup, you should send an OPTIONS request to the `/rest/report/. This will prompt the server to provide detailes supported by your particular installation. Additionally, after making the OPTIONS request, it's important to review the JSON schema of validation indicated in the response. This schema will guide you through the list of available attributes and their possible values, ensuring that you have all the necessary information to utilize the filters effectively and tailor your queries to meet your specific needs.

Downloaded items

GET /rest/report/downloads

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/downloads?page[number]=1&page[size]=100&filter=sale_description:migranti+resolution:low+filename:phpimmg2241641.jpg+source_ip:192.168.23.10"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/downloads?page[number]=1&page[size]=100&filter=sale_description:migranti+resolution:low+filename:phpimmg2241641.jpg+source_ip:192.168.23.10"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/downloads?page[number]=1&page[size]=100&filter=sale_description:migranti+resolution:low+filename:phpimmg2241641.jpg+source_ip:192.168.23.10"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/downloads?page[number]=1&page[size]=100&filter=sale_description:migranti+resolution:low+filename:phpimmg2241641.jpg+source_ip:192.168.23.10"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/downloads?page[number]=1&page[size]=100&filter=sale_description:migranti+resolution:low+filename:phpimmg2241641.jpg+source_ip:192.168.23.10"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Use the /rest/report/downloads endpoint to retrieve a comprehensive list of downloaded items. Narrow down the results by providing the appropriate filters in the GET query string. In addition to the filter attribute, you can utilize page[size] and page[number] to manage pagination, controlling the volume of data and the specific segment of the dataset you wish to view. The fields[download] attribute is also available and can be set to 'all' to receive the complete list of properties of the downloaded object. Alternatively, you can specify a comma-separated list of properties you wish to receive. If no specific fields are indicated, the endpoint will return a default set of properties, ensuring you receive essential information even when no explicit preferences are set. This flexibility allows for a tailored data retrieval experience, ensuring you get precisely the data you need in the most convenient format.

The following is just an example of possible attributes to be used for filtering. The complete list can be retrived by fetching the OPTIONS resonse and looking in the valiadation json schema.

Attribute Value Description
download_date YYYYMMDD-YYYYMMDD
YYYYMMDD-
-YYYYMMDD
YYYYMMDD
Search within a date interval
Search after a date
Search before a date
Search in a particular date
client_account <string> Account name of customer
supplier_account <string> Account name of supplier
watermark <boolean> Watermarked or unwatermarked downloaded files
resolution [high|low|pdf] Type of output requested
media_type [photo|video|text|audio] Type of media requested
id_item <integer> Id of the items,
id_order <integer> Order number
... ... Many more filters could be available. Check the JSON validation schema to know the proper list.

Response

# Response

{
    "meta": {
        "total": 19,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "report/downloads",
            "id": 725,
            "attributes": {
                "filename": "phpimmg2241641.jpg",
                "resolution": ...
                "supplier_account": "supplier1",
                "client_account": "client1",
                "download_date": "05-02-2024 23:59:58",
                "sale_description": "Citta' del Vaticano 11/04/2018, udienza generale del mercoled\u00ec'. Nella foto papa Francesco con alcuni migranti richiedenti asilo",
                "sale_credit": "Supplier One",
                "sale_reference...
                "id_item": "CCN2241641",
                "id_order": 4138327
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/downloads?filter=sale_description%3Amigranti%20resolution%3Alow%20filename%3Aphpimmg2241641.jpg%20source_ip%3A192.168.23.10&page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/report/downloads?filter=sale_description%3Amigranti%20resolution%3Alow%20filename%3Aphpimmg2241641.jpg%20source_ip%3A192.168.23.10&page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/report/downloads?filter=sale_description%3Amigranti%20resolution%3Alow%20filename%3Aphpimmg2241641.jpg%20source_ip%3A192.168.23.10&page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/downloads object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Searches

GET /rest/report/searches

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/searches?page[size]=100&filter=client_account:client1+date:20240101-"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/searches?page[size]=100&filter=client_account:client1+date:20240101-"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/searches?page[size]=100&filter=client_account:client1+date:20240101-"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/searches?page[size]=100&filter=client_account:client1+date:20240101-"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/searches?page[size]=100&filter=client_account:client1+date:20240101-"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Use the /rest/report/searches endpoint to retrieve a detailed list of searches performed. You can refine the results by providing appropriate filters in the GET query string. In addition to the filter attribute, you can use page[size] and page[number] to manage pagination, controlling the volume of data and the specific segment of the dataset you wish to view. The fields[search] attribute is also available and can be set to 'all' to receive the complete list of properties of the search object. Alternatively, you can specify a comma-separated list of properties you wish to receive. If no specific fields are indicated, the endpoint will return a default set of properties, ensuring you receive essential information even when no explicit preferences are set. This flexibility allows for a tailored data retrieval experience, ensuring you get precisely the data you need in the most convenient format.

As with the /rest/report/downloads endpoint, it's important to note that the complete list of attributes for filtering the results for this endpoint can be retrieved by fetching the OPTIONS response and examining the validation JSON schema. This approach ensures that you have access to the most accurate and comprehensive list of available attributes for the specific MomaPIX installation.

Response

# Response

{
    "meta": {
        "total": 0,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/searches?filter=client_account%3Aclient1%20date%3A20240101-&page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/searches object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Log Information

GET /rest/report/logs

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date:-20240101&page[number]=2&page[size]=10&fields[log]=all"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date:-20240101&page[number]=2&page[size]=10&fields[log]=all"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date:-20240101&page[number]=2&page[size]=10&fields[log]=all"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date:-20240101&page[number]=2&page[size]=10&fields[log]=all"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date:-20240101&page[number]=2&page[size]=10&fields[log]=all"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Access the /rest/report/logs endpoint to gather log information, providing insights into system operations and activities. Apply filters through the GET query string to narrow down the log entries based on specific criteria such as date, severity, or type. Utilize page[size] and page[number] for effective pagination, helping you navigate through extensive log data. The fields[log] attribute can be adjusted to 'all' for a comprehensive view of log entry properties or to a selected list of properties tailored to your requirements. The default response includes a predefined set of essential log attributes, ensuring valuable information is always at your disposal.

As with the /rest/report/downloads endpoint, it's important to note that the complete list of attributes for filtering the results for this endpoint can be retrieved by fetching the OPTIONS response and examining the validation JSON schema. This approach ensures that you have access to the most accurate and comprehensive list of available attributes for the specific MomaPIX installation.

Response

# Response

{
    "meta": {
        "total": 40062,
        "page": {
            "number": 2,
            "size": 10
        }
    },
    "data": [
        {
            "type": "report/logs",
            "id": 64100,
            "attributes": {
                "id": 64100,
                "date": "2023-10-26 20:28:12",
                "account...
                "type": "upgrading",
                "severity": 50,
                ...: 4594,
                ...: 0,
                "message": "Sending upgrade query number 553.2",
                "source_ip": false
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date%3A-20240101&page[number]=2&page[size]=10",
        "first": "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date%3A-20240101&page[number]=1&page[size]=10",
        "prev": "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date%3A-20240101&page[number]=1&page[size]=10",
        "next": "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date%3A-20240101&page[number]=3&page[size]=10",
        "last": "http://sandbox.my.momapix.com/testme/rest/report/logs?filter=date%3A-20240101&page[number]=4007&page[size]=10"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/logs object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Uploaded items

GET /rest/report/uploads

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date:-20230101+source_ip:192.168.23.10&fields[upload]=all"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date:-20230101+source_ip:192.168.23.10&fields[upload]=all"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date:-20230101+source_ip:192.168.23.10&fields[upload]=all"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date:-20230101+source_ip:192.168.23.10&fields[upload]=all"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date:-20230101+source_ip:192.168.23.10&fields[upload]=all"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Retrieve a list of uploaded items by interacting with the /rest/report/uploads endpoint. Fine-tune your data retrieval by applying filters in the GET query string, focusing on specific upload dates, user accounts, or source IPs. Pagination is smoothly handled by page[size] and page[number], facilitating access to large datasets. The fields[upload] parameter allows for customization of the returned data, enabling you to either receive all available properties of the uploaded items or a curated list of essential attributes. T he endpoint ensures that even without specific field requests, you receive a set of default properties, providing a consistent and informative overview of the uploads.

As with the /rest/report/downloads endpoint, it's important to note that the complete list of attributes for filtering the results for this endpoint can be retrieved by fetching the OPTIONS response and examining the validation JSON schema. This approach ensures that you have access to the most accurate and comprehensive list of available attributes for the specific MomaPIX installation.

Response

# Response

{
    "meta": {
        "total": 138,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "report/uploads",
            "id": 2775,
            "attributes": {
                "id": 2775,
                "id_item": 2241775,
                "current_section...
                "supplier_account": "root",
                "file_name": "2241718.mp3",
                "upload_date": "2022-05-05 10:14:17",
                "action": "(2022-05-05 10:14:17 - root) uploaded in public;(2022-05-05 10:26:43 - root) deleted;",
                "source_ip": "192.168.23.10"
            }
        },
        ...
        ...
        ...
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date%3A-20230101%20source_ip%3A192.168.23.10&page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date%3A-20230101%20source_ip%3A192.168.23.10&page[number]=1&page[size]=100",
        "next": "http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date%3A-20230101%20source_ip%3A192.168.23.10&page[number]=2&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/report/uploads?filter=upload_date%3A-20230101%20source_ip%3A192.168.23.10&page[number]=2&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/uploads object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Syndication

GET /rest/report/syndications

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/syndications?filter=sender:root"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/syndications?filter=sender:root"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/syndications?filter=sender:root"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/syndications?filter=sender:root"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/syndications?filter=sender:root"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

The /rest/report/syndications endpoint offers insights into the syndication process, detailing the distribution and sharing of media items. Filter the results to reflect specific senders, recipients, or statuses using the GET query string. Manage your data review process with page[size] and page[number], ensuring you can handle the information in manageable portions. The fields[syndication] attribute can be customized to 'all' to encompass every detail of the syndication entries or to a specific set of attributes that align with your informational needs. Default properties are provided in the response to maintain a baseline of critical information, ensuring clarity and consistency across your data analysis tasks.

As with the /rest/report/downloads endpoint, it's important to note that the complete list of attributes for filtering the results for this endpoint can be retrieved by fetching the OPTIONS response and examining the validation JSON schema. This approach ensures that you have access to the most accurate and comprehensive list of available attributes for the specific MomaPIX installation.

Response

# Response

{
    "meta": {
        "total": 0,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/syndications?filter=sender%3Aroot&page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/syndications object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Received orders

GET /rest/report/orders

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/orders?filter=order_date:-20240101"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/orders?filter=order_date:-20240101"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/orders?filter=order_date:-20240101"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/orders?filter=order_date:-20240101"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/orders?filter=order_date:-20240101"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Interact with the /rest/report/orders endpoint to obtain detailed information about received orders. Utilize the GET query string to apply filters, focusing your data retrieval on specific order dates, client accounts, or other relevant criteria. Pagination controls, available through page[size] and page[number], assist in navigating through large order datasets. The fields[order] attribute allows for a detailed or selective view of order properties, depending on whether 'all' or a specific set of attributes is requested. The endpoint ensures that a default set of essential order properties is always included in the response, providing a consistent and informative baseline for your order analysis.

As with the /rest/report/downloads endpoint, it's important to note that the complete list of attributes for filtering the results for this endpoint can be retrieved by fetching the OPTIONS response and examining the validation JSON schema. This approach ensures that you have access to the most accurate and comprehensive list of available attributes for the specific MomaPIX installation.

Response

# Response

{
    "meta": {
        "total": 0,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/orders?filter=order_date%3A-20240101&page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/orders object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Embedded items

GET /rest/report/embeds

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/report/embeds?filter=id_item:2241642&fields[embed]=all"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/report/embeds?filter=id_item:2241642&fields[embed]=all"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer u4gfc3abum2t0jp34b3bbvcuba" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/report/embeds?filter=id_item:2241642&fields[embed]=all"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer u4gfc3abum2t0jp34b3bbvcuba' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/report/embeds?filter=id_item:2241642&fields[embed]=all"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/report/embeds?filter=id_item:2241642&fields[embed]=all"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer u4gfc3abum2t0jp34b3bbvcuba"
response = http.request(request)

Access the /rest/report/embeds endpoint to track and analyze embedded media items. Apply filters via the GET query string to focus on specific items, client accounts, or embedding parameters. Pagination is efficiently managed with page[size] and page[number], allowing for structured access to data. The fields[embed] attribute offers flexibility in data presentation, enabling you to choose between receiving all properties of embedded items or a tailored list of key attributes. Even in the absence of specific field requests, the endpoint delivers a set of default properties, ensuring you receive valuable and consistent information about embedded media items.

As with the /rest/report/downloads endpoint, it's important to note that the complete list of attributes for filtering the results for this endpoint can be retrieved by fetching the OPTIONS response and examining the validation JSON schema. This approach ensures that you have access to the most accurate and comprehensive list of available attributes for the specific MomaPIX installation.

Response

# Response

{
    "meta": {
        "total": 0,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/report/embeds?filter=id_item%3A2241642&page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection of report/embeds object.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Billing data

GET

The Billing chapter of the MomaPIX API documentation equips developers with endpoints for retrieving billing-related information. These endpoints are designed to access detailed customer and supplier profile data, including their MomaPIX platform accounts. Developers can use these endpoints to correlate download reports with customer and supplier data, allowing the creation of accurate accounting documents for each downloaded item.

These endpoints enable developers to integrate MomaPIX's digital asset management with accounting software seamlessly.

In essence, the Billing API endpoints act as a vital link between MomaPIX's digital asset management and accounting, providing the necessary tools for automating and enhancing financial operations and reporting.

Retrieving the list of clients

GET /rest/billing/clients

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/billing/clients?fields[client]=reference_person,identification,city,accounts&filter=vat:CLIENT6789V"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/billing/clients?fields[client]=reference_person,identification,city,accounts&filter=vat:CLIENT6789V"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/billing/clients?fields[client]=reference_person,identification,city,accounts&filter=vat:CLIENT6789V"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer dretr0fltk4q1r16ru77jmhga3' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/billing/clients?fields[client]=reference_person,identification,city,accounts&filter=vat:CLIENT6789V"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/billing/clients?fields[client]=reference_person,identification,city,accounts&filter=vat:CLIENT6789V"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer dretr0fltk4q1r16ru77jmhga3"
response = http.request(request)

Use the /rest/billing/clients endpoint to retrieve the list of clients' demographic data. Manage pagination with the page[size] and page[number] parameters, controlling the volume of data and the specific segment of the dataset you wish to view. Filter data using the filter attribute in the GET query string, providing an MQL string with the set of filters to be applied.

The fields[client] attribute is also available and can be set to 'all' to receive the complete list of properties of the client object. Alternatively, you can specify a comma-separated list of properties you wish to receive. If no specific fields are indicated, the endpoint will return a default set of properties.

To know the complete list of available filter attributes and fields[client] list of values, fetch the OPTIONS response and refer to the validation JSON schema.

Response

# Response

{
    "meta": {
        "total": 1,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": [
        {
            "type": "billing/client",
            "id": 3,
            "attributes": {
                "reference_person": "Client 6789 Contact Person",
                "identification": "Client 6789 Company",
                "address": "Address_c16789",
                "city": "City_c16789",
                "province": "Province_c6789",
                "state": "Country_c6789",
                ...: "359 0006789",
                "email": "client6789@client6789.com",
                ...: "CLIENT6789V"
            },
            "links": {
                "self": "http://sandbox.my.momapix.com/testme/rest/billing/client/3"
            }
        }
    ],
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/billing/clients?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/billing/clients?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/billing/clients?page[number]=1&page[size]=100"
    }
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection data.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Retrieving detail about a client

GET /rest/billing/client/<id>

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/billing/client/3?fields[client]=reference_person,identification,city,accounts"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/billing/client/3?fields[client]=reference_person,identification,city,accounts"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/billing/client/3?fields[client]=reference_person,identification,city,accounts"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer dretr0fltk4q1r16ru77jmhga3' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/billing/client/3?fields[client]=reference_person,identification,city,accounts"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/billing/client/3?fields[client]=reference_person,identification,city,accounts"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer dretr0fltk4q1r16ru77jmhga3"
response = http.request(request)

This endpoint provides access to a client demographic file and its related accounts.

Use the fields[client] and fields[account] to narrow down the list of attributes retrieved for the client file and account-related files.

Response

# Response

{
    "meta": {
        "total": 4,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": {
        "type": "billing/client",
        "id": 3,
        "attributes": {
            "city": "City_c16789",
            "accounts": [
                0
            ],
            "identification": "Client 6789 Company",
            "reference_person": "Client 6789 Contact Person"
        },
        "relationships": {
            "items": {
                "links": {
                    "self": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?page[number]=1&page[size]=100",
                    "related": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?page[number]=1&page[size]=100"
                },
                "data": [
                    {
                        "type": "account",
                        "id": 13
                    },
                    ...
                    ...
                    ...
                ]
            }
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/billing/client/3?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/billing/client/3?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/billing/client/3?page[number]=1&page[size]=100"
    },
    "included": [
        {
            "type": "account",
            "id": 13,
            "attributes": {
                "id": 13,
                "login": "client6",
                "name": "Client Six",
                "email": "client6@momapix.com",
                ...: ""
            }
        },
        ...
        ...
        ...
    ]
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection data.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Fetching the list of accounts belonging to a client

GET /rest/billing/clients/<id>/relationships/accounts

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?fields[client]=reference_person,identification,city,accounts"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?fields[client]=reference_person,identification,city,accounts"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?fields[client]=reference_person,identification,city,accounts"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer dretr0fltk4q1r16ru77jmhga3' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?fields[client]=reference_person,identification,city,accounts"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?fields[client]=reference_person,identification,city,accounts"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer dretr0fltk4q1r16ru77jmhga3"
response = http.request(request)

This HTTP API endpoint returns the list of accounts (identified by their IDs) bound to the client file.

Response

# Response

{
    "meta": {
        "total": 4,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/relationships/accounts?page[number]=1&page[size]=100"
    },
    "data": [
        {
            "type": "billing/account",
            "id": 13
        },
        ...
        ...
        ...
    ]
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection data.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.

Fetching information about accounts belonging to a client

GET /rest/billing/client/<id>/accounts

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?fields[client]=reference_person,identification,city,accounts"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?fields[client]=reference_person,identification,city,accounts"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?fields[client]=reference_person,identification,city,accounts"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer dretr0fltk4q1r16ru77jmhga3' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?fields[client]=reference_person,identification,city,accounts"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?fields[client]=reference_person,identification,city,accounts"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer dretr0fltk4q1r16ru77jmhga3"
response = http.request(request)

This HTTP API endpoint returns the detailed information abount each account bound to the client file.

Response

# Response

{
    "meta": {
        "total": 4,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/billing/client/3/accounts?page[number]=1&page[size]=100"
    },
    "data": [
        {
            "type": "billing/account",
            "id": 13,
            "attributes": {
                "id": 13,
                "login": "client6",
                "name": "Client Six",
                "email": "client6@momapix.com",
                ...: ""
            }
        },
        ...
        ...
        ...
    ]
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection data.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection;

Menaging suppliers

GET /rest/billing/suppliers

Request

# Request

curl -s \
    -H "Content-Type: application/vnd.api+json" \
    -H "Accept: application/vnd.api+json; version=2.0" \
    -H "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" \
    -H "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" \
    -X GET \
    -g "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100&fields[supplier]=all"
/* Request */

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100&fields[supplier]=all"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Content-Type: application/vnd.api+json" ,
        "Accept: application/vnd.api+json; version=2.0" ,
        "Apikey: 1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ" ,
        "Authorization: Bearer dretr0fltk4q1r16ru77jmhga3" ,
    ]);

$result = curl_exec($ch);
curl_close($ch);
# Request

import requests

url = 'http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100&fields[supplier]=all"'

headers = {
    'Content-Type': 'application/vnd.api+json' ,
    'Accept': 'application/vnd.api+json; version=2.0' ,
    'Apikey': '1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ' ,
    'Authorization': 'Bearer dretr0fltk4q1r16ru77jmhga3' ,
}


response = requests.get('http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100&fields[supplier]=all"', headers=headers)

print(response.text)
# Request

require "uri"
require "net/http"

url = URI("http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100&fields[supplier]=all"")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/vnd.api+json"
request["Accept"] = "application/vnd.api+json; version=2.0"
request["Apikey"] = "1n29BMfN7EtaPqTzO6D9RIqryZSSiLsJ"
request["Authorization"] = "Bearer dretr0fltk4q1r16ru77jmhga3"
response = http.request(request)

In the MomaPIX REST Service 2.0 documentation, the management of suppliers is analogous to the management of clients. To handle suppliers, you simply need to replace client with supplier and clients with suppliers in the API endpoints. This means that the same operations and functionalities available for clients are also applicable to suppliers, with the only difference being the specific endpoint names. This approach simplifies the process for developers, as they can apply the same logic and methods to both clients and suppliers, ensuring a consistent and efficient way of managing these entities in the MomaPIX system.

For illustration purposes, here's a list of example endpoints, showing how you would switch from client to supplier management:

/rest/billing/suppliers

/rest/billing/supplier/<id>

/rest/billing/supplier/<id>/relationships/accounts

/rest/billing/suppliers/<id>/accounts

Response

# Response

{
    "meta": {
        "total": 1,
        "page": {
            "number": 1,
            "size": 100
        }
    },
    "data": {
        "type": "billing/supplier",
        "id": 3,
        "attributes": {
            "id": 3,
            ...: "",
            ...: "",
            ...: "SUPPLIERTHREECF",
            ...: "349 000003",
            ...: "SUPPLIERTHR",
            ...: "000S3",
            "city": "City_s3",
            "iban": "SP03IT000000000000000003",
            "email": "supplier3@supplier3.com",
            "state": "Country_s3",
            "address": "Address Of S3",
            "accounts": [
                0
            ],
            "province": "Province_s3",
            "bank_name": "Supplier Three Bank Name",
            "swift_code": "SWIFTCODES3",
            "identification": "Supplier Three",
            "percentage_on_sales": 63
        },
        "relationships": {
            "items": {
                "links": {
                    "self": "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3/relationships/accounts?page[number]=1&page[size]=100",
                    "related": "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3/accounts?page[number]=1&page[size]=100"
                },
                "data": [
                    {
                        "type": "account",
                        "id": 5
                    }
                ]
            }
        }
    },
    "links": {
        "self": "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100",
        "first": "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100",
        "last": "http://sandbox.my.momapix.com/testme/rest/billing/supplier/3?page[number]=1&page[size]=100"
    },
    "included": [
        {
            "type": "account",
            "id": 5,
            "attributes": {
                "id": 5,
                "login": "supplier3",
                "name": "Supplier Three",
                "email": "supplier3@momapix.com",
                ...: ""
            }
        }
    ]
}
Success

A successful request returns the HTTP 200 OK status code and a JSON response body with a collection data.

A request that do not match any record returns the HTTP 200 OK status code and a JSON response body with an empty collection.