mulemulesoftmule4anypoint-platformanypoint-rtf

How to upload jar file to anypoint exchange


Recently I am trying to build pipeline for deploying mule 4 apps in to RTF. I have gone through the documentation and found difficult to frame the url that is used for uploading jar to anypoint exchange. here is the request

curl -L -X PUT 'https://maven.anypoint.mulesoft.com/api/v1/organizations/<group id>/maven/<group id>/<app-name>/1.0.0/<app-name>-1.0.0-mule-application.jar' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Authorization: Bearer <bearer token>' \
-H 'X-ANYPNT-ENV-ID: <environment ID>' \
-H 'X-ANYPNT-ORG-ID: <org ID>' \
-H 'Content-Type: application/java-archive' \
-H 'Connection: keep-alive' \
--data-binary '@<full path to file>' 

in the url 'https://maven.anypoint.mulesoft.com/api/v1/organizations/<group id>/maven/<group id>/<app-name>/1.0.0/<app-name>-1.0.0-mule-application.jar' I am unable to figure out "" which is repeated two times I thought of using the group id which is used in my pom.xml which looks like this

<modelVersion>4.0.0</modelVersion>
    <groupId>org.worldbankgroup</groupId>
    <artifactId>test-project</artifactId>
    <version>5.0.0</version>
    <packaging>mule-application</packaging>

so I tried framing like these ways

https://maven.anypoint.mulesoft.com/api/v1/organizations/org.worldbankgroup/maven/org.worldbankgroup/test-project/5.0.0/test-project-5.0.0-dev393-mule-application.jar

and

https://maven.anypoint.mulesoft.com/api/v1/organizations/worldbankgroup/maven/org.worldbankgroup/test-project/5.0.0/test-project-5.0.0-dev393-mule-application.jar and

https://maven.anypoint.mulesoft.com/api/v1/organizations/wbg/maven/org.worldbankgroup/test-project/5.0.0/test-project-5.0.0-dev393-mule-application.jar

in the above url for occurence first group id. I used my orginaztion name in anypoint platform

both are giving the error . I am trying to figure out how to frame this url. can you help me on that

{"name":"Not Found","status":404,"message":"File not found",
"details":
[
{"message":"Asset File was not found",
"code":"asset.file.notFound","arguments":
[
"PUT /organizations/worldbankgroup/groups/org.worldbankgroup/assets/test-project/versions/5.0.0/classifiers/dev393-mule-application/packagings/jar does not exist in the RAML for this application"
]
}
]
}

I tried even like this by using organization id in the url

curl --location --request PUT 'https://maven.anypoint.mulesoft.com/api/v3/organizations/321d4e25-5992-4160-b907-8254b005ac3e/maven' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Authorization: Bearer 7434a69e-bca393c' \
--header 'X-ANYPNT-ENV-ID: e20588cc71c3d' \
--header 'X-ANYPNT-ORG-ID: 321d454b005ac3e' \
--header 'Content-Type: application/java-archive' \
--header 'Connection: keep-alive' \
--data-binary '@/C:/Users/wb587070/AnypointStudio/s7-12-workspace/test-project/target/test-project-5.0.0-dev393-mule-application.jar' 

it throwing a different error now

 {
    "name": "Precondition Failed",
    "status": 412,
    "message": "The runId parameter is missing, the preconditions have not been executed.",
    "details": []
}

can you help me in figure out the correct url


Solution

  • curl --location --request PUT 'https://maven.anypoint.mulesoft.com/api/v1/organizations/<org-id>/maven/<org-id>/<appname>/<version>/app-name-1.0.0-mule-application.jar' \
    --header 'Accept: application/json, text/plain, */*' \
    --header 'Authorization: Bearer <acsess token>' \
    --header 'X-ANYPNT-ENV-ID: <env-id>' \
    --header 'X-ANYPNT-ORG-ID: <org-id>' \
    --header 'Content-Type: application/java-archive' \
    --header 'Connection: keep-alive' \
    --data-binary '@<full path to file>'
    

    Remember for the user that you are generating acsess token. They should have proper accesess in anypoint platform. to upload jar to exchange