Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

Artifactory: Artifactory 7.x REST API Quickstart

Here’s a step-by-step practical guide to using the JFrog Artifactory 7.x REST API to manage your instance (create repos, users, etc.) using your server and credentials.


🟢 Artifactory 7.x REST API Quickstart

Server: http://65.2.152.172:8082/

Username: admin

Password: password


1️⃣ Authentication

For scripting/API, you can use:

  • Basic Auth (-u admin:password)
  • (Best practice) Create an API key or access token from the UI and use that instead of a raw password.

But for quick testing, Basic Auth is fine.


2️⃣ API Endpoint URLs (7.x)

  • Main APIs are under:
    http://65.2.152.172:8082/artifactory/api/

For access and user/group management:
http://65.2.152.172:8082/access/api/


3️⃣ Check Connectivity

curl -u admin:password http://65.2.152.172:8082/artifactory/api/system/ping
Code language: JavaScript (javascript)

Should return OK


4️⃣ Create a Local Repository

Example: Create a new local Maven repo named my-maven-local

curl -u admin:password -X PUT \
  -H "Content-Type: application/json" \
  -d '{
        "rclass": "local",
        "packageType": "maven",
        "description": "My Maven local repo"
      }' \
  http://65.2.152.172:8082/artifactory/api/repositories/my-maven-local
Code language: PHP (php)
  • For npm, change "packageType": "npm", etc.

5️⃣ Create a Remote Repository

Example: Create a remote Maven Central proxy

curl -u admin:password -X PUT \
  -H "Content-Type: application/json" \
  -d '{
        "rclass": "remote",
        "packageType": "maven",
        "url": "https://repo.maven.apache.org/maven2",
        "description": "Remote Maven Central"
      }' \
  http://65.2.152.172:8082/artifactory/api/repositories/maven-central-remote
Code language: PHP (php)

6️⃣ Create a User

curl -u admin:password \
  -H "Content-Type: application/json" \
  -X PUT "http://65.2.152.172:8082/artifactory/api/security/users/jane" \
  -d '{
    "email": "jane@example.com",
    "password": "JanePassword123!",
    "admin": false,
    "groups": []
  }'

curl -u admin:password -X PUT \
  -H "Content-Type: application/json" \
  -d '{
    "email" : "jane1@example.com",
    "password" : "JanePassword123!",
    "admin" : false,
    "profileUpdatable": true
  }' \
  "http://65.2.152.172:8082/artifactory/api/security/users/jane1"
Code language: PHP (php)
  • Set "admin": true if you want to make the user admin.

7️⃣ List Repositories

curl -u admin:password http://65.2.152.172:8082/artifactory/api/repositories
Code language: JavaScript (javascript)

List of Users

curl -u admin:password "http://65.2.152.172:8082/artifactory/api/security/users"
Code language: JavaScript (javascript)


8️⃣ Get Repository Configuration

curl -u admin:password http://65.2.152.172:8082/artifactory/api/repositories/my-maven-local
Code language: JavaScript (javascript)

9️⃣ Delete a Repository

curl -u admin:password -X DELETE http://65.2.152.172:8082/artifactory/api/repositories/my-maven-local
Code language: JavaScript (javascript)

🔟 Create a Group

curl -u admin:password \
  -H "Content-Type: application/json" \
  -X PUT \
  -d '{
        "description": "Developers"
      }' \
  "http://65.2.152.172:8082/artifactory/api/security/groups/developers1"

Code language: PHP (php)

1️⃣1️⃣ Assign a User to a Group

curl -u admin:password -X PATCH \
  -H "Content-Type: application/json" \
  -d '{
        "groups": ["developers"]
      }' \
  http://65.2.152.172:8082/access/api/v1/users/raj
Code language: PHP (php)

📚 Official Docs & Swagger


🚦 Tips

  • Use -v with curl to debug requests.
  • Use JFrog CLI for easier scripting and more advanced automation.
  • For production, use access tokens or API keys (never passwords).

🟢 Summary Table

ActionAPI Endpoint Example
Ping/artifactory/api/system/ping
Create Local Repo/artifactory/api/repositories/<repo>
Create Remote Repo/artifactory/api/repositories/<repo>
Create User/access/api/v1/users/<username>
Create Group/access/api/v1/groups/<group>
Assign User/Group/access/api/v1/users/<username> (PATCH groups)
List Repos/artifactory/api/repositories

Here are several practical examples for uploading artifacts to Artifactory using different methods, including REST API (with curl) and JFrog CLI. These examples will help you quickly upload files from a local system to an Artifactory repository.

1. Upload with REST API and curl

Syntax:

textcurl -u <USERNAME>:<PASSWORD> -X PUT -T <LOCAL_FILE_PATH> "http://<ARTIFACTORY_URL>/artifactory/<REPO>/<PATH>/<FILENAME>"

Example:

