Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Photoshop API: Presets method returns 400 Bad Request with empty body

malkow
Level 1
Level 1

I'm trying to get a successful /lrService/presets call. I got myself a token and assembled a request according to https://github.com/AdobeDocs/lightroom-api-docs#presets but I always get a 400 Bad Request response with a completely empty body. Any ideas?

That's my request:

{
    "curlopts": {
        "HTTPHEADER": [
            "authorization: Bearer eyJ4NXUiOiJpbXNfbmExLWtleS0xLmNlciIsImFsZyI6IlJ...GElSq1Pg",
            "Content-Type: application/json",
            "x-api-key: 448...2c0f"
        ]
    },
    "json": {
        "inputs": {
            "source": {
                "href": "/files/input.jpg",
                "storage": "adobe"
            },
            "presets": {
                "href": "/files/preset.xmp",
                "storage": "adobe"
            }
        },
        "outputs": {
            "href": "/files/output.jpg",
            "storage": "adobe",
            "type": "image/jpeg",
            "overwrite": true
        }
    }
}
1 Accepted Solution
shayan_c
Correct answer by
Level 1
Level 1

Hello,

 

I see that the json you are sending is incorrect. Here is the correct format for the /presets call:

 

{
  "inputs": {
    "source": {
      "href": "/files/acr/input.jpg",
      "storage": "adobe"
    },
    "presets": [
      {
        "href": "/files/preset.xmp",
        "storage": "adobe"
      }
    ]
  },
  "outputs": [
    {
      "href": "/files/output.jpg",
      "type": "image/jpeg",
      "storage": "adobe",
      "overwrite": true
    }
  ]
}

 

Please let me know if this works! And apologies that the response body is empty with no further info. We will have that fixed and ensure that we return the correct error messages.

 

Also for further questions/concerns you can reach out to us directly at: psdservices@adobe.com

 

Thanks

-Shayan

View solution in original post

7 Replies
shayan_c
Correct answer by
Level 1
Level 1

Hello,

 

I see that the json you are sending is incorrect. Here is the correct format for the /presets call:

 

{
  "inputs": {
    "source": {
      "href": "/files/acr/input.jpg",
      "storage": "adobe"
    },
    "presets": [
      {
        "href": "/files/preset.xmp",
        "storage": "adobe"
      }
    ]
  },
  "outputs": [
    {
      "href": "/files/output.jpg",
      "type": "image/jpeg",
      "storage": "adobe",
      "overwrite": true
    }
  ]
}

 

Please let me know if this works! And apologies that the response body is empty with no further info. We will have that fixed and ensure that we return the correct error messages.

 

Also for further questions/concerns you can reach out to us directly at: psdservices@adobe.com

 

Thanks

-Shayan

View solution in original post

malkow
Level 1
Level 1
Thanks, now I receive a result body: {"title":"Unauthorized","code":401,"type":"InvalidAuthTokenError","details":{"reason":"Unable to access the input href","name":"/files/input.jpg"}}
shayan_c
Level 1
Level 1

So a couple of things here:

  1. Please make sure you got a valid token from your credentials and that this is a OAuth integration that you have for your API key.
  2. I'm hoping you are using Adobe storage and if so, please make sure you have this input file at its location: /files/input.jpg
malkow
Level 1
Level 1

Okay so the OAuth is now configured and with the token I get from OAuth (scope is "AdobeID,openid") I receive:

{"error_code":"403016","message":"Oauth token type not valid"}

 

According to the Developer Console the service I need to use "Lightroom - Creative Cloud Automation Services" requires a JWT access token, not an OAuth. But as I said, using the generated token from the console results in:

{"title":"Unauthorized","code":401,"type":"InvalidAuthTokenError","details":{"reason":"Unable to access the input href","name":"/assets/input.jpg"}}

 

malkow
Level 1
Level 1
I managed to make a successful request now. I had to use dropbox for inputs and outputs hrefs. Seems like there is an issue with the Creative Cloud Files authorization.
shayan_c
Level 1
Level 1
Malkow, great to hear that you got yourself unblocked! Unfortunately yes, if you used "Lightroom - Creative Cloud Automation Services" and not the "Lightroom / Camera Raw API" then you would have to use a JWT token. And if its a JWT token, you will not be able to use Creative Cloud /files.