> For the complete documentation index, see [llms.txt](https://shoppa.gitbook.io/knowledge-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shoppa.gitbook.io/knowledge-hub/api-documentation/endpoints/xml.md).

# REST

## /api/xml

## Used for uploading Shoppa XML's to the integration service bus queue

<mark style="color:orange;">`PUT`</mark> `https://api.mediablob.com/api/xml`

Available Shoppa XML's can be found at [XML structure](/knowledge-hub/api-documentation/xml-structure.md)

#### Headers

| Name                                             | Type   | Description                                                                       |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>  | String | Basic authentication using the integration user credentials.                      |
| customerId<mark style="color:red;">\*</mark>     | String | ShoppaID or ExternalID for the customer node.                                     |
| customerIdType<mark style="color:red;">\*</mark> | String | "ShoppaID" or "ExternalID". Should be correspondant to the id used as customerId. |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| Text | String |             |
| File | Object |             |

{% tabs %}
{% tab title="202: Accepted Message is accepted and being processed by Shoppas service bus queue" %}
SessionId example:

```
23829771-e1d5-4dc3-8311-6503a38f2614
```

{% endtab %}

{% tab title="400: Bad Request XML is wrongly defined" %}

```json
{
message: "The request is invalid."
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized message" %}

```json
{
message: "Authorization has been denied for this request."
}
```

{% endtab %}
{% endtabs %}

## Used for uploading a custom XML to the integration service

<mark style="color:orange;">`PUT`</mark> `https://api.mediablob.com/api/xml/custom`

Custom XML's will be passed through one or several XSLT schemas before being uploaded to the service bus queue.\
XSLTs are uploaded by Shoppa. To upload or change an XSLT, contact your Shoppa representative for help.

#### Headers

| Name                                             | Type   | Description                                                                       |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>  | String | Basic authentication using the integration user credentials.                      |
| customerId<mark style="color:red;">\*</mark>     | String | ShoppaID or ExternalID for the customer node.                                     |
| customerIdType<mark style="color:red;">\*</mark> | String | "ShoppaID" or "ExternalID". Should be correspondant to the id used as customerId. |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| Text | String |             |
| File | Object |             |

{% tabs %}
{% tab title="202: Accepted Message is accepted and being processed by Shoppas service bus queue" %}
SessionId example:

```
23829771-e1d5-4dc3-8311-6503a38f2614
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized message" %}

```json
{
message: "Authorization has been denied for this request."
}
```

{% endtab %}
{% endtabs %}

## Operation to list all uploaded XML's for the defined date

<mark style="color:blue;">`GET`</mark> `https://api.mediablob.com/api/xml/{date}`

#### Headers

| Name                                             | Type   | Description                                                                       |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>  | String | Basic authentication using the integration user credentials.                      |
| customerId<mark style="color:red;">\*</mark>     | String | ShoppaID or ExternalID for the customer node.                                     |
| customerIdType<mark style="color:red;">\*</mark> | String | "ShoppaID" or "ExternalID". Should be correspondant to the id used as customerId. |

{% tabs %}
{% tab title="200: OK List of all uploaded files for the day" %}
**Id:** SessionId for the message.\
**File:** Link to the upoaded file.\
**Result:** Route to retrieve the result file. See [#api-status](#api-status "mention")for more information.\
**Errors:**&#x20;

```json
{
id: "80004390-0000-a900-b63f-84710c7967bb",
receivedAt: "2022-12-28T13:01:51+00:00",
fileLenght: 164,
sentBy:{
    name: "sebbewstest",
    shoppaId: 17786,
    externalId: null
},
file: "https://mbintegrationdatainttest.blob.core.windows.net/xml/2022-12-28/17786/17786/a5ff59a67806e7af3d49fb184a671c68.xml",
result: "https://api.test2.mediablob.com/api/status/80004390-0000-a900-b63f-84710c7967bb/result",
errors:[]
}
```

{% endtab %}

{% tab title="400: Bad Request Date format is incorrect" %}

```json
{
message: "The request is invalid."
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized message" %}

```json
{
message: "Authorization has been denied for this request."
}
```

{% endtab %}
{% endtabs %}

## /api/auth

## Validate authentication and fetch environment information

<mark style="color:blue;">`GET`</mark> `https://api.mediablob.com/api/auth/me`

Can be used to fetch information about the environment node structure. Such as customerIds, available languageCodes/countryCodes.

{% tabs %}
{% tab title="200: OK" %}

```
{
    "id": 12345,
    "userName": "testuser",
    "email": "test@shoppa.com",
    "countryCode": "xx",
    "languageCode": "sv-SE",
    "customerId": 18503,
    "availableCountries": [
        "xx"
    ],
    "availableLanguages": [
        "sv-SE",
        "no-NO",
        "pl-PL",
        "fi-FI",
        "xx"
    ],
    "availableCustomers": {
        "18503": "MyOrganisation",
        "7934": "Structure",
        "11": "Structure",
        "0": "Structure",
        "7080": "Printshop",
        "7": "Structure"
    },
    "subscribedStoreInfo": [
    ],
    "customerGroups": [
    ],
    "customerGroupGuids": [
    ],
    "validationGuid": [GUID],
    "addOns": [
        "WebserviceImport",
        "IntegrationDownloadPicture2"
    ],
    "legacyAddOns": [
        "None"
    ],
    "lockedMediablobFields": [
    ],
    "productGroupSubscribeId": 18503,
    "authToken": {
        "version": 0,
        "userName": "testuser",
        "customerId": 18503,
        "expireTime": "2025-01-01T10:13:41.2506383+00:00",
        "hash": "1lwdznULwZt9CJbuqdyvOirhvperYI05C952f76+Wow="
    },
    "authTokenBytes": "AABzYXNkMTIzR0gAAAOiYp1fL3s8TzV5Hlw7cE9m1rYg4xRj2aZsP7Wb5Kd9Uj+Nt2qVrJ0Y8==",
    "currency": "SEK",
    "currencyFactor": 0.0,
    "isHeadOffice": true,
    "versions": {
        "shoppa": ""
    }
}
```

{% endtab %}

{% tab title="401 Unautorized" %}

```
{
    "message": "Authorization has been denied for this request."
}
```

{% endtab %}
{% endtabs %}

## /api/status[^1]

## Operation to check if the XML processing is done

<mark style="color:blue;">`GET`</mark> `https://api.mediablob.com/api/status/{sessionId}/done`

{sessionId} corresponds to the hashcode returned by a 202 Accepted response in [#api-xml](#api-xml "mention")

{% tabs %}
{% tab title="200: OK Boolean response that is either true or false" %}

```
true
```

```
false
```

{% endtab %}
{% endtabs %}

## Operation to get a detailed information about the XML process

<mark style="color:blue;">`GET`</mark> `https://api.mediablob.com/api/status/{sessionId}/result`

{sessionId} corresponds to the hashcode returned by a 202 Accepted response in [#api-xml](#api-xml "mention")

{% tabs %}
{% tab title="200: OK Upload completed without errors" %}

{% endtab %}

{% tab title="202: Accepted Upload is still in queue" %}

```
The request is still being proccessed.
```

{% endtab %}

{% tab title="301: Moved Permanently Upload completed with errors" %}
Response header contains a parameter "Location". The parameter contains an URL to the error message.
{% endtab %}
{% endtabs %}

## /api/images

## Upload images

<mark style="color:green;">`POST`</mark> `https://api.mediablob.com/api/images`

Upload one or more images to Mediablob as multipart form data objects. If this image already exists, the \
\
In C# you need to add the images to a `MultipartFormDataContent` object, which you add to an `HttpClient` call. The response contains the Mediablob id for each image, which you can use to reference the images in further integrations.\
\
If your image has a clipping path you can add these parameters to the call to tell our rest endpoint which clipping path you want to use. The invert parameter is there to make it possible to invert the clipping path.

#### Query Parameters

| Name         | Type   | Description                                                                                  |
| ------------ | ------ | -------------------------------------------------------------------------------------------- |
| invert       | String | True if the inside of the clipping path shall be removed instead of kept. Defaults to False. |
| clippingpath | String | <p>The name of the clipping path to be used.<br>Defaults to not use clipping paths.</p>      |

#### Headers

| Name                                             | Type   | Description                                                                       |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>  | String | Basic authentication using the integration user credentials.                      |
| customerId<mark style="color:red;">\*</mark>     | String | ShoppaID or ExternalID for the customer node.                                     |
| customerIdType<mark style="color:red;">\*</mark> | String | "ShoppaID" or "ExternalID". Should be correspondant to the id used as customerId. |

#### Request Body

| Name | Type   | Description                                                                                         |
| ---- | ------ | --------------------------------------------------------------------------------------------------- |
| file | Object | <p>Binary image data. <br>Repeat for each image to be uploaded. The parameter name is not used.</p> |

{% tabs %}
{% tab title="200: OK Image was uploaded. The returned hashcode can be used to bind the image to one or more products." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Check if an image exists

`HEAD` `https://api.mediablob.com/api/images/{Mediablob-hashcode}`

Verify that an image exists in Mediablob by using the Mediablob-hashcode that was returned when the image was originally uploaded.

#### Headers

| Name                                             | Type   | Description                                                                       |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>  | String | Basic authentication using the integration user credentials.                      |
| customerId<mark style="color:red;">\*</mark>     | String | ShoppaID or ExternalID for the customer node.                                     |
| customerIdType<mark style="color:red;">\*</mark> | String | "ShoppaID" or "ExternalID". Should be correspondant to the id used as customerId. |

{% tabs %}
{% tab title="200: OK Image exists." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found Image does not exist." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Find the Mediablob hashcode for an uploaded image

<mark style="color:blue;">`GET`</mark> `https://api.mediablob.com/api/images`

Find the Mediablob-hashcode for an image that has been previously uploaded. You need to provide one of `md5` or `uri` query parameter, but not both in the request.\
\
The Mediablob-hashcode is returned in the response if it is successful, which you can use to reference the image in further integrations.

#### Query Parameters

| Name | Type   | Description                                                                                                                                   |
| ---- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| md5  | String | The md5 hash of the original image.                                                                                                           |
| uri  | String | <p>An external uri from which the image was originally fetched. <br>Images can be fetched from external uri's during product xml uploads.</p> |

#### Headers

| Name                                             | Type   | Description                                                                       |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark>  | String | Basic authentication using the integration user credentials.                      |
| customerId<mark style="color:red;">\*</mark>     | String | ShoppaID or ExternalID for the customer node.                                     |
| customerIdType<mark style="color:red;">\*</mark> | String | "ShoppaID" or "ExternalID". Should be correspondant to the id used as customerId. |

{% tabs %}
{% tab title="200: OK Image exists." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="404: Not Found Image does not exist." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

[^1]:


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://shoppa.gitbook.io/knowledge-hub/api-documentation/endpoints/xml.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