textcurl -u admin:password -X PUT -T ./myapp-1.0.0.jar "http://65.2.152.172:8082/artifactory/my-local-repo/myapp/1.0.0/myapp-1.0.0.jar"
  • Replace my-local-repo, myapp/1.0.0/, and the filenames as needed.
  • You can also include artifact properties in the URL: textcurl -u admin:password -X PUT -T ./app.zip "http://65.2.152.172:8082/artifactory/my-local-repo/app.zip;release=true;version=1.0"
  • On success, you’ll see a HTTP 201 response12.

2. Upload Using JFrog CLI

  • Install the CLI:
    Download here and configure it for your server (one-time setup): textjfrog config add my-server --url=http://65.2.152.172:8082 --user=admin --password=password
  • Upload a Single File: textjfrog rt upload "myapp-1.0.0.jar" "my-local-repo/myapp/1.0.0/"
  • Upload All Files in a Folder: textjfrog rt upload "dist/*" "my-local-repo/myapp/1.0.0/"
  • Recursively upload a folder: textjfrog rt upload "my-folder/*" my-local-repo/
  • For advanced usage and options, see the official [JFrog CLI documentation]34.

3. Uploading via Artifactory UI (for small/manual uploads)

  1. In the Artifactory web UI, navigate to your target repository and folder.
  2. Click the “Deploy” or “Upload” button.
  3. Select your file(s) and confirm upload.

4. Upload via CI Tool or Script (Generic)

If automating in CI, your steps would typically use either the REST API (curl, see above), or invoke the JFrog CLI as part of the pipeline.

References for Official Docs and Further Reading:

Tip:
For scripted automation, always prefer access tokens or API keys over basic passwords for improved security.

If you need specific examples for Maven, npm, or other build types, just specify the ecosystem!

Five different ways to upload JAR files to JFrog Artifactory – YouTube

To interact with your JFrog Artifactory server (http://65.2.152.172:8082/) using the API (for example, to create repositories, users, etc.), you will mainly use REST API calls authenticated as your admin user. Here’s a clear, practical guide:

1. Authentication

For most API calls, you can use Basic Authentication with your username and password (admin/password), or (recommended) generate and use an access token.

  • Basic Auth (not recommended for production scripts):
    Use the -u option with curl: textcurl -u admin:password http://65.2.152.172:8082/artifactory/api/system/ping A response of OK means the API is accessible.
  • Access Token (recommended):
    1. Log in as admin to the UI.
    2. Go to Identity and Access → Access Tokens and generate a new admin token.
    3. Use that token in an API call: textcurl -H "Authorization: Bearer <YOUR_TOKEN>" http://65.2.152.172:8082/artifactory/api/system/ping
    Tokens are safer and preferred in scripts or automation123.

2. API Base URL

The API base for your instance is:
http://65.2.152.172:8082/

Most API endpoints relevant to Artifactory are under /artifactory/api/
User and group APIs are often under /access/api/ (for Access-based security).

3. Create a Local Repository

REST endpoint:
PUT /artifactory/api/repositories/{repoKey}

Example (create a Maven local repository):

textcurl -u admin:password \
  -H "Content-Type: application/json" \
  -X PUT "http://65.2.152.172:8082/artifactory/api/repositories/my-maven-local" \
  -d '{
    "rclass": "local",
    "packageType": "maven",
    "description": "My Maven repo"
  }'
  • Change my-maven-local and "packageType" as needed (npm, docker, etc.).
  • For more options (remote/virtual/federated), see the official docs45.

Response:
201 Created on success.

4. Create a User

REST endpoint:
POST /access/api/v2/users

Example:

textcurl -u admin:password \
  -H "Content-Type: application/json" \
  -X POST "http://65.2.152.172:8082/access/api/v2/users" \
  -d '{
    "username": "jane",
    "password": "JanePassword123!",
    "email": "jane@example.com",
    "admin": false,
    "groups": [],
    "profile_updatable": true
  }'
  • Adjust parameters as needed for new user (admin privileges, group membership, etc.).
    Requires admin privileges to use this endpoint6.

5. Other Useful API Examples

  • Get All Repositories: textcurl -u admin:password http://65.2.152.172:8082/artifactory/api/repositories
  • Delete a Repository: textcurl -u admin:password -X DELETE http://65.2.152.172:8082/artifactory/api/repositories/my-maven-local
  • List Users: textcurl -u admin:password http://65.2.152.172:8082/access/api/v2/users

6. Best Practices

  • Avoid using admin:password in scripts—use access tokens where possible.
  • Use appropriate Content-Type headers, usually application/json.
  • For all API calls, check the official Artifactory REST API docs for parameters, endpoint changes, and security notes.
  • For complex JSON payloads (like advanced repo settings), you can export config examples from the UI and modify as needed.

7. References for Official API Docs

In Summary:
You can script any Artifactory action—repo creation, user management, build upload, and more—using basic curl REST requests, authenticated with user/password or an access token. Always follow best practices for authentication and automation.416

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x